Class Extensions
- Namespace
- StockSharp.Messages
- Assembly
- StockSharp.Messages.dll
Extension class.
public static class Extensions
- Inheritance
-
Extensions
- Inherited Members
Fields
AllSecurityId
"All securities" id.
public static readonly string AllSecurityId
Field Value
AnonymousPortfolioName
Anonymous account.
public const string AnonymousPortfolioName = "Anonymous_SS"
Field Value
AnyDepths
Special set mean any depth for SupportedOrderBookDepths option.
public static readonly IEnumerable<int> AnyDepths
Field Value
LookupAllCriteriaMessage
Lookup all securities predefined criteria.
public static readonly SecurityLookupMessage LookupAllCriteriaMessage
Field Value
NewsStockSharpSource
StockSharp news source.
public const string NewsStockSharpSource = "StockSharp"
Field Value
SimulatorPortfolioName
Simulator.
public const string SimulatorPortfolioName = "Simulator_SS"
Field Value
Today
Constant value for TillDate means Today(=Session).
public static readonly DateTimeOffset Today
Field Value
Properties
AllCandleTypes
All registered candle types.
public static IEnumerable<Type> AllCandleTypes { get; }
Property Value
AllSecurity
"All securities" instance.
public static SecurityMessage AllSecurity { get; }
Property Value
BestAskFields
Fields related to best ask.
public static CachedSynchronizedSet<Level1Fields> BestAskFields { get; }
Property Value
BestBidFields
Fields related to best bid.
public static CachedSynchronizedSet<Level1Fields> BestBidFields { get; }
Property Value
LastTradeFields
Fields related to last trade.
public static CachedSynchronizedSet<Level1Fields> LastTradeFields { get; }
Property Value
MarketDataMessageTypes
Market-data message types.
public static IEnumerable<MessageTypes> MarketDataMessageTypes { get; }
Property Value
TransactionalMessageTypes
Transactional message types.
public static IEnumerable<MessageTypes> TransactionalMessageTypes { get; }
Property Value
Methods
AddDelta(IOrderBookMessage, IOrderBookMessage)
To add change to the first order book.
public static QuoteChangeMessage AddDelta(this IOrderBookMessage from, IOrderBookMessage delta)
Parameters
fromIOrderBookMessageFirst order book.
deltaIOrderBookMessageChange.
Returns
- QuoteChangeMessage
The changed order book.
AddDelta(IEnumerable<QuoteChange>, IEnumerable<QuoteChange>, bool)
To add change to quote.
public static QuoteChange[] AddDelta(this IEnumerable<QuoteChange> fromQuotes, IEnumerable<QuoteChange> deltaQuotes, bool isBids)
Parameters
fromQuotesIEnumerable<QuoteChange>Quotes.
deltaQuotesIEnumerable<QuoteChange>Changes.
isBidsboolThe indication of quotes direction.
Returns
- QuoteChange[]
Changed quotes.
AddMarketDataSupport(MessageAdapter)
Fill the SupportedInMessages message types related to market-data.
public static void AddMarketDataSupport(this MessageAdapter adapter)
Parameters
adapterMessageAdapterAdapter.
AddNotSupportedResultMessage(MessageAdapter, MessageTypes)
Add the message type info NotSupportedResultMessages.
public static void AddNotSupportedResultMessage(this MessageAdapter adapter, MessageTypes type)
Parameters
adapterMessageAdapterAdapter.
typeMessageTypesMessage type.
AddOrSubtractTradingDays(BoardMessage, DateTimeOffset, int, bool)
To get date of day T +/- of N trading days.
public static DateTimeOffset AddOrSubtractTradingDays(this BoardMessage board, DateTimeOffset date, int n, bool checkHolidays = true)
Parameters
boardBoardMessageBoard info.
dateDateTimeOffsetThe start T date, to which are added or subtracted N trading days.
nintThe N size. The number of trading days for the addition or subtraction.
checkHolidaysboolWhether to check the passed date for a weekday (Saturday and Sunday are days off, returned value for them is false).
Returns
- DateTimeOffset
The end T +/- N date.
AddSupportedCandleTimeFrames(MessageAdapter, IEnumerable<TimeSpan>)
Add time-frames into GetSupportedMarketDataTypes(SecurityId, DateTimeOffset?, DateTimeOffset?).
public static void AddSupportedCandleTimeFrames(this MessageAdapter adapter, IEnumerable<TimeSpan> timeFrames)
Parameters
adapterMessageAdapterAdapter.
timeFramesIEnumerable<TimeSpan>Time-frames.
AddSupportedMarketDataType(MessageAdapter, DataType)
Add market data type into GetSupportedMarketDataTypes(SecurityId, DateTimeOffset?, DateTimeOffset?).
public static void AddSupportedMarketDataType(this MessageAdapter adapter, DataType dataType)
Parameters
adapterMessageAdapterAdapter.
dataTypeDataTypeData type info.
AddSupportedMessage(MessageAdapter, MessageTypeInfo)
Add the message type info PossibleSupportedMessages.
public static void AddSupportedMessage(this MessageAdapter adapter, MessageTypeInfo info)
Parameters
adapterMessageAdapterAdapter.
infoMessageTypeInfoExtended info for MessageTypes.
AddSupportedMessage(MessageAdapter, MessageTypes, bool?)
Add the message type info SupportedInMessages.
public static void AddSupportedMessage(this MessageAdapter adapter, MessageTypes type, bool? isMarketData)
Parameters
adapterMessageAdapterAdapter.
typeMessageTypesMessage type.
isMarketDatabool?typeis market-data type.
AddTransactionalSupport(MessageAdapter)
Fill the SupportedInMessages message types related to transactional.
public static void AddTransactionalSupport(this MessageAdapter adapter)
Parameters
adapterMessageAdapterAdapter.
Add<TMessage, TChange>(TMessage, TChange, CurrencyTypes)
Add change into collection.
public static TMessage Add<TMessage, TChange>(this TMessage message, TChange type, CurrencyTypes value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valueCurrencyTypesChange value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
Add<TMessage, TChange>(TMessage, TChange, PortfolioStates)
Add change into collection.
public static TMessage Add<TMessage, TChange>(this TMessage message, TChange type, PortfolioStates value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valuePortfolioStatesChange value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
Add<TMessage, TChange>(TMessage, TChange, SecurityStates)
Add change into collection.
public static TMessage Add<TMessage, TChange>(this TMessage message, TChange type, SecurityStates value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valueSecurityStatesChange value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
Add<TMessage, TChange>(TMessage, TChange, Sides)
Add change into collection.
public static TMessage Add<TMessage, TChange>(this TMessage message, TChange type, Sides value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valueSidesChange value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
Add<TMessage, TChange>(TMessage, TChange, bool)
Add change into collection.
public static TMessage Add<TMessage, TChange>(this TMessage message, TChange type, bool value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valueboolChange value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
Add<TMessage, TChange>(TMessage, TChange, DateTimeOffset)
Add change into collection.
public static TMessage Add<TMessage, TChange>(this TMessage message, TChange type, DateTimeOffset value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valueDateTimeOffsetChange value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
Add<TMessage, TChange>(TMessage, TChange, decimal)
Add change into collection.
public static TMessage Add<TMessage, TChange>(this TMessage message, TChange type, decimal value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valuedecimalChange value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
Add<TMessage, TChange>(TMessage, TChange, int)
Add change into collection.
public static TMessage Add<TMessage, TChange>(this TMessage message, TChange type, int value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valueintChange value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
Add<TMessage, TChange>(TMessage, TChange, long)
Add change into collection.
public static TMessage Add<TMessage, TChange>(this TMessage message, TChange type, long value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valuelongChange value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
Add<TMessage, TChange>(TMessage, TChange, object)
Add change into collection.
public static TMessage Add<TMessage, TChange>(this TMessage message, TChange type, object value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valueobjectChange value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
ApplyNewBalance(decimal?, decimal, long, ILogReceiver)
Check the possibility Balance change.
public static decimal ApplyNewBalance(this decimal? currBal, decimal newBal, long transactionId, ILogReceiver logs)
Parameters
currBaldecimal?Current balance.
newBaldecimalNew balance.
transactionIdlongTransaction id.
logsILogReceiverLogs.
Returns
- decimal
New balance.
BuildIfNeed(IEnumerable<QuoteChangeMessage>, ILogReceiver)
Try build books by OrderBookIncrementBuilder in case of books is incremental changes.
public static IEnumerable<QuoteChangeMessage> BuildIfNeed(this IEnumerable<QuoteChangeMessage> books, ILogReceiver logs = null)
Parameters
booksIEnumerable<QuoteChangeMessage>Order books.
logsILogReceiverLogs.
Returns
- IEnumerable<QuoteChangeMessage>
Order books.
ChangeSupported(IMessageAdapter, bool, bool)
Change SupportedInMessages.
public static void ChangeSupported(this IMessageAdapter adapter, bool add, bool isMarketData)
Parameters
adapterIMessageAdapterAdapter.
addboolCommand.
isMarketDataboolMessage types.
CreateAdapter(Type)
Create IMessageAdapter instance.
public static IMessageAdapter CreateAdapter(this Type adapterType)
Parameters
adapterTypeTypeAdapter type.
Returns
- IMessageAdapter
IMessageAdapter instance.
CreateAdapter(Type, IdGenerator)
Create IMessageAdapter.
public static IMessageAdapter CreateAdapter(this Type adapterType, IdGenerator idGenerator)
Parameters
adapterTypeTypeAdapter type.
idGeneratorIdGeneratorTransaction id generator.
Returns
- IMessageAdapter
IMessageAdapter instance.
CreateCandleMessage(Type)
Create instance of CandleMessage.
public static CandleMessage CreateCandleMessage(this Type messageType)
Parameters
messageTypeTypeThe type of candle message.
Returns
- CandleMessage
Instance of CandleMessage.
CreateErrorResponse(Message, Exception, ILogReceiver, Func<DataType, long[]>)
Create error response.
public static Message CreateErrorResponse(this Message message, Exception ex, ILogReceiver logs, Func<DataType, long[]> getSubscribers = null)
Parameters
messageMessageOriginal message.
exExceptionError.
logsILogReceiverLogs.
getSubscribersFunc<DataType, long[]>Subscriber identifiers provider.
Returns
- Message
Error response.
CreateNotSupported(long)
Create non supported subscription response.
public static SubscriptionResponseMessage CreateNotSupported(this long id)
Parameters
idlongID of the original message for which this message is a response.
Returns
- SubscriptionResponseMessage
Subscription response message.
CreateOrderCondition(IMessageAdapter)
Create condition for order type Conditional, that supports the adapter.
public static OrderCondition CreateOrderCondition(this IMessageAdapter adapter)
Parameters
adapterIMessageAdapterAdapter.
Returns
- OrderCondition
Order condition.
Remarks
If the connection does not support the order type Conditional, it will be returned null.
CreateOrderCondition(Type)
Create condition for order type Conditional, that supports the adapter.
public static OrderCondition CreateOrderCondition(this Type orderConditionType)
Parameters
orderConditionTypeTypeType of OrderCondition.
Returns
- OrderCondition
Order condition.
CreateOrderLogMarketDepthBuilder(Type, SecurityId)
Create IOrderLogMarketDepthBuilder instance.
public static IOrderLogMarketDepthBuilder CreateOrderLogMarketDepthBuilder(this Type builderType, SecurityId securityId)
Parameters
builderTypeTypeBuilder type.
securityIdSecurityIdSecurity ID.
Returns
CreateOrderReply(long, DateTimeOffset)
Create order's transaction reply.
public static ExecutionMessage CreateOrderReply(this long transactionId, DateTimeOffset serverTime)
Parameters
transactionIdlongTransaction ID.
serverTimeDateTimeOffsetServer time.
Returns
- ExecutionMessage
The message contains information about the execution.
CreatePortfolioChangeMessage(IMessageAdapter, string)
Initializes a new instance of the PositionChangeMessage.
public static PositionChangeMessage CreatePortfolioChangeMessage(this IMessageAdapter adapter, string pfName)
Parameters
adapterIMessageAdapterTrading system adapter.
pfNamestringPortfolio name.
Returns
- PositionChangeMessage
Portfolio change message.
CreatePositionChangeMessage(IMessageAdapter, string, SecurityId, string)
Initializes a new instance of the PositionChangeMessage.
public static PositionChangeMessage CreatePositionChangeMessage(this IMessageAdapter adapter, string pfName, SecurityId securityId, string depoName = null)
Parameters
adapterIMessageAdapterTrading system adapter.
pfNamestringPortfolio name.
securityIdSecurityIdSecurity ID.
depoNamestringThe depositary where the physical security.
Returns
- PositionChangeMessage
Position change message.
CreateReply(OrderMessage, Exception)
Cast OrderMessage to the ExecutionMessage.
public static ExecutionMessage CreateReply(this OrderMessage message, Exception error = null)
Parameters
messageOrderMessageerrorExceptionError info.
Returns
CreateResponse(ISubscriptionMessage, Exception)
Create subscription response.
public static SubscriptionResponseMessage CreateResponse(this ISubscriptionMessage message, Exception error = null)
Parameters
messageISubscriptionMessageSubscription.
errorExceptionError info.
Returns
- SubscriptionResponseMessage
Subscription response message.
CreateResult(ISubscriptionMessage)
Create SubscriptionOnlineMessage or SubscriptionFinishedMessage depends of To.
public static Message CreateResult(this ISubscriptionMessage message)
Parameters
messageISubscriptionMessageSubscription.
Returns
- Message
Message.
CreateSubscriptionResponse(long, Exception)
Create subscription response.
public static SubscriptionResponseMessage CreateSubscriptionResponse(this long id, Exception error = null)
Parameters
idlongID of the original message for which this message is a response.
errorExceptionError info.
Returns
- SubscriptionResponseMessage
Subscription response message.
DataTypeArgToString(DataType)
Convert candle parameter into folder name replacing the reserved symbols.
public static string DataTypeArgToString(this DataType dataType)
Parameters
dataTypeDataTypeData type info.
Returns
- string
Directory name.
DataTypeArgToString(Type, object)
Convert candle parameter into folder name replacing the reserved symbols.
public static string DataTypeArgToString(this Type messageType, object arg)
Parameters
Returns
- string
Directory name.
DataTypeToFileName(DataType)
Convert file name to DataType.
public static string DataTypeToFileName(this DataType dataType)
Parameters
dataTypeDataTypeData type info.
Returns
- string
File name.
DecodeToPeriods(string)
Decode from string to Periods.
public static IEnumerable<WorkingTimePeriod> DecodeToPeriods(this string input)
Parameters
inputstringEncoded string.
Returns
- IEnumerable<WorkingTimePeriod>
Schedule validity periods.
DecodeToSpecialDays(string)
Decode from string to SpecialDays.
public static IDictionary<DateTime, Range<TimeSpan>[]> DecodeToSpecialDays(this string input)
Parameters
inputstringEncoded string.
Returns
- IDictionary<DateTime, Range<TimeSpan>[]>
Special working days and holidays.
EncodeToString(IDictionary<DateTime, Range<TimeSpan>[]>)
Encode SpecialDays to string.
public static string EncodeToString(this IDictionary<DateTime, Range<TimeSpan>[]> specialDays)
Parameters
specialDaysIDictionary<DateTime, Range<TimeSpan>[]>Special working days and holidays.
Returns
- string
Encoded string.
EncodeToString(IEnumerable<WorkingTimePeriod>)
Encode Periods to string.
public static string EncodeToString(this IEnumerable<WorkingTimePeriod> periods)
Parameters
periodsIEnumerable<WorkingTimePeriod>Schedule validity periods.
Returns
- string
Encoded string.
EnsureGetGenerator(SecurityIdGenerator)
Returns the specified generator or the default in case of null.
public static SecurityIdGenerator EnsureGetGenerator(this SecurityIdGenerator generator)
Parameters
generatorSecurityIdGenerator
Returns
EnsureToday(DateTimeOffset?)
public static DateTimeOffset? EnsureToday(this DateTimeOffset? date)
Parameters
dateDateTimeOffset?The specified date.
Returns
- DateTimeOffset?
Result value.
EnsureToday(DateTimeOffset?, DateTimeOffset?)
Determines the specified date equals is Today and returns todayValue.
public static DateTimeOffset? EnsureToday(this DateTimeOffset? date, DateTimeOffset? todayValue)
Parameters
dateDateTimeOffset?The specified date.
todayValueDateTimeOffset?Today value.
Returns
- DateTimeOffset?
Result value.
FileNameToDataType(string)
Convert DataType to file name.
public static DataType FileNameToDataType(this string fileName)
Parameters
fileNamestringFile name.
Returns
- DataType
Data type info.
FillDefaultCryptoFields(SecurityId)
Fill default CryptoCurrency price and volume step by 0.00000001 value.
public static SecurityMessage FillDefaultCryptoFields(this SecurityId secId)
Parameters
secIdSecurityIdSecurity ID.
Returns
- SecurityMessage
A message containing info about the security.
FillDefaultCryptoFields(SecurityMessage)
Fill default CryptoCurrency price and volume step by 0.00000001 value.
public static SecurityMessage FillDefaultCryptoFields(this SecurityMessage message)
Parameters
messageSecurityMessageA message containing info about the security.
Returns
- SecurityMessage
A message containing info about the security.
Filter(IEnumerable<BoardMessage>, BoardLookupMessage)
Filter boards by code criteria.
public static IEnumerable<BoardMessage> Filter(this IEnumerable<BoardMessage> boards, BoardLookupMessage criteria)
Parameters
boardsIEnumerable<BoardMessage>All boards.
criteriaBoardLookupMessageCriteria.
Returns
- IEnumerable<BoardMessage>
Found boards.
Filter(IEnumerable<SecurityMessage>, SecurityLookupMessage)
To filter instruments by the given criteria.
public static IEnumerable<SecurityMessage> Filter(this IEnumerable<SecurityMessage> securities, SecurityLookupMessage criteria)
Parameters
securitiesIEnumerable<SecurityMessage>Securities.
criteriaSecurityLookupMessageMessage security lookup for specified criteria.
Returns
- IEnumerable<SecurityMessage>
Instruments filtered.
FilterTimeFrames(IEnumerable<DataType>)
Extract time frames from the specified data types set.
public static IEnumerable<TimeSpan> FilterTimeFrames(this IEnumerable<DataType> dataTypes)
Parameters
dataTypesIEnumerable<DataType>Data types.
Returns
- IEnumerable<TimeSpan>
Possible time-frames.
Filter<TMessage>(IEnumerable<TMessage>, DateTimeOffset, DateTimeOffset)
To filter messages for the given time period.
public static IEnumerable<TMessage> Filter<TMessage>(this IEnumerable<TMessage> messages, DateTimeOffset from, DateTimeOffset to) where TMessage : IServerTimeMessage
Parameters
messagesIEnumerable<TMessage>All messages, in which the required shall be searched for.
fromDateTimeOffsetThe start date for searching.
toDateTimeOffsetThe end date for searching.
Returns
- IEnumerable<TMessage>
Filtered messages.
Type Parameters
TMessage
FindAdapter<TAdapter>(IMessageAdapter)
Find adapter by the specified type.
public static TAdapter FindAdapter<TAdapter>(this IMessageAdapter adapter) where TAdapter : IMessageAdapter
Parameters
adapterIMessageAdapterAdapter.
Returns
- TAdapter
Found adapter or null.
Type Parameters
TAdapterThe adapter type.
FindAdapter<TAdapter>(IMessageAdapterWrapper)
Find adapter by the specified type.
public static TAdapter FindAdapter<TAdapter>(this IMessageAdapterWrapper wrapper) where TAdapter : IMessageAdapter
Parameters
wrapperIMessageAdapterWrapperWrapping based adapter.
Returns
- TAdapter
Found adapter or null.
Type Parameters
TAdapterThe adapter type.
FindById(IEnumerable<IMessageAdapter>, Guid)
Get adapter by the specified key.
public static IMessageAdapter FindById(this IEnumerable<IMessageAdapter> adapters, Guid id)
Parameters
adaptersIEnumerable<IMessageAdapter>All available adapters.
idGuidAdapter identifier.
Returns
- IMessageAdapter
Found adapter or null.
FormatToString(DataType)
public static (string type, string arg) FormatToString(this DataType dataType)
Parameters
dataTypeDataTypeData type info.
Returns
FromMicexCurrencyName(string, Action<Exception>)
To convert the currency name in the MICEX format into CurrencyTypes.
public static CurrencyTypes? FromMicexCurrencyName(this string name, Action<Exception> errorHandler = null)
Parameters
Returns
- CurrencyTypes?
Currency type. If the value is empty, null will be returned.
GetArg(MarketDataMessage)
Get typed argument.
public static object GetArg(this MarketDataMessage mdMsg)
Parameters
mdMsgMarketDataMessageMarket-data message (uses as a subscribe/unsubscribe in outgoing case, confirmation event in incoming case).
Returns
- object
The additional argument, associated with data. For example, candle argument.
GetArg<TArg>(MarketDataMessage)
Get typed argument.
public static TArg GetArg<TArg>(this MarketDataMessage mdMsg)
Parameters
mdMsgMarketDataMessageMarket-data message (uses as a subscribe/unsubscribe in outgoing case, confirmation event in incoming case).
Returns
- TArg
The additional argument, associated with data. For example, candle argument.
Type Parameters
TArgArg type.
GetBalance(ExecutionMessage)
Get Balance.
public static decimal GetBalance(this ExecutionMessage message)
Parameters
messageExecutionMessageThe message contains information about the execution.
Returns
- decimal
Order contracts balance.
GetBestAsk(IOrderBookMessage)
Get best ask.
public static QuoteChange? GetBestAsk(this IOrderBookMessage message)
Parameters
messageIOrderBookMessageMarket depth.
Returns
- QuoteChange?
Best ask, or null, if no asks are empty.
GetBestBid(IOrderBookMessage)
Get best bid.
public static QuoteChange? GetBestBid(this IOrderBookMessage message)
Parameters
messageIOrderBookMessageMarket depth.
Returns
- QuoteChange?
Best bid, or null, if no bids are empty.
GetBestPair(IOrderBookMessage)
Get best pair.
public static (QuoteChange? bid, QuoteChange? ask) GetBestPair(this IOrderBookMessage book)
Parameters
Returns
- (QuoteChange? bid, QuoteChange? ask)
Best pair.
GetCandleArgType(Type)
Get candle arg type.
public static Type GetCandleArgType(this Type candleMessageType)
Parameters
candleMessageTypeTypeCandle message type.
Returns
- Type
Candle arg type.
GetCandleBounds(TimeSpan, DateTimeOffset)
To get candle time frames relatively to the exchange working pattern.
public static Range<DateTimeOffset> GetCandleBounds(this TimeSpan timeFrame, DateTimeOffset currentTime)
Parameters
timeFrameTimeSpanThe time frame for which you need to get time range.
currentTimeDateTimeOffsetThe current time within the range of time frames.
Returns
- Range<DateTimeOffset>
The candle time frames.
GetCandleBounds(TimeSpan, DateTimeOffset, TimeZoneInfo, WorkingTime)
To get candle time frames relatively to the exchange working pattern.
public static Range<DateTimeOffset> GetCandleBounds(this TimeSpan timeFrame, DateTimeOffset currentTime, TimeZoneInfo timeZone, WorkingTime time)
Parameters
timeFrameTimeSpanThe time frame for which you need to get time range.
currentTimeDateTimeOffsetThe current time within the range of time frames.
timeZoneTimeZoneInfoInformation about the time zone where the exchange is located.
timeWorkingTimeThe information about the exchange working pattern.
Returns
- Range<DateTimeOffset>
The candle time frames.
GetDefaultMaxCount(DataType)
Get maximum possible items count per single subscription request.
public static int? GetDefaultMaxCount(this DataType dataType)
Parameters
dataTypeDataTypeData type info.
Returns
- int?
Max items count.
GetDelta(IOrderBookMessage, IOrderBookMessage)
To calculate the change between order books.
public static QuoteChangeMessage GetDelta(this IOrderBookMessage from, IOrderBookMessage to)
Parameters
fromIOrderBookMessageFirst order book.
toIOrderBookMessageSecond order book.
Returns
- QuoteChangeMessage
The order book, storing only increments.
GetHistoryStepSize(IMessageAdapter, SecurityId, DataType, out TimeSpan)
Get maximum size step allowed for historical download.
public static TimeSpan GetHistoryStepSize(this IMessageAdapter adapter, SecurityId securityId, DataType dataType, out TimeSpan iterationInterval)
Parameters
adapterIMessageAdapterTrading system adapter.
securityIdSecurityIddataTypeDataTypeData type info.
iterationIntervalTimeSpanInterval between iterations.
Returns
- TimeSpan
Step.
GetId<T>(CommandMessage)
Get typed ObjectId.
public static T GetId<T>(this CommandMessage message)
Parameters
messageCommandMessage
Returns
- T
Typed ObjectId.
Type Parameters
TType of ObjectId.
GetLastTradePrice(Level1ChangeMessage)
Get last tick trade price.
public static decimal? GetLastTradePrice(this Level1ChangeMessage message)
Parameters
messageLevel1ChangeMessageMarket depth.
Returns
GetMatchedVolume(IOrderMessage)
To calculate the implemented part of volume for order.
public static decimal? GetMatchedVolume(this IOrderMessage order)
Parameters
orderIOrderMessageThe order, for which the implemented part of volume shall be calculated.
Returns
- decimal?
The implemented part of volume.
GetOrderLogCancelReason(ExecutionMessage)
To get the reason for cancelling order in orders log.
public static OrderLogCancelReasons GetOrderLogCancelReason(this ExecutionMessage item)
Parameters
itemExecutionMessageOrder log item.
Returns
- OrderLogCancelReasons
The reason for order cancelling in order log.
GetPair(IOrderBookMessage, int)
To get a pair of quotes (bid + offer) by the depth index.
public static (QuoteChange? bid, QuoteChange? ask) GetPair(this IOrderBookMessage book, int depthIndex)
Parameters
bookIOrderBookMessagedepthIndexintDepth index. Zero index means the best pair of quotes.
Returns
- (QuoteChange? bid, QuoteChange? ask)
The pair of quotes. If the index is larger than book order depth, then the null is returned.
GetPeriod(WorkingTime, DateTime)
Get period for schedule.
public static WorkingTimePeriod GetPeriod(this WorkingTime time, DateTime date)
Parameters
timeWorkingTimeTrading schedule.
dateDateTimeThe date in time for search of appropriate period.
Returns
- WorkingTimePeriod
The schedule period. If no period is appropriate, null is returned.
GetPlazaTimeInForce(long)
Extract TimeInForce from bits flag.
public static TimeInForce? GetPlazaTimeInForce(this long status)
Parameters
statuslongBits flag.
Returns
GetPreferredLanguage(MessageAdapterCategories?)
Get preferred language.
public static string GetPreferredLanguage(this MessageAdapterCategories? categories)
Parameters
categoriesMessageAdapterCategories?Message adapter categories.
Returns
- string
Language
GetPrice(IOrderBookMessage, Sides?)
Get price by side.
public static decimal? GetPrice(this IOrderBookMessage message, Sides? side)
Parameters
messageIOrderBookMessagesideSides?
Returns
- decimal?
Price.
GetPriceStep(int)
To get the price increment on the basis of accuracy.
public static decimal GetPriceStep(this int decimals)
Parameters
decimalsintDecimals.
Returns
- decimal
Price step.
GetSecurityTypes(ISecurityTypesMessage)
Get SecurityTypes.
public static HashSet<SecurityTypes> GetSecurityTypes(this ISecurityTypesMessage message)
Parameters
messageISecurityTypesMessageMessage security lookup for specified criteria.
Returns
- HashSet<SecurityTypes>
Securities types.
GetServerTime(Message)
Get message server time.
public static DateTimeOffset GetServerTime(this Message message)
Parameters
messageMessageMessage.
Returns
- DateTimeOffset
Server time.
GetSpreadMiddle(IOrderBookMessage, decimal?)
Get middle of spread.
public static decimal? GetSpreadMiddle(this IOrderBookMessage message, decimal? priceStep)
Parameters
messageIOrderBookMessageMarket depth.
priceStepdecimal?
Returns
GetSpreadMiddle(Level1ChangeMessage, decimal?)
Get middle of spread.
public static decimal? GetSpreadMiddle(this Level1ChangeMessage message, decimal? priceStep)
Parameters
messageLevel1ChangeMessageMarket depth.
priceStepdecimal?
Returns
GetSpreadMiddle(decimal, decimal, decimal?)
Get middle of spread.
public static decimal GetSpreadMiddle(this decimal bestBidPrice, decimal bestAskPrice, decimal? priceStep)
Parameters
Returns
GetSpreadMiddle(decimal?, decimal?, decimal?)
Get middle of spread.
public static decimal? GetSpreadMiddle(this decimal? bestBidPrice, decimal? bestAskPrice, decimal? priceStep)
Parameters
Returns
GetSubscriptionIds(ISubscriptionIdMessage)
Get subscription identifiers from the specified message.
public static long[] GetSubscriptionIds(this ISubscriptionIdMessage message)
Parameters
messageISubscriptionIdMessageMessage.
Returns
- long[]
Identifiers.
GetTimeFrame(DataType)
Get time-frame.
public static TimeSpan GetTimeFrame(this DataType dataType)
Parameters
Returns
- TimeSpan
Time-frame.
GetTimeFrame(MarketDataMessage)
Get time-frame from the specified market-data message.
public static TimeSpan GetTimeFrame(this MarketDataMessage mdMsg)
Parameters
mdMsgMarketDataMessageMarket-data message (uses as a subscribe/unsubscribe in outgoing case, confirmation event in incoming case).
Returns
- TimeSpan
Time-frame.
GetTimeFrameCount(Range<DateTimeOffset>, TimeSpan, WorkingTime, TimeZoneInfo)
To get the number of time frames within the specified time range.
public static long GetTimeFrameCount(this Range<DateTimeOffset> range, TimeSpan timeFrame, WorkingTime workingTime = null, TimeZoneInfo timeZone = null)
Parameters
rangeRange<DateTimeOffset>The specified time range for which you need to get the number of time frames.
timeFrameTimeSpanThe time frame size.
workingTimeWorkingTimetimeZoneTimeZoneInfoInformation about the time zone where the exchange is located.
Returns
- long
The received number of time frames.
GetTimeFrames(IMessageAdapter, SecurityId, DateTimeOffset?, DateTimeOffset?)
Get possible time-frames for the specified instrument.
public static IEnumerable<TimeSpan> GetTimeFrames(this IMessageAdapter adapter, SecurityId securityId = default, DateTimeOffset? from = null, DateTimeOffset? to = null)
Parameters
adapterIMessageAdapterTrading system adapter.
securityIdSecurityIdSecurity ID.
fromDateTimeOffset?The initial date from which you need to get data.
toDateTimeOffset?The final date by which you need to get data.
Returns
- IEnumerable<TimeSpan>
Possible time-frames.
GetTopPairs(IOrderBookMessage, int)
To get a pair of quotes for a given book depth.
public static IEnumerable<(QuoteChange? bid, QuoteChange? ask)> GetTopPairs(this IOrderBookMessage book, int depth)
Parameters
bookIOrderBookMessagedepthintBook depth. The counting is from the best quotes.
Returns
- IEnumerable<(QuoteChange? bid, QuoteChange? ask)>
Spread.
GetTopQuotes(IOrderBookMessage, int)
To get quotes for a given book depth.
public static IEnumerable<QuoteChange> GetTopQuotes(this IOrderBookMessage book, int depth)
Parameters
bookIOrderBookMessagedepthintBook depth. Quotes are in order of price increasing from bids to offers.
Returns
- IEnumerable<QuoteChange>
Spread.
GetTradePrice(ExecutionMessage)
Get TradePrice.
public static decimal GetTradePrice(this ExecutionMessage message)
Parameters
messageExecutionMessageThe message contains information about the execution.
Returns
- decimal
Trade price.
GetUnderlyingCode(SecurityMessage)
Get underlying asset.
public static string GetUnderlyingCode(this SecurityMessage secMsg)
Parameters
secMsgSecurityMessage
Returns
- string
Underlying asset.
Group(IOrderBookMessage, Unit)
To group the order book by the price range.
[Obsolete("Use method with decimal priceRange parameter")]
public static QuoteChangeMessage Group(this IOrderBookMessage depth, Unit priceRange)
Parameters
depthIOrderBookMessageThe order book to be grouped.
priceRangeUnitThe price range, for which grouping shall be performed.
Returns
- QuoteChangeMessage
The grouped order book.
Group(IOrderBookMessage, decimal)
To group the order book by the price range.
public static QuoteChangeMessage Group(this IOrderBookMessage depth, decimal priceRange)
Parameters
depthIOrderBookMessageThe order book to be grouped.
priceRangedecimalThe price range, for which grouping shall be performed.
Returns
- QuoteChangeMessage
The grouped order book.
Group(QuoteChange[], Sides, Unit)
[Obsolete("Use method with decimal priceRange")]
public static QuoteChange[] Group(this QuoteChange[] quotes, Sides side, Unit priceRange)
Parameters
quotesQuoteChange[]sideSidespriceRangeUnit
Returns
Group(QuoteChange[], Sides, decimal)
To group quotes by the price range.
public static QuoteChange[] Group(this QuoteChange[] quotes, Sides side, decimal priceRange)
Parameters
quotesQuoteChange[]Quotes to be grouped.
sideSidesSide.
priceRangedecimalThe price range, for which grouping shall be performed.
Returns
- QuoteChange[]
Grouped quotes.
HasChanges<TMessage, TChange>(BaseChangeMessage<TMessage, TChange>)
Determines the message contains any changes.
public static bool HasChanges<TMessage, TChange>(this BaseChangeMessage<TMessage, TChange> message) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageBaseChangeMessage<TMessage, TChange>Change message.
Returns
- bool
Check result.
Type Parameters
TMessageChange message type.
TChangeChange type.
HasOrderId(OrderStatusMessage)
Determines the specified message contains single order request.
public static bool HasOrderId(this OrderStatusMessage message)
Parameters
messageOrderStatusMessageMessage.
Returns
- bool
Check result.
HasOrderInfo(ExecutionMessage)
Determines whether the specified message contains order information.
public static bool HasOrderInfo(this ExecutionMessage message)
Parameters
messageExecutionMessageThe message.
Returns
HasTradeInfo(ExecutionMessage)
Determines whether the specified message contains trade information.
public static bool HasTradeInfo(this ExecutionMessage message)
Parameters
messageExecutionMessageThe message.
Returns
Invert(Sides)
To change the direction to opposite.
public static Sides Invert(this Sides side)
Parameters
sideSidesThe initial direction.
Returns
- Sides
The opposite direction.
IsAllSecurity(ISecurityIdMessage)
Check if the specified ISecurityIdMessage is IsAllSecurity(SecurityId).
public static bool IsAllSecurity(this ISecurityIdMessage message)
Parameters
messageISecurityIdMessage
Returns
- bool
true, if the specified ISecurityIdMessage is IsAllSecurity(SecurityId), otherwise, false.
IsAllSecurity(SecurityId)
Check if the specified SecurityId is IsAllSecurity(SecurityId).
public static bool IsAllSecurity(this SecurityId securityId)
Parameters
securityIdSecurityId
Returns
- bool
true, if the specified SecurityId is IsAllSecurity(SecurityId), otherwise, false.
IsAssociated(SecurityId, string)
Is specified security id associated with the board.
public static bool IsAssociated(this SecurityId securityId, string boardCode)
Parameters
securityIdSecurityIdSecurity ID.
boardCodestringBoard code.
Returns
IsBack(IMessage)
Determines the specified message is loopback.
public static bool IsBack(this IMessage message)
Parameters
messageIMessageMessage.
Returns
- bool
Is loopback message.
IsBasket(SecurityMessage)
Is specified security is basket.
public static bool IsBasket(this SecurityMessage security)
Parameters
securitySecurityMessageSecurity.
Returns
- bool
Check result.
IsBestAskField(Level1Fields)
Is the specified Level1Fields is related to best ask.
public static bool IsBestAskField(this Level1Fields field)
Parameters
fieldLevel1FieldsField.
Returns
- bool
Check result.
IsBestBidField(Level1Fields)
Is the specified Level1Fields is related to best bid.
public static bool IsBestBidField(this Level1Fields field)
Parameters
fieldLevel1FieldsField.
Returns
- bool
Check result.
IsBuildOnly(Type)
Determines whether the specified candle type can build only from underlying data.
public static bool IsBuildOnly(this Type candleType)
Parameters
candleTypeTypeThe type of candle message.
Returns
- bool
Check result.
IsCanceled(IOrderMessage)
To check, whether the order was cancelled.
public static bool IsCanceled(this IOrderMessage order)
Parameters
orderIOrderMessageThe order to be checked.
Returns
IsCandle(MessageTypes)
Determine the type is candle data type.
public static bool IsCandle(this MessageTypes type)
Parameters
typeMessageTypesMessage type.
Returns
IsCandleMessage(Type)
Determines whether the specified message type is derived from CandleMessage.
public static bool IsCandleMessage(this Type messageType)
Parameters
messageTypeTypeThe message type.
Returns
- bool
true if the specified message type is derived from CandleMessage, otherwise, false.
IsCandlesSupported(IMessageAdapter, MarketDataMessage)
Determines whether the specified subscription request is supported by the adapter.
public static bool IsCandlesSupported(this IMessageAdapter adapter, MarketDataMessage subscription)
Parameters
adapterIMessageAdapterAdapter.
subscriptionMarketDataMessageSubscription.
Returns
IsContainsCandle(Level1ChangeMessage)
To check, are there IsCandles in the level1 data.
public static bool IsContainsCandle(this Level1ChangeMessage level1)
Parameters
level1Level1ChangeMessageLevel1 data.
Returns
- bool
The test result.
IsContainsQuotes(Level1ChangeMessage)
To check, are there quotes in the level1.
public static bool IsContainsQuotes(this Level1ChangeMessage level1)
Parameters
level1Level1ChangeMessageLevel1 data.
Returns
- bool
Quotes.
IsContainsTick(Level1ChangeMessage)
To check, are there tick data in the level1 data.
public static bool IsContainsTick(this Level1ChangeMessage level1)
Parameters
level1Level1ChangeMessageLevel1 data.
Returns
- bool
The test result.
IsFinal(IOrderBookMessage)
Determine whether the order book is final.
public static bool IsFinal(this IOrderBookMessage depth)
Parameters
depthIOrderBookMessageOrder book message.
Returns
IsFinal(OrderStates)
public static bool IsFinal(this OrderStates state)
Parameters
stateOrderStatesOrder state.
Returns
- bool
Check result.
IsFullEmpty(IOrderBookMessage)
To determine, is the order book empty.
public static bool IsFullEmpty(this IOrderBookMessage depth)
Parameters
depthIOrderBookMessageMarket depth.
Returns
IsHalfEmpty(IOrderBookMessage)
To determine, is the order book half-empty.
public static bool IsHalfEmpty(this IOrderBookMessage depth)
Parameters
depthIOrderBookMessageMarket depth.
Returns
IsHistoryOnly(ISubscriptionMessage)
Determines the specified message contains historical request only.
public static bool IsHistoryOnly(this ISubscriptionMessage message)
Parameters
messageISubscriptionMessageSubscription.
Returns
- bool
Check result.
IsIndex(SecurityMessage)
Is specified security is index.
public static bool IsIndex(this SecurityMessage security)
Parameters
securitySecurityMessageSecurity.
Returns
- bool
Check result.
IsIntraday(TimeSpan)
Determines the specified time-frame is intraday.
public static bool IsIntraday(this TimeSpan tf)
Parameters
tfTimeSpanTime-frame.
Returns
- bool
Check result.
IsLastTradeField(Level1Fields)
Is the specified Level1Fields is related to last trade.
public static bool IsLastTradeField(this Level1Fields field)
Parameters
fieldLevel1FieldsField.
Returns
- bool
Check result.
IsLookup(IMessage)
Determines the specified message is lookup.
public static bool IsLookup(this IMessage message)
Parameters
Returns
- bool
Check result.
IsLookup(MessageTypes)
Determines the specified message type is lookup.
public static bool IsLookup(this MessageTypes type)
Parameters
typeMessageTypes
Returns
- bool
Check result.
IsLookupAll(SecurityLookupMessage)
Determine the criteria contains lookup all filter.
public static bool IsLookupAll(this SecurityLookupMessage criteria)
Parameters
criteriaSecurityLookupMessageThe instrument whose fields will be used as a filter.
Returns
- bool
Check result.
IsMarketData(ExecutionMessage)
Determines whether the execMsg contains market-data info.
public static bool IsMarketData(this ExecutionMessage execMsg)
Parameters
execMsgExecutionMessageThe message contains information about the execution.
Returns
- bool
Check result.
IsMarketData(IMessageAdapter)
Is the specified adapter support market-data.
public static bool IsMarketData(this IMessageAdapter adapter)
Parameters
adapterIMessageAdapterAdapter.
Returns
- bool
Check result.
IsMarketDataTypeSupported(IMessageAdapter, DataType)
Determines whether the specified market-data type is supported by the adapter.
public static bool IsMarketDataTypeSupported(this IMessageAdapter adapter, DataType type)
Parameters
adapterIMessageAdapterAdapter.
typeDataTypeMessage type.
Returns
IsMatch(BoardMessage, BoardLookupMessage)
Determines the specified message is matched lookup criteria.
public static bool IsMatch(this BoardMessage board, BoardLookupMessage criteria)
Parameters
boardBoardMessageBoard.
criteriaBoardLookupMessageThe message which fields will be used as a filter.
Returns
- bool
Check result.
IsMatch(ExecutionMessage, OrderStatusMessage)
Determines the specified message is matched lookup criteria.
public static bool IsMatch(this ExecutionMessage transaction, OrderStatusMessage criteria)
Parameters
transactionExecutionMessageTransaction.
criteriaOrderStatusMessageThe message which fields will be used as a filter.
Returns
- bool
Check result.
IsMatch(ExecutionMessage, OrderStatusMessage, ISet<OrderStates>)
Determines the specified transaction is matched lookup criteria.
public static bool IsMatch(this ExecutionMessage transaction, OrderStatusMessage criteria, ISet<OrderStates> states)
Parameters
transactionExecutionMessageTransaction.
criteriaOrderStatusMessageThe order which fields will be used as a filter.
statesISet<OrderStates>Filter order by the specified states.
Returns
- bool
Check result.
IsMatch(ISubscriptionIdMessage, MessageTypes, ISubscriptionMessage)
Determines the specified message is matched lookup criteria.
public static bool IsMatch(this ISubscriptionIdMessage message, MessageTypes type, ISubscriptionMessage criteria)
Parameters
messageISubscriptionIdMessageMessage.
typeMessageTypescriteriaISubscriptionMessageThe message which fields will be used as a filter.
Returns
- bool
Check result.
IsMatch(PortfolioMessage, PortfolioLookupMessage, bool)
Determines the specified message is matched lookup criteria.
public static bool IsMatch(this PortfolioMessage portfolio, PortfolioLookupMessage criteria, bool compareName)
Parameters
portfolioPortfolioMessagePortfolio.
criteriaPortfolioLookupMessageThe message which fields will be used as a filter.
compareNameboolFully compare PortfolioName.
Returns
- bool
Check result.
IsMatch(PositionChangeMessage, PortfolioLookupMessage, bool)
Determines the specified message is matched lookup criteria.
public static bool IsMatch(this PositionChangeMessage position, PortfolioLookupMessage criteria, bool compareName)
Parameters
positionPositionChangeMessagePosition.
criteriaPortfolioLookupMessageThe message which fields will be used as a filter.
compareNameboolFully compare PortfolioName.
Returns
- bool
Check result.
IsMatch(SecurityMessage, SecurityLookupMessage)
Determines the specified security is matched lookup criteria.
public static bool IsMatch(this SecurityMessage security, SecurityLookupMessage criteria)
Parameters
securitySecurityMessageSecurity.
criteriaSecurityLookupMessageMessage security lookup for specified criteria.
Returns
- bool
Check result.
IsMatch(SecurityMessage, SecurityLookupMessage, HashSet<SecurityTypes>)
Determines the specified security is matched lookup criteria.
public static bool IsMatch(this SecurityMessage security, SecurityLookupMessage criteria, HashSet<SecurityTypes> secTypes)
Parameters
securitySecurityMessageSecurity.
criteriaSecurityLookupMessageMessage security lookup for specified criteria.
secTypesHashSet<SecurityTypes>Securities types.
Returns
- bool
Check result.
IsMatched(IOrderMessage)
To check, is the order matched completely.
public static bool IsMatched(this IOrderMessage order)
Parameters
orderIOrderMessageThe order to be checked.
Returns
IsMatchedEmpty(IOrderMessage)
To check, if no contract in order is implemented.
public static bool IsMatchedEmpty(this IOrderMessage order)
Parameters
orderIOrderMessageThe order to be checked.
Returns
IsMatchedPartially(IOrderMessage)
To check, is a part of volume is implemented in the order.
public static bool IsMatchedPartially(this IOrderMessage order)
Parameters
orderIOrderMessageThe order to be checked.
Returns
IsMessageSupported(IMessageAdapter, MessageTypes)
Determines whether the specified message type is contained in SupportedInMessages.
public static bool IsMessageSupported(this IMessageAdapter adapter, MessageTypes type)
Parameters
adapterIMessageAdapterAdapter.
typeMessageTypesMessage type.
Returns
IsMoney(PositionChangeMessage)
Determines the specified message contains Money position.
public static bool IsMoney(this PositionChangeMessage posMsg)
Parameters
posMsgPositionChangeMessageThe message contains information about the position changes.
Returns
- bool
Check result.
IsMoney(SecurityId)
Check if the specified id is money id.
public static bool IsMoney(this SecurityId secId)
Parameters
secIdSecurityIdThe message contains information about the position changes.
Returns
- bool
Check result.
IsNotSupported(SubscriptionResponseMessage)
Determines whether the reply contains the error NotSupported.
public static bool IsNotSupported(this SubscriptionResponseMessage message)
Parameters
messageSubscriptionResponseMessageReply.
Returns
- bool
Check result.
IsObsolete(Level1Fields)
Is the specified Level1Fields was obsolete.
public static bool IsObsolete(this Level1Fields field)
Parameters
fieldLevel1FieldsLevel1Fields value.
Returns
IsObsolete(PositionChangeTypes)
Is the specified PositionChangeTypes was marked by ObsoleteAttribute.
public static bool IsObsolete(this PositionChangeTypes type)
Parameters
typePositionChangeTypesPositionChangeTypes value.
Returns
IsOk(IErrorMessage)
Determines whether the reply contains an error Error.
public static bool IsOk(this IErrorMessage message)
Parameters
messageIErrorMessage
Returns
- bool
Check result.
IsOpened(IMessageChannel)
Is channel opened.
public static bool IsOpened(this IMessageChannel channel)
Parameters
channelIMessageChannelMessage channel.
Returns
- bool
Check result.
IsOrderLogCanceled(ExecutionMessage)
To check, does the string contain the cancelled order.
public static bool IsOrderLogCanceled(this ExecutionMessage item)
Parameters
itemExecutionMessageOrder log item.
Returns
IsOrderLogMatched(ExecutionMessage)
To check, does the string contain the order matching.
public static bool IsOrderLogMatched(this ExecutionMessage item)
Parameters
itemExecutionMessageOrder log item.
Returns
IsOrderLogRegistered(ExecutionMessage)
To check, does the string contain the order registration.
public static bool IsOrderLogRegistered(this ExecutionMessage item)
Parameters
itemExecutionMessageOrder log item.
Returns
IsPlazaSystem(long)
Extract system attribute from the bits flag.
public static bool IsPlazaSystem(this long status)
Parameters
statuslongBits flag.
Returns
IsResultMessageNotSupported(IMessageAdapter, MessageTypes)
Determines whether the specified message type is contained in NotSupportedResultMessages..
public static bool IsResultMessageNotSupported(this IMessageAdapter adapter, MessageTypes type)
Parameters
adapterIMessageAdapterAdapter.
typeMessageTypesMessage type.
Returns
IsSet(Unit)
Determines the value is set.
public static bool IsSet(this Unit value)
Parameters
Returns
- bool
Check result.
IsStorageSupported(DataType)
Determines whether the specified data type is supported by the storage.
public static bool IsStorageSupported(this DataType dataType)
Parameters
Returns
- bool
Check result.
IsSupportSecuritiesLookupAll(IMessageAdapter)
Support lookup all securities.
public static bool IsSupportSecuritiesLookupAll(this IMessageAdapter adapter)
Parameters
adapterIMessageAdapterAdapter.
Returns
- bool
Check result.
IsSupportStopLoss(IMessageAdapter)
Determines whether the adapter support stop-loss orders.
public static bool IsSupportStopLoss(this IMessageAdapter adapter)
Parameters
adapterIMessageAdapterAdapter.
Returns
- bool
Check result.
IsSupportTakeProfit(IMessageAdapter)
Determines whether the adapter support take-profit orders.
public static bool IsSupportTakeProfit(this IMessageAdapter adapter)
Parameters
adapterIMessageAdapterAdapter.
Returns
- bool
Check result.
IsSupportWithdraw(IMessageAdapter)
Determines whether the adapter support withdraw orders.
public static bool IsSupportWithdraw(this IMessageAdapter adapter)
Parameters
adapterIMessageAdapterAdapter.
Returns
- bool
Check result.
IsToday(DateTimeOffset)
To check the specified date is today.
public static bool IsToday(this DateTimeOffset date)
Parameters
dateDateTimeOffsetThe specified date.
Returns
IsToday(DateTimeOffset?)
To check the specified date is today.
public static bool IsToday(this DateTimeOffset? date)
Parameters
dateDateTimeOffset?The specified date.
Returns
IsTradeDate(BoardMessage, DateTimeOffset, bool)
To check, whether date is traded.
public static bool IsTradeDate(this BoardMessage board, DateTimeOffset date, bool checkHolidays = false)
Parameters
boardBoardMessageBoard info.
dateDateTimeOffsetThe passed date to be checked.
checkHolidaysboolWhether to check the passed date for a weekday (Saturday and Sunday are days off, returned value for them is false).
Returns
IsTradeDate(WorkingTime, DateTime, bool)
To check, whether date is traded.
public static bool IsTradeDate(this WorkingTime workingTime, DateTime date, bool checkHolidays = false)
Parameters
workingTimeWorkingTimeBoard working hours.
dateDateTimeThe passed date to be checked.
checkHolidaysboolWhether to check the passed date for a weekday (Saturday and Sunday are days off, returned value for them is false).
Returns
IsTradeTime(BoardMessage, DateTimeOffset)
To check, whether the time is traded (has the session started, ended, is there a clearing).
public static bool IsTradeTime(this BoardMessage board, DateTimeOffset time)
Parameters
boardBoardMessageBoard info.
timeDateTimeOffsetThe passed time to be checked.
Returns
IsTradeTime(BoardMessage, DateTimeOffset, out bool?, out WorkingTimePeriod)
To check, whether the time is traded (has the session started, ended, is there a clearing).
public static bool IsTradeTime(this BoardMessage board, DateTimeOffset time, out bool? isWorkingDay, out WorkingTimePeriod period)
Parameters
boardBoardMessageBoard info.
timeDateTimeOffsetThe passed time to be checked.
isWorkingDaybool?true, if the date is traded, otherwise, is not traded.
periodWorkingTimePeriodCurrent working time period.
Returns
IsTradeTime(WorkingTime, DateTime, out bool?, out WorkingTimePeriod)
To check, whether the time is traded (has the session started, ended, is there a clearing).
public static bool IsTradeTime(this WorkingTime workingTime, DateTime time, out bool? isWorkingDay, out WorkingTimePeriod period)
Parameters
workingTimeWorkingTimeBoard working hours.
timeDateTimeThe passed time to be checked.
isWorkingDaybool?true, if the date is traded, otherwise, is not traded.
periodWorkingTimePeriodCurrent working time period.
Returns
IsTransactional(IMessageAdapter)
Is the specified adapter support transactions.
public static bool IsTransactional(this IMessageAdapter adapter)
Parameters
adapterIMessageAdapterAdapter.
Returns
- bool
Check result.
Iso10962(SecurityMessage)
To get the type for the instrument in the ISO 10962 standard.
public static string Iso10962(this SecurityMessage security)
Parameters
securitySecurityMessageSecurity.
Returns
- string
Type in ISO 10962 standard.
Iso10962ToOptionType(string)
To convert the type in the ISO 10962 standard into OptionTypes.
public static OptionTypes? Iso10962ToOptionType(this string cfi)
Parameters
cfistringType in ISO 10962 standard.
Returns
- OptionTypes?
Option type.
Iso10962ToSecurityType(string)
To convert the type in the ISO 10962 standard into SecurityTypes.
public static SecurityTypes? Iso10962ToSecurityType(this string cfi)
Parameters
cfistringType in ISO 10962 standard.
Returns
- SecurityTypes?
Security type.
Join(IOrderBookMessage, IOrderBookMessage)
To merge the initial order book and its sparse representation.
public static QuoteChangeMessage Join(this IOrderBookMessage original, IOrderBookMessage rare)
Parameters
originalIOrderBookMessageThe initial order book.
rareIOrderBookMessageThe sparse order book.
Returns
- QuoteChangeMessage
The merged order book.
LastTradeDay(BoardMessage, DateTimeOffset, bool)
Get last trade date.
public static DateTimeOffset LastTradeDay(this BoardMessage board, DateTimeOffset date, bool checkHolidays = true)
Parameters
boardBoardMessageBoard info.
dateDateTimeOffsetThe date from which to start checking.
checkHolidaysboolWhether to check the passed date for a weekday (Saturday and Sunday are days off, returned value for them is false).
Returns
- DateTimeOffset
Last trade date.
LookupByCode(ISecurityMessageProvider, string, SecurityTypes?)
To get the instrument by the instrument code.
public static IEnumerable<SecurityMessage> LookupByCode(this ISecurityMessageProvider provider, string code, SecurityTypes? type = null)
Parameters
providerISecurityMessageProviderThe provider of information about instruments.
codestringSecurity code.
typeSecurityTypes?Security type.
Returns
- IEnumerable<SecurityMessage>
The got instrument. If there is no instrument by given criteria, null is returned.
LoopBack<TMessage>(TMessage, IMessageAdapter, MessageBackModes)
Made the specified message as BackMode.
public static TMessage LoopBack<TMessage>(this TMessage message, IMessageAdapter adapter, MessageBackModes mode = MessageBackModes.Direct) where TMessage : IMessage
Parameters
messageTMessageMessage.
adapterIMessageAdapterAdapter.
modeMessageBackModesBack mode.
Returns
- TMessage
Message.
Type Parameters
TMessageMessage type.
MakeVectorIconUri(string)
get icon uri
public static Uri MakeVectorIconUri(this string key)
Parameters
keystring
Returns
NearestSupportedDepth(IMessageAdapter, int)
Get the nearest supported depth for the specified.
public static int? NearestSupportedDepth(this IMessageAdapter adapter, int depth)
Parameters
adapterIMessageAdapterAdapter.
depthintDepth.
Returns
- int?
Supported depth.
PnF(PnFArg)
Create data type info for PnFCandleMessage.
public static DataType PnF(this PnFArg arg)
Parameters
argPnFArgCandle arg.
Returns
- DataType
Data type info.
Portfolio(string)
Create data type info for PortfolioMessage.
public static DataType Portfolio(this string portfolioName)
Parameters
portfolioNamestringPortfolio name.
Returns
- DataType
Data type info.
Range(Unit)
Create data type info for RangeCandleMessage.
public static DataType Range(this Unit arg)
Parameters
argUnitCandle arg.
Returns
- DataType
Data type info.
RegisterCandleType<TArg>(Type, MessageTypes, string, Func<string, TArg>, Func<TArg, string>, Func<TArg, bool>, bool)
Register new candle type.
public static void RegisterCandleType<TArg>(Type messageType, MessageTypes type, string fileName, Func<string, TArg> argParse, Func<TArg, string> argToString, Func<TArg, bool> argValidator, bool isBuildOnly = true)
Parameters
messageTypeTypeThe type of candle message.
typeMessageTypesMessage type.
fileNamestringFile name.
argParseFunc<string, TArg>string to
TArgconverter.argToStringFunc<TArg, string>TArgto string converter.argValidatorFunc<TArg, bool>Arg validator.
isBuildOnlyboolThe candle type can build only from underlying data.
Type Parameters
TArg
RemoveMarketDataSupport(MessageAdapter)
Remove from SupportedInMessages message types related to market-data.
public static void RemoveMarketDataSupport(this MessageAdapter adapter)
Parameters
adapterMessageAdapterAdapter.
RemoveNotSupportedResultMessage(MessageAdapter, MessageTypes)
Remove the message type from NotSupportedResultMessages.
public static void RemoveNotSupportedResultMessage(this MessageAdapter adapter, MessageTypes type)
Parameters
adapterMessageAdapterAdapter.
typeMessageTypesMessage type.
RemoveSupportedAllMarketDataTypes(MessageAdapter)
Remove all market data types from GetSupportedMarketDataTypes(SecurityId, DateTimeOffset?, DateTimeOffset?).
public static void RemoveSupportedAllMarketDataTypes(this MessageAdapter adapter)
Parameters
adapterMessageAdapterAdapter.
RemoveSupportedMarketDataType(MessageAdapter, DataType)
Remove market data type from GetSupportedMarketDataTypes(SecurityId, DateTimeOffset?, DateTimeOffset?).
public static void RemoveSupportedMarketDataType(this MessageAdapter adapter, DataType type)
Parameters
adapterMessageAdapterAdapter.
typeDataTypeMarket data type.
RemoveSupportedMessage(MessageAdapter, MessageTypes)
Remove the message type from PossibleSupportedMessages.
public static void RemoveSupportedMessage(this MessageAdapter adapter, MessageTypes type)
Parameters
adapterMessageAdapterAdapter.
typeMessageTypesMessage type.
RemoveTransactionalSupport(MessageAdapter)
Remove from SupportedInMessages message types related to transactional.
public static void RemoveTransactionalSupport(this MessageAdapter adapter)
Parameters
adapterMessageAdapterAdapter.
Renko(Unit)
Create data type info for RenkoCandleMessage.
public static DataType Renko(this Unit arg)
Parameters
argUnitCandle arg.
Returns
- DataType
Data type info.
ReplaceSecurityId(Message, SecurityId)
Replace security id by the specified.
public static Message ReplaceSecurityId(this Message message, SecurityId securityId)
Parameters
messageMessageMessage.
securityIdSecurityIdSecurity ID.
Returns
- Message
Message.
SafeGetOrderId(ExecutionMessage)
To get order identifier, or discard exception, if no information available.
public static long SafeGetOrderId(this ExecutionMessage message)
Parameters
messageExecutionMessageOperations.
Returns
- long
Order ID.
SafeGetVolume(ExecutionMessage)
To get the number of operations, or discard the exception, if no information available.
public static decimal SafeGetVolume(this ExecutionMessage message)
Parameters
messageExecutionMessageOperations.
Returns
- decimal
Quantity.
SetId<T>(CommandMessage, T)
Set typed ObjectId.
public static void SetId<T>(this CommandMessage message, T id)
Parameters
messageCommandMessageidTTyped ObjectId.
Type Parameters
TType of ObjectId.
SetNativeId(SecurityId, object)
Initialize Native.
public static SecurityId SetNativeId(this SecurityId secId, object nativeId)
Parameters
secIdSecurityIdSecurity ID.
nativeIdobjectNative (internal) trading system security id.
Returns
- SecurityId
Security ID.
SetSecurityCode(SecurityMessage, string)
Initialize SecurityCode.
public static void SetSecurityCode(this SecurityMessage message, string secCode)
Parameters
messageSecurityMessageA message containing info about the security.
secCodestringSecurity code.
SetSecurityTypes(ISecurityTypesMessage, SecurityTypes?, IEnumerable<SecurityTypes>)
Initialize SecurityTypes.
public static void SetSecurityTypes(this ISecurityTypesMessage message, SecurityTypes? type, IEnumerable<SecurityTypes> types = null)
Parameters
messageISecurityTypesMessageMessage security lookup for specified criteria.
typeSecurityTypes?Security type.
typesIEnumerable<SecurityTypes>Securities types.
SetSubscriptionIds<TMessage>(TMessage, long[], long)
Set subscription identifiers into the specified message.
public static TMessage SetSubscriptionIds<TMessage>(this TMessage message, long[] subscriptionIds = null, long subscriptionId = 0) where TMessage : ISubscriptionIdMessage
Parameters
Returns
- TMessage
Message.
Type Parameters
TMessageMessage type.
ShrinkPrice(decimal, SecurityMessage, ShrinkRules)
To cut the price, to make it multiple of minimal step, also to limit number of signs after the comma.
public static decimal ShrinkPrice(this decimal price, SecurityMessage secMsg, ShrinkRules rule = ShrinkRules.Auto)
Parameters
pricedecimalThe price to be made multiple.
secMsgSecurityMessageruleShrinkRules
Returns
- decimal
The multiple price.
ShrinkPrice(decimal, decimal?, int?, ShrinkRules)
To cut the price, to make it multiple of minimal step, also to limit number of signs after the comma.
public static decimal ShrinkPrice(this decimal price, decimal? priceStep, int? decimals, ShrinkRules rule = ShrinkRules.Auto)
Parameters
pricedecimalThe price to be made multiple.
priceStepdecimal?Price step.
decimalsint?Number of digits in price after coma.
ruleShrinkRules
Returns
- decimal
The multiple price.
Sparse(IOrderBookMessage, Unit, decimal?)
[Obsolete("Use method with decimal priceRange parameter")]
public static QuoteChangeMessage Sparse(this IOrderBookMessage depth, Unit priceRange, decimal? priceStep)
Parameters
depthIOrderBookMessagepriceRangeUnitpriceStepdecimal?
Returns
Sparse(IOrderBookMessage, decimal, decimal?, int)
To create from regular order book a sparse one.
public static QuoteChangeMessage Sparse(this IOrderBookMessage depth, decimal priceRange, decimal? priceStep, int maxDepth = 20)
Parameters
depthIOrderBookMessageThe regular order book.
priceRangedecimalMinimum price step.
priceStepdecimal?Security price step.
maxDepthintMax depth.
Returns
- QuoteChangeMessage
The sparse order book.
Remarks
In sparsed book shown quotes with no active orders. The volume of these quotes is 0.
Sparse(QuoteChange, QuoteChange, Unit, decimal?)
[Obsolete("Use method with decimal priceRange parameter")]
public static (QuoteChange[] bids, QuoteChange[] asks) Sparse(this QuoteChange bid, QuoteChange ask, Unit priceRange, decimal? priceStep)
Parameters
bidQuoteChangeaskQuoteChangepriceRangeUnitpriceStepdecimal?
Returns
- (QuoteChange[] bids, QuoteChange[] asks)
Sparse(QuoteChange, QuoteChange, decimal, decimal?, int)
To create form pair of quotes a sparse collection of quotes, which will be included into the range between the pair.
public static (QuoteChange[] bids, QuoteChange[] asks) Sparse(this QuoteChange bid, QuoteChange ask, decimal priceRange, decimal? priceStep, int maxDepth = 10)
Parameters
bidQuoteChangeBid.
askQuoteChangeAsk.
priceRangedecimalMinimum price step.
priceStepdecimal?Security price step.
maxDepthintMax depth.
Returns
- (QuoteChange[] bids, QuoteChange[] asks)
The sparse collection of quotes.
Remarks
In sparsed collection shown quotes with no active orders. The volume of these quotes is 0.
Sparse(QuoteChange[], Sides, Unit, decimal?)
To create the sparse collection of quotes from regular quotes.
[Obsolete("Use method with decimal priceRange parameter")]
public static QuoteChange[] Sparse(this QuoteChange[] quotes, Sides side, Unit priceRange, decimal? priceStep)
Parameters
quotesQuoteChange[]Regular quotes. The collection shall contain quotes of the same direction (only bids or only offers).
sideSidesSide.
priceRangeUnitMinimum price step.
priceStepdecimal?Security price step.
Returns
- QuoteChange[]
The sparse collection of quotes.
Remarks
In sparsed collection shown quotes with no active orders. The volume of these quotes is 0.
Sparse(QuoteChange[], Sides, decimal, decimal?, int)
To create the sparse collection of quotes from regular quotes.
public static QuoteChange[] Sparse(this QuoteChange[] quotes, Sides side, decimal priceRange, decimal? priceStep, int maxDepth)
Parameters
quotesQuoteChange[]Regular quotes. The collection shall contain quotes of the same direction (only bids or only offers).
sideSidesSide.
priceRangedecimalMinimum price step.
priceStepdecimal?Security price step.
maxDepthintMax depth.
Returns
- QuoteChange[]
The sparse collection of quotes.
Remarks
In sparsed collection shown quotes with no active orders. The volume of these quotes is 0.
SplitToPair(string)
Split to pair.
public static (string pairFrom, string pairTo) SplitToPair(this string symbol)
Parameters
symbolstringSymbol.
Returns
Tick(int)
Create data type info for TickCandleMessage.
public static DataType Tick(this int arg)
Parameters
argintCandle arg.
Returns
- DataType
Data type info.
TimeFrame(TimeSpan)
Create data type info for TimeFrameCandleMessage.
public static DataType TimeFrame(this TimeSpan tf)
Parameters
tfTimeSpanCandle arg.
Returns
- DataType
Data type info.
ToCandleMessage(MessageTypes)
Cast candle type MessageTypes to the message CandleMessage.
public static Type ToCandleMessage(this MessageTypes type)
Parameters
typeMessageTypesCandle type.
Returns
- Type
Message type CandleMessage.
ToCandleMessageType(MessageTypes)
To convert the type of message MessageTypes into type of candles CandleMessage.
public static Type ToCandleMessageType(this MessageTypes type)
Parameters
typeMessageTypesMessage type.
Returns
- Type
Candles type.
ToDataType(ExecutionTypes)
Convert ExecutionTypes to DataType value.
public static DataType ToDataType(this ExecutionTypes type)
Parameters
typeExecutionTypes
Returns
ToDataType(MarketDataTypes, object)
Convert MarketDataTypes to DataType value.
[Obsolete("Use DataType class.")]
public static DataType ToDataType(this MarketDataTypes type, object arg)
Parameters
typeMarketDataTypesMarket data type.
argobjectThe additional argument, associated with data. For example, candle argument.
Returns
- DataType
Data type info.
ToDataType(string, string)
public static DataType ToDataType(this string type, string arg)
Parameters
Returns
- DataType
Data type info.
ToDataTypeArg(Type, string)
To convert string representation of the candle argument into typified.
public static object ToDataTypeArg(this Type messageType, string str)
Parameters
Returns
- object
Argument.
ToErrorMessage(Exception, long)
Convert error info into ErrorMessage.
public static ErrorMessage ToErrorMessage(this Exception error, long originalTransactionId = 0)
Parameters
errorExceptionError info.
originalTransactionIdlongID of the original message TransactionId for which this message is a response.
Returns
- ErrorMessage
Error message.
ToErrorMessage(string)
Convert error text message to ErrorMessage instance.
public static ErrorMessage ToErrorMessage(this string description)
Parameters
descriptionstringError text message.
Returns
- ErrorMessage
ErrorMessage instance.
ToExec(OrderRegisterMessage)
Convert OrderRegisterMessage to ExecutionMessage.
public static ExecutionMessage ToExec(this OrderRegisterMessage regMsg)
Parameters
regMsgOrderRegisterMessageThe message containing the information for the order registration.
Returns
- ExecutionMessage
The message contains information about the execution.
ToExecutionType(DataType)
Convert DataType to ExecutionTypes value.
public static ExecutionTypes ToExecutionType(this DataType type)
Parameters
Returns
ToInfo(MessageTypes, bool?)
Convert MessageTypes to MessageTypeInfo value.
public static MessageTypeInfo ToInfo(this MessageTypes type, bool? isMarketData = null)
Parameters
typeMessageTypesMessageTypes value.
isMarketDatabool?Market data.
Returns
- MessageTypeInfo
MessageTypeInfo value.
ToLevel1(CandleMessage)
Convert CandleMessage to Level1ChangeMessage value.
public static Level1ChangeMessage ToLevel1(this CandleMessage message)
Parameters
messageCandleMessageCandleMessage instance.
Returns
- Level1ChangeMessage
Level1ChangeMessage instance.
ToLevel1(ExecutionMessage)
Convert ExecutionMessage to Level1ChangeMessage value.
public static Level1ChangeMessage ToLevel1(this ExecutionMessage message)
Parameters
messageExecutionMessageExecutionMessage instance.
Returns
- Level1ChangeMessage
Level1ChangeMessage instance.
ToLevel1(IOrderBookMessage)
Convert IOrderBookMessage to Level1ChangeMessage value.
public static Level1ChangeMessage ToLevel1(this IOrderBookMessage message)
Parameters
messageIOrderBookMessageIOrderBookMessage instance.
Returns
- Level1ChangeMessage
Level1ChangeMessage instance.
ToLevel1(IEnumerable<ExecutionMessage>, IOrderLogMarketDepthBuilder, TimeSpan)
To build level1 from the orders log.
public static IEnumerable<Level1ChangeMessage> ToLevel1(this IEnumerable<ExecutionMessage> items, IOrderLogMarketDepthBuilder builder, TimeSpan interval = default)
Parameters
itemsIEnumerable<ExecutionMessage>Orders log lines.
builderIOrderLogMarketDepthBuilderOrder log to market depth builder.
intervalTimeSpanThe interval of the order book generation. The default is Zero, which means order books generation at each new item of orders log.
Returns
- IEnumerable<Level1ChangeMessage>
Tick trades.
ToLevel1(IEnumerable<QuoteChangeMessage>)
To build level1 from the order books.
public static IEnumerable<Level1ChangeMessage> ToLevel1(this IEnumerable<QuoteChangeMessage> quotes)
Parameters
quotesIEnumerable<QuoteChangeMessage>Order books.
Returns
- IEnumerable<Level1ChangeMessage>
Level1.
ToMarketDataType(DataType)
Convert DataType to MarketDataTypes value.
[Obsolete("Use DataType class.")]
public static MarketDataTypes ToMarketDataType(this DataType dataType)
Parameters
dataTypeDataTypeData type info.
Returns
- MarketDataTypes
MarketDataTypes value or null if cannot be converted.
ToMessage(ConnectionStates)
Convert ConnectionStates to Message.
public static Message ToMessage(this ConnectionStates state)
Parameters
stateConnectionStatesConnectionStates value.
Returns
ToMessageType(MarketDataTypes, out object)
Convert MarketDataTypes to MessageTypes value.
[Obsolete("Use DataType class.")]
public static MessageTypes ToMessageType(this MarketDataTypes type, out object arg)
Parameters
typeMarketDataTypesMarket data type.
argobjectThe additional argument, associated with data. For example, candle argument.
Returns
- MessageTypes
Message type.
ToMessageType(MessageTypes)
Convert MessageTypes to Type value.
public static Type ToMessageType(this MessageTypes type)
Parameters
typeMessageTypesMessageTypes value.
Returns
ToMessageType(string)
Convert string into MessageTypes.
public static MessageTypes ToMessageType(this string str)
Parameters
Returns
ToMessageType(Type)
Convert Type to MessageTypes value.
public static MessageTypes ToMessageType(this Type type)
Parameters
Returns
- MessageTypes
MessageTypes value.
ToMessageType2(DataType)
Convert DataType to MessageTypes value.
public static MessageTypes ToMessageType2(this DataType type)
Parameters
Returns
- MessageTypes
Message type.
ToMicexCurrencyName(CurrencyTypes)
To convert the currency type into the name in the MICEX format.
public static string ToMicexCurrencyName(this CurrencyTypes type)
Parameters
typeCurrencyTypesCurrency type.
Returns
- string
The currency name in the MICEX format.
ToNullableSecurityId(string, SecurityIdGenerator)
Convert string to SecurityId value.
public static SecurityId ToNullableSecurityId(this string id, SecurityIdGenerator generator = null)
Parameters
idstringstring value.
generatorSecurityIdGeneratorThe instrument identifiers generator SecurityId. Can be null.
Returns
- SecurityId
SecurityId value.
ToOrderBooks(IEnumerable<ExecutionMessage>, IOrderLogMarketDepthBuilder, TimeSpan, int)
Build market depths from order log.
public static IEnumerable<QuoteChangeMessage> ToOrderBooks(this IEnumerable<ExecutionMessage> items, IOrderLogMarketDepthBuilder builder, TimeSpan interval = default, int maxDepth = 2147483647)
Parameters
itemsIEnumerable<ExecutionMessage>Orders log lines.
builderIOrderLogMarketDepthBuilderOrder log to market depth builder.
intervalTimeSpanThe interval of the order book generation. The default is Zero, which means order books generation at each new item of orders log.
maxDepthintThe maximal depth of order book. The default is MaxValue, which means endless depth.
Returns
- IEnumerable<QuoteChangeMessage>
Market depths.
ToOrderBooks(IEnumerable<Level1ChangeMessage>)
To convert level1 data into order books.
public static IEnumerable<QuoteChangeMessage> ToOrderBooks(this IEnumerable<Level1ChangeMessage> level1)
Parameters
level1IEnumerable<Level1ChangeMessage>Level1 data.
Returns
- IEnumerable<QuoteChangeMessage>
Market depths.
ToOrderSnapshot(IEnumerable<ExecutionMessage>, long, ILogReceiver)
Convert order changes to final snapshot.
public static ExecutionMessage ToOrderSnapshot(this IEnumerable<ExecutionMessage> diffs, long transactionId, ILogReceiver logs)
Parameters
diffsIEnumerable<ExecutionMessage>Changes.
transactionIdlongTransaction ID.
logsILogReceiverLogs.
Returns
- ExecutionMessage
Snapshot.
ToReadableString(DataType)
Convert DataType to readable string.
public static string ToReadableString(this DataType dt)
Parameters
Returns
- string
Readable string.
ToReg(ExecutionMessage)
Convert ExecutionMessage to OrderRegisterMessage.
public static OrderRegisterMessage ToReg(this ExecutionMessage execMsg)
Parameters
execMsgExecutionMessageThe message contains information about the execution.
Returns
- OrderRegisterMessage
The message containing the information for the order registration.
ToSecurityId(string, SecurityIdGenerator)
Convert string to SecurityId value.
public static SecurityId ToSecurityId(this string id, SecurityIdGenerator generator = null)
Parameters
idstringstring value.
generatorSecurityIdGeneratorThe instrument identifiers generator SecurityId. Can be null.
Returns
- SecurityId
SecurityId value.
ToStringId(SecurityId, SecurityIdGenerator, bool)
Convert SecurityId to SecurityId value.
public static string ToStringId(this SecurityId securityId, SecurityIdGenerator generator = null, bool nullIfEmpty = false)
Parameters
securityIdSecurityIdSecurityId value.
generatorSecurityIdGeneratorThe instrument identifiers generator SecurityId. Can be null.
nullIfEmptyboolReturn null if SecurityId is empty.
Returns
- string
SecurityId value.
ToTick(ExecutionMessage)
To tick trade from the order log.
public static ExecutionMessage ToTick(this ExecutionMessage item)
Parameters
itemExecutionMessageOrder log item.
Returns
- ExecutionMessage
Tick trade.
ToTick(Level1ChangeMessage)
To convert level1 data into tick data.
public static ExecutionMessage ToTick(this Level1ChangeMessage level1)
Parameters
level1Level1ChangeMessageLevel1 data.
Returns
- ExecutionMessage
Tick data.
ToTicks(IEnumerable<ExecutionMessage>)
To build tick trades from the orders log.
public static IEnumerable<ExecutionMessage> ToTicks(this IEnumerable<ExecutionMessage> items)
Parameters
itemsIEnumerable<ExecutionMessage>Orders log lines.
Returns
- IEnumerable<ExecutionMessage>
Tick trades.
ToTicks(IEnumerable<Level1ChangeMessage>)
To convert level1 data into tick data.
public static IEnumerable<ExecutionMessage> ToTicks(this IEnumerable<Level1ChangeMessage> level1)
Parameters
level1IEnumerable<Level1ChangeMessage>Level1 data.
Returns
- IEnumerable<ExecutionMessage>
Tick data.
ToType(Level1Fields)
Convert Level1Fields to Type value.
public static Type ToType(this Level1Fields field)
Parameters
fieldLevel1FieldsLevel1Fields value.
Returns
ToType(PositionChangeTypes)
Convert PositionChangeTypes to Type value.
public static Type ToType(this PositionChangeTypes type)
Parameters
typePositionChangeTypesPositionChangeTypes value.
Returns
Truncate(IOrderBookMessage, int)
Truncate the specified order book by max depth value.
public static QuoteChangeMessage Truncate(this IOrderBookMessage depth, int maxDepth)
Parameters
depthIOrderBookMessageOrder book.
maxDepthintThe maximum depth of order book.
Returns
- QuoteChangeMessage
Truncated order book.
TryAdd<TMessage, TChange>(TMessage, TChange, decimal, bool)
To add a change to the collection, if value is other than 0.
public static TMessage TryAdd<TMessage, TChange>(this TMessage message, TChange type, decimal value, bool isZeroAcceptable = false) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valuedecimalChange value.
isZeroAcceptableboolIs zero value is acceptable values.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryAdd<TMessage, TChange>(TMessage, TChange, int, bool)
To add a change to the collection, if value is other than 0.
public static TMessage TryAdd<TMessage, TChange>(this TMessage message, TChange type, int value, bool isZeroAcceptable = false) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valueintChange value.
isZeroAcceptableboolIs zero value is acceptable values.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryAdd<TMessage, TChange>(TMessage, TChange, long, bool)
To add a change to the collection, if value is other than 0.
public static TMessage TryAdd<TMessage, TChange>(this TMessage message, TChange type, long value, bool isZeroAcceptable = false) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valuelongChange value.
isZeroAcceptableboolIs zero value is acceptable values.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryAdd<TMessage, TChange>(TMessage, TChange, CurrencyTypes?)
To add a change to the collection, if value is other than null.
public static TMessage TryAdd<TMessage, TChange>(this TMessage message, TChange type, CurrencyTypes? value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valueCurrencyTypes?Change value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryAdd<TMessage, TChange>(TMessage, TChange, PortfolioStates?)
To add a change to the collection, if value is other than null.
public static TMessage TryAdd<TMessage, TChange>(this TMessage message, TChange type, PortfolioStates? value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valuePortfolioStates?Change value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryAdd<TMessage, TChange>(TMessage, TChange, SecurityStates?)
To add a change to the collection, if value is other than null.
public static TMessage TryAdd<TMessage, TChange>(this TMessage message, TChange type, SecurityStates? value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valueSecurityStates?Change value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryAdd<TMessage, TChange>(TMessage, TChange, Sides?)
To add a change to the collection, if value is other than null.
public static TMessage TryAdd<TMessage, TChange>(this TMessage message, TChange type, Sides? value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valueSides?Change value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryAdd<TMessage, TChange>(TMessage, TChange, bool?)
To add a change to the collection, if value is other than null.
public static TMessage TryAdd<TMessage, TChange>(this TMessage message, TChange type, bool? value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valuebool?Change value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryAdd<TMessage, TChange>(TMessage, TChange, DateTimeOffset?)
To add a change to the collection, if value is other than null.
public static TMessage TryAdd<TMessage, TChange>(this TMessage message, TChange type, DateTimeOffset? value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valueDateTimeOffset?Change value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryAdd<TMessage, TChange>(TMessage, TChange, decimal?, bool)
To add a change to the collection, if value is other than 0 and null.
public static TMessage TryAdd<TMessage, TChange>(this TMessage message, TChange type, decimal? value, bool isZeroAcceptable = false) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valuedecimal?Change value.
isZeroAcceptableboolIs zero value is acceptable values.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryAdd<TMessage, TChange>(TMessage, TChange, int?, bool)
To add a change to the collection, if value is other than 0 and null.
public static TMessage TryAdd<TMessage, TChange>(this TMessage message, TChange type, int? value, bool isZeroAcceptable = false) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valueint?Change value.
isZeroAcceptableboolIs zero value is acceptable values.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryAdd<TMessage, TChange>(TMessage, TChange, long?, bool)
To add a change to the collection, if value is other than 0 and null.
public static TMessage TryAdd<TMessage, TChange>(this TMessage message, TChange type, long? value, bool isZeroAcceptable = false) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valuelong?Change value.
isZeroAcceptableboolIs zero value is acceptable values.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryAdd<TMessage, TChange>(TMessage, TChange, string)
To add a change to the collection, if value is other than null.
public static TMessage TryAdd<TMessage, TChange>(this TMessage message, TChange type, string value) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
valuestringChange value.
Returns
- TMessage
Change message.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryFillUnderlyingId(SecurityMessage, string)
Fill UnderlyingSecurityId property.
public static SecurityMessage TryFillUnderlyingId(this SecurityMessage secMsg, string underlyingCode)
Parameters
secMsgSecurityMessageunderlyingCodestringUnderlying asset id.
Returns
TryGet(IDictionary<string, string>, string, string)
public static string TryGet(this IDictionary<string, string> parameters, string name, string defaultValue = null)
Parameters
parametersIDictionary<string, string>namestringdefaultValuestring
Returns
TryGetDecimal<TMessage, TChange>(TMessage, TChange)
Try get change from message.
public static decimal? TryGetDecimal<TMessage, TChange>(this TMessage message, TChange type) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
Returns
- decimal?
Change value.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryGetIconUrl(Type)
public static Uri TryGetIconUrl(this Type type)
Parameters
typeType
Returns
- Uri
Icon url.
TryGetSecurityId(Message)
Try get security ID from the specified message.
public static SecurityId? TryGetSecurityId(this Message message)
Parameters
messageMessageMessage.
Returns
- SecurityId?
Security ID or null if message do not provide it.
TryGetServerTime(Message, out DateTimeOffset)
Try get message server time.
public static bool TryGetServerTime(this Message message, out DateTimeOffset serverTime)
Parameters
messageMessageMessage.
serverTimeDateTimeOffsetServer time. If the value is default, the message does not contain the server time.
Returns
- bool
Operation result.
TryGetVectorIcon(Type)
Try get Icon path.
public static Uri TryGetVectorIcon(this Type type)
Parameters
typeTypeComponent type with applied VectorIconAttribute.
Returns
- Uri
Icon url.
TryGet<TMessage, TChange>(TMessage, TChange)
Try get change from message.
public static object TryGet<TMessage, TChange>(this TMessage message, TChange type) where TMessage : BaseChangeMessage<TMessage, TChange>, new()
Parameters
messageTMessageChange message.
typeTChangeChange type.
Returns
- object
Change value.
Type Parameters
TMessageChange message type.
TChangeChange type.
TryInitLocalTime(Message, ILogSource)
Try to initialize LocalTime by CurrentTime.
public static void TryInitLocalTime(this Message message, ILogSource source)
Parameters
messageMessageMessage.
sourceILogSourceSource.
TryLimitByCount<T>(IEnumerable<T>, SecurityLookupMessage)
public static IEnumerable<T> TryLimitByCount<T>(this IEnumerable<T> set, SecurityLookupMessage msg)
Parameters
setIEnumerable<T>msgSecurityLookupMessage
Returns
- IEnumerable<T>
Type Parameters
T
TryRemoveWrapper<TAdapter>(IMessageAdapter)
Remove adapter by the specified type.
public static TAdapter TryRemoveWrapper<TAdapter>(this IMessageAdapter adapter) where TAdapter : IMessageAdapterWrapper
Parameters
adapterIMessageAdapterAdapter.
Returns
- TAdapter
Removed adapter or null.
Type Parameters
TAdapterThe adapter type.
UnGroup(IOrderBookMessage)
To de-group the order book, grouped using the method Group(IOrderBookMessage, decimal).
public static QuoteChangeMessage UnGroup(this IOrderBookMessage depth)
Parameters
depthIOrderBookMessageThe grouped order book.
Returns
- QuoteChangeMessage
The de-grouped order book.
UndoBack<TMessage>(TMessage)
Undo operation made via LoopBack<TMessage>(TMessage, IMessageAdapter, MessageBackModes).
public static TMessage UndoBack<TMessage>(this TMessage message) where TMessage : IMessage
Parameters
messageTMessageMessage.
Returns
- TMessage
Message.
Type Parameters
TMessageMessage type.
UseChannels(IMessageAdapter)
To check, whether the message adapter uses channels.
public static bool UseChannels(this IMessageAdapter adapter)
Parameters
adapterIMessageAdapter
Returns
- bool
Check result.
ValidateBounds(MarketDataMessage)
public static MarketDataMessage ValidateBounds(this MarketDataMessage message)
Parameters
messageMarketDataMessageMessage.
Returns
- MarketDataMessage
Message.
ValidateCandleArg(Type, object)
Validate candle arg.
public static bool ValidateCandleArg(this Type candleMessageType, object value)
Parameters
Returns
- bool
Check result.
ValidateChannelState(ChannelStates, ChannelStates)
Validate state change.
public static bool ValidateChannelState(this ChannelStates currState, ChannelStates newState)
Parameters
currStateChannelStatesCurrent state.
newStateChannelStatesNew state.
Returns
Verify(IOrderBookMessage)
To determine whether the order book is in the right state.
public static bool Verify(this IOrderBookMessage book)
Parameters
bookIOrderBookMessageOrder book.
Returns
Remarks
It is used in cases when the trading system by mistake sends the wrong quotes.
VerifyOrderState(OrderStates?, OrderStates, long, ILogReceiver)
Check the possibility OrderStates change.
public static bool VerifyOrderState(this OrderStates? currState, OrderStates newState, long transactionId, ILogReceiver logs)
Parameters
currStateOrderStates?Current order's state.
newStateOrderStatesNew state.
transactionIdlongTransaction id.
logsILogReceiverLogs.
Returns
- bool
Check result.
Volume(decimal)
Create data type info for VolumeCandleMessage.
public static DataType Volume(this decimal arg)
Parameters
argdecimalCandle arg.
Returns
- DataType
Data type info.