Extensions

StockSharp.Messages

Extension class.

Properties

AllCandleTypes
public static IEnumerable<Type> AllCandleTypes { get; }
value = Extensions.AllCandleTypes

All registered candle types.

AllSecurity
public static SecurityMessage AllSecurity { get; }
value = Extensions.AllSecurity

"All securities" instance.

BestAskFields
public static CachedSynchronizedSet<Level1Fields> BestAskFields { get; }
value = Extensions.BestAskFields

Fields related to best ask.

BestBidFields
public static CachedSynchronizedSet<Level1Fields> BestBidFields { get; }
value = Extensions.BestBidFields

Fields related to best bid.

LastTradeFields
public static CachedSynchronizedSet<Level1Fields> LastTradeFields { get; }
value = Extensions.LastTradeFields

Fields related to last trade.

MarketDataMessageTypes
public static IEnumerable<MessageTypes> MarketDataMessageTypes { get; }
value = Extensions.MarketDataMessageTypes

Market-data message types.

TransactionalMessageTypes
public static IEnumerable<MessageTypes> TransactionalMessageTypes { get; }
value = Extensions.TransactionalMessageTypes

Transactional message types.

Methods

AddDelta
public static QuoteChangeMessage AddDelta(IOrderBookMessage from, IOrderBookMessage delta)
result = Extensions.AddDelta(from, delta)

To add change to the first order book.

from
First order book.
delta
Change.

Returns: The changed order book.

AddDelta
public static QuoteChange[] AddDelta(IEnumerable<QuoteChange> fromQuotes, IEnumerable<QuoteChange> deltaQuotes, bool isBids)
result = Extensions.AddDelta(fromQuotes, deltaQuotes, isBids)

To add change to quote.

fromQuotes
Quotes.
deltaQuotes
Changes.
isBids
The indication of quotes direction.

Returns: Changed quotes.

AddMarketDataSupport
public static void AddMarketDataSupport(MessageAdapter adapter)
Extensions.AddMarketDataSupport(adapter)

Fill the SupportedInMessages message types related to market-data.

adapter
Adapter.
AddNotSupportedResultMessage
public static void AddNotSupportedResultMessage(MessageAdapter adapter, MessageTypes type)
Extensions.AddNotSupportedResultMessage(adapter, type)

Add the message type info NotSupportedResultMessages.

adapter
Adapter.
type
Message type.
AddOrSubtractTradingDays
public static DateTime AddOrSubtractTradingDays(BoardMessage board, DateTime date, int n, bool checkHolidays)
result = Extensions.AddOrSubtractTradingDays(board, date, n, checkHolidays)

To get date of day T +/- of N trading days.

board
Board info.
date
The start T date, to which are added or subtracted N trading days.
n
The N size. The number of trading days for the addition or subtraction.
checkHolidays
Whether to check the passed date for a weekday (Saturday and Sunday are days off, returned value for them is ).

Returns: The end T +/- N date.

AddSupportedCandleTimeFrames
public static void AddSupportedCandleTimeFrames(MessageAdapter adapter, IEnumerable<TimeSpan> timeFrames)
Extensions.AddSupportedCandleTimeFrames(adapter, timeFrames)

Add time-frames into DateTime}).

adapter
Adapter.
timeFrames
Time-frames.
AddSupportedMarketDataType
public static void AddSupportedMarketDataType(MessageAdapter adapter, DataType dataType)
Extensions.AddSupportedMarketDataType(adapter, dataType)

Add market data type into DateTime}).

adapter
Adapter.
dataType
Data type info.
AddSupportedMessage
public static void AddSupportedMessage(MessageAdapter adapter, MessageTypeInfo info)
Extensions.AddSupportedMessage(adapter, info)

Add the message type info PossibleSupportedMessages.

adapter
Adapter.
info
Extended info for MessageTypes.
AddSupportedMessage
public static void AddSupportedMessage(MessageAdapter adapter, MessageTypes type, bool? isMarketData)
Extensions.AddSupportedMessage(adapter, type, isMarketData)

Add the message type info SupportedInMessages.

adapter
Adapter.
type
Message type.
isMarketData
is market-data type.
AddTransactionalSupport
public static void AddTransactionalSupport(MessageAdapter adapter)
Extensions.AddTransactionalSupport(adapter)

Fill the SupportedInMessages message types related to transactional.

adapter
Adapter.
Add``2
public static TMessage Add<TMessage, TChange>(TMessage message, TChange type, CurrencyTypes value)
result = Extensions.Add(message, type, value)

Add change into collection.

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

Add``2
public static TMessage Add<TMessage, TChange>(TMessage message, TChange type, PortfolioStates value)
result = Extensions.Add(message, type, value)

Add change into collection.

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

Add``2
public static TMessage Add<TMessage, TChange>(TMessage message, TChange type, DateTime value)
result = Extensions.Add(message, type, value)

Add change into collection.

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

Add``2
public static TMessage Add<TMessage, TChange>(TMessage message, TChange type, long value)
result = Extensions.Add(message, type, value)

Add change into collection.

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

Add``2
public static TMessage Add<TMessage, TChange>(TMessage message, TChange type, Sides value)
result = Extensions.Add(message, type, value)

Add change into collection.

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

Add``2
public static TMessage Add<TMessage, TChange>(TMessage message, TChange type, int value)
result = Extensions.Add(message, type, value)

Add change into collection.

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

Add``2
public static TMessage Add<TMessage, TChange>(TMessage message, TChange type, decimal value)
result = Extensions.Add(message, type, value)

Add change into collection.

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

Add``2
public static TMessage Add<TMessage, TChange>(TMessage message, TChange type, object value)
result = Extensions.Add(message, type, value)

Add change into collection.

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

Add``2
public static TMessage Add<TMessage, TChange>(TMessage message, TChange type, bool value)
result = Extensions.Add(message, type, value)

Add change into collection.

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

Add``2
public static TMessage Add<TMessage, TChange>(TMessage message, TChange type, SecurityStates value)
result = Extensions.Add(message, type, value)

Add change into collection.

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

ApplyNewBalance
public static decimal ApplyNewBalance(decimal? currBal, decimal newBal, long transactionId, ILogReceiver logs)
result = Extensions.ApplyNewBalance(currBal, newBal, transactionId, logs)

Check the possibility Balance change.

currBal
Current balance.
newBal
New balance.
transactionId
Transaction id.
logs
Logs.

Returns: New balance.

BuildIfNeed
public static IAsyncEnumerable<QuoteChangeMessage> BuildIfNeed(IAsyncEnumerable<QuoteChangeMessage> books, ILogReceiver logs)
result = Extensions.BuildIfNeed(books, logs)

To build order books from incremental updates.

books
Order books (may be incremental).
logs
Logs.

Returns: Full order books.

BuildIfNeed
public static IEnumerable<QuoteChangeMessage> BuildIfNeed(IEnumerable<QuoteChangeMessage> books, ILogReceiver logs)
result = Extensions.BuildIfNeed(books, logs)

Try build books by OrderBookIncrementBuilder in case of is incremental changes.

books
Order books.
logs
Logs.

Returns: Order books.

ChangeSupported
public static void ChangeSupported(IMessageAdapter adapter, bool add, bool isMarketData)
Extensions.ChangeSupported(adapter, add, isMarketData)

Change SupportedInMessages.

adapter
Adapter.
add
Command.
isMarketData
Message types.
CreateAdapter
public static IMessageAdapter CreateAdapter(Type adapterType, IdGenerator idGenerator)
result = Extensions.CreateAdapter(adapterType, idGenerator)

Create IMessageAdapter.

adapterType
Adapter type.
idGenerator
Transaction id generator.

Returns: IMessageAdapter instance.

CreateAdapter
public static IMessageAdapter CreateAdapter(Type adapterType)
result = Extensions.CreateAdapter(adapterType)

Create IMessageAdapter instance.

adapterType
Adapter type.

Returns: IMessageAdapter instance.

CreateCandleMessage
public static CandleMessage CreateCandleMessage(Type messageType)
result = Extensions.CreateCandleMessage(messageType)

Create instance of CandleMessage.

messageType
The type of candle message.

Returns: Instance of CandleMessage.

CreateErrorResponse
public static Message CreateErrorResponse(Message message, Exception ex, ILogReceiver logs, Func<DataType, long[]> getSubscribers)
result = Extensions.CreateErrorResponse(message, ex, logs, getSubscribers)

Create error response.

message
Original message.
ex
Error.
logs
Logs.
getSubscribers
Subscriber identifiers provider.

Returns: Error response.

CreateExecutorAndRun
public static ChannelExecutor CreateExecutorAndRun(TimeSpan interval, Action<Exception> errorHandler, CancellationToken token)
result = Extensions.CreateExecutorAndRun(interval, errorHandler, token)

Create and run ChannelExecutor.

interval
The time interval between processing of messages.
errorHandler
Error handler.
token
CancellationToken

Returns: ChannelExecutor

CreateNotSupported
public static SubscriptionResponseMessage CreateNotSupported(long id)
result = Extensions.CreateNotSupported(id)

Create non supported subscription response.

id
ID of the original message for which this message is a response.

Returns: Subscription response message.

CreateOrderCondition
public static OrderCondition CreateOrderCondition(IMessageAdapter adapter)
result = Extensions.CreateOrderCondition(adapter)

Create condition for order type Conditional, that supports the adapter.

adapter
Adapter.

Returns: Order condition.

CreateOrderCondition
public static OrderCondition CreateOrderCondition(Type orderConditionType)
result = Extensions.CreateOrderCondition(orderConditionType)

Create condition for order type Conditional, that supports the adapter.

orderConditionType
Type of OrderCondition.

Returns: Order condition.

CreateOrderLogMarketDepthBuilder
public static IOrderLogMarketDepthBuilder CreateOrderLogMarketDepthBuilder(Type builderType, SecurityId securityId)
result = Extensions.CreateOrderLogMarketDepthBuilder(builderType, securityId)

Create IOrderLogMarketDepthBuilder instance.

builderType
Builder type.
securityId
Security ID.

Returns: IOrderLogMarketDepthBuilder instance.

CreateOrderReply
public static ExecutionMessage CreateOrderReply(long transactionId, DateTime serverTime)
result = Extensions.CreateOrderReply(transactionId, serverTime)

Create order's transaction reply.

transactionId
Transaction ID.
serverTime
Server time.

Returns: The message contains information about the execution.

CreatePortfolioChangeMessage
public static PositionChangeMessage CreatePortfolioChangeMessage(IMessageAdapter adapter, string pfName)
result = Extensions.CreatePortfolioChangeMessage(adapter, pfName)

Initializes a new instance of the PositionChangeMessage.

adapter
Trading system adapter.
pfName
Portfolio name.

Returns: Portfolio change message.

CreatePositionChangeMessage
public static PositionChangeMessage CreatePositionChangeMessage(IMessageAdapter adapter, string pfName, SecurityId securityId, string depoName)
result = Extensions.CreatePositionChangeMessage(adapter, pfName, securityId, depoName)

Initializes a new instance of the PositionChangeMessage.

adapter
Trading system adapter.
pfName
Portfolio name.
securityId
Security ID.
depoName
The depositary where the physical security.

Returns: Position change message.

CreateReply
public static ExecutionMessage CreateReply(OrderMessage message, Exception error)
result = Extensions.CreateReply(message, error)

Cast OrderMessage to the ExecutionMessage.

message
OrderMessage.
error
Error info.

Returns: ExecutionMessage.

CreateResponse
public static SubscriptionResponseMessage CreateResponse(ISubscriptionMessage message, Exception error)
result = Extensions.CreateResponse(message, error)

Create subscription response.

message
Subscription.
error
Error info.

Returns: Subscription response message.

CreateResult
public static Message CreateResult(ISubscriptionMessage message)
result = Extensions.CreateResult(message)

Create SubscriptionOnlineMessage or SubscriptionFinishedMessage depends of To.

message
Subscription.

Returns: Message.

CreateSubscriptionResponse
public static SubscriptionResponseMessage CreateSubscriptionResponse(long id, Exception error)
result = Extensions.CreateSubscriptionResponse(id, error)

Create subscription response.

id
ID of the original message for which this message is a response.
error
Error info.

Returns: Subscription response message.

DataTypeArgToString
public static string DataTypeArgToString(Type messageType, object arg)
result = Extensions.DataTypeArgToString(messageType, arg)

Convert candle parameter into folder name replacing the reserved symbols.

messageType
The type of candle message.
arg
Candle arg.

Returns: Directory name.

DataTypeArgToString
public static string DataTypeArgToString(DataType dataType)
result = Extensions.DataTypeArgToString(dataType)

Convert candle parameter into folder name replacing the reserved symbols.

dataType
Data type info.

Returns: Directory name.

DataTypeToFileName
public static string DataTypeToFileName(DataType dataType)
result = Extensions.DataTypeToFileName(dataType)

Convert file name to DataType.

dataType
Data type info.

Returns: File name.

EnsureGetGenerator
public static SecurityIdGenerator EnsureGetGenerator(SecurityIdGenerator generator)
result = Extensions.EnsureGetGenerator(generator)

Returns the specified generator or the default in case of .

generator
SecurityIdGenerator

Returns: SecurityIdGenerator

EnsureToday
public static DateTime? EnsureToday(DateTime? date)
result = Extensions.EnsureToday(date)

Determines the specified date equals is Today and returns Today.

date
The specified date.

Returns: Result value.

EnsureToday
public static DateTime? EnsureToday(DateTime? date, DateTime? todayValue)
result = Extensions.EnsureToday(date, todayValue)

Determines the specified date equals is Today and returns .

date
The specified date.
todayValue
Today value.

Returns: Result value.

FileNameToDataType
public static DataType FileNameToDataType(string fileName)
result = Extensions.FileNameToDataType(fileName)

Convert DataType to file name.

fileName
File name.

Returns: Data type info.

FillDefaultCryptoFields
public static SecurityMessage FillDefaultCryptoFields(SecurityId secId)
result = Extensions.FillDefaultCryptoFields(secId)

Fill default CryptoCurrency price and volume step by 0.00000001 value.

secId
Security ID.

Returns: A message containing info about the security.

FillDefaultCryptoFields
public static SecurityMessage FillDefaultCryptoFields(SecurityMessage message)
result = Extensions.FillDefaultCryptoFields(message)

Fill default CryptoCurrency price and volume step by 0.00000001 value.

message
A message containing info about the security.

Returns: A message containing info about the security.

Filter
public static IEnumerable<BoardMessage> Filter(IEnumerable<BoardMessage> boards, BoardLookupMessage criteria)
result = Extensions.Filter(boards, criteria)

Filter boards by code criteria.

boards
All boards.
criteria
Criteria.

Returns: Found boards.

Filter
public static IEnumerable<SecurityMessage> Filter(IEnumerable<SecurityMessage> securities, SecurityLookupMessage criteria)
result = Extensions.Filter(securities, criteria)

To filter instruments by the given criteria.

securities
Securities.
criteria
Message security lookup for specified criteria.

Returns: Instruments filtered.

FilterTimeFrames
public static IEnumerable<TimeSpan> FilterTimeFrames(IEnumerable<DataType> dataTypes)
result = Extensions.FilterTimeFrames(dataTypes)

Extract time frames from the specified data types set.

dataTypes
Data types.

Returns: Possible time-frames.

Filter``1
public static IEnumerable<TMessage> Filter<TMessage>(IEnumerable<TMessage> messages, DateTime from, DateTime to)
result = Extensions.Filter(messages, from, to)

To filter messages for the given time period.

messages
All messages, in which the required shall be searched for.
from
The start date for searching.
to
The end date for searching.

Returns: Filtered messages.

FindAdapter``1
public static TAdapter FindAdapter<TAdapter>(IMessageAdapterWrapper wrapper)
result = Extensions.FindAdapter(wrapper)

Find adapter by the specified type.

wrapper
Wrapping based adapter.

Returns: Found adapter or .

FindAdapter``1
public static TAdapter FindAdapter<TAdapter>(IMessageAdapter adapter)
result = Extensions.FindAdapter(adapter)

Find adapter by the specified type.

adapter
Adapter.

Returns: Found adapter or .

FindById
public static IMessageAdapter FindById(IEnumerable<IMessageAdapter> adapters, Guid id)
result = Extensions.FindById(adapters, id)

Get adapter by the specified key.

adapters
All available adapters.
id
Adapter identifier.

Returns: Found adapter or .

FormatToString
public static ValueTuple<string, string> FormatToString(DataType dataType)
result = Extensions.FormatToString(dataType)

Convert DataType to String value.

dataType
Data type info.

Returns: String value.

FromMicexCurrencyName
public static ValueTuple<CurrencyTypes?, Exception> FromMicexCurrencyName(string name)
result = Extensions.FromMicexCurrencyName(name)

To convert the currency name in the MICEX format into CurrencyTypes.

name
The currency name in the MICEX format.

Returns: Currency type. If the value is empty, will be returned.

FromMicexCurrencyName
public static CurrencyTypes? FromMicexCurrencyName(string name, Action<Exception> errorHandler)
result = Extensions.FromMicexCurrencyName(name, errorHandler)

To convert the currency name in the MICEX format into CurrencyTypes.

name
The currency name in the MICEX format.
errorHandler
Error handler.

Returns: Currency type. If the value is empty, will be returned.

GetArg
public static object GetArg(MarketDataMessage mdMsg)
result = Extensions.GetArg(mdMsg)

Get typed argument.

mdMsg
Market-data message (uses as a subscribe/unsubscribe in outgoing case, confirmation event in incoming case).

Returns: The additional argument, associated with data. For example, candle argument.

GetArg``1
public static TArg GetArg<TArg>(MarketDataMessage mdMsg)
result = Extensions.GetArg(mdMsg)

Get typed argument.

mdMsg
Market-data message (uses as a subscribe/unsubscribe in outgoing case, confirmation event in incoming case).

Returns: The additional argument, associated with data. For example, candle argument.

GetBalance
public static decimal GetBalance(ExecutionMessage message)
result = Extensions.GetBalance(message)

Get Balance.

message
The message contains information about the execution.

Returns: Order contracts balance.

GetBestAsk
public static QuoteChange? GetBestAsk(IOrderBookMessage message)
result = Extensions.GetBestAsk(message)

Get best ask.

message
Market depth.

Returns: Best ask, or , if no asks are empty.

GetBestBid
public static QuoteChange? GetBestBid(IOrderBookMessage message)
result = Extensions.GetBestBid(message)

Get best bid.

message
Market depth.

Returns: Best bid, or , if no bids are empty.

GetBestPair
public static ValueTuple<QuoteChange?, QuoteChange?> GetBestPair(IOrderBookMessage book)
result = Extensions.GetBestPair(book)

Get best pair.

book
IOrderBookMessage

Returns: Best pair.

GetCandleArgType
public static Type GetCandleArgType(Type candleMessageType)
result = Extensions.GetCandleArgType(candleMessageType)

Get candle arg type.

candleMessageType
Candle message type.

Returns: Candle arg type.

GetCandleBounds
public static Range<DateTime> GetCandleBounds(TimeSpan timeFrame, DateTime currentTime, TimeZoneInfo timeZone, WorkingTime time)
result = Extensions.GetCandleBounds(timeFrame, currentTime, timeZone, time)

To get candle time frames relatively to the exchange working pattern.

timeFrame
The time frame for which you need to get time range.
currentTime
The current time within the range of time frames.
timeZone
Information about the time zone where the exchange is located.
time
The information about the exchange working pattern.

Returns: The candle time frames.

GetCandleBounds
public static Range<DateTime> GetCandleBounds(TimeSpan timeFrame, DateTime currentTime)
result = Extensions.GetCandleBounds(timeFrame, currentTime)

To get candle time frames relatively to the exchange working pattern.

timeFrame
The time frame for which you need to get time range.
currentTime
The current time within the range of time frames.

Returns: The candle time frames.

GetDefaultHistoryStepSize
public static TimeSpan GetDefaultHistoryStepSize(IMessageAdapter adapter, SecurityId securityId, DataType dataType, TimeSpan iterationInterval)
result = Extensions.GetDefaultHistoryStepSize(adapter, securityId, dataType, iterationInterval)

Get maximum size step allowed for historical download.

adapter
Trading system adapter.
securityId
SecurityId
dataType
Data type info.
iterationInterval
Interval between iterations.

Returns: Step.

GetDefaultMaxCount
public static int? GetDefaultMaxCount(DataType dataType)
result = Extensions.GetDefaultMaxCount(dataType)

Get maximum possible items count per single subscription request.

dataType
Data type info.

Returns: Max items count.

GetDelta
private static QuoteChange[] GetDelta(IEnumerable<QuoteChange> from, IEnumerable<QuoteChange> to, IComparer<decimal> comparer)
result = Extensions.GetDelta(from, to, comparer)

To calculate the change between quotes.

from
First quotes.
to
Second quotes.
comparer
The direction, showing the type of quotes.

Returns: Changes.

GetDelta
public static QuoteChangeMessage GetDelta(IOrderBookMessage from, IOrderBookMessage to)
result = Extensions.GetDelta(from, to)

To calculate the change between order books.

from
First order book.
to
Second order book.

Returns: The order book, storing only increments.

GetId``1
public static T GetId<T>(CommandMessage message)
result = Extensions.GetId(message)

Get typed ObjectId.

message
CommandMessage.

Returns: Typed ObjectId.

GetLastTradePrice
public static decimal? GetLastTradePrice(Level1ChangeMessage message)
result = Extensions.GetLastTradePrice(message)

Get last tick trade price.

message
Market depth.

Returns: The middle of spread. Is , if quotes are empty.

GetMatchedVolume
public static decimal? GetMatchedVolume(IOrderMessage order)
result = Extensions.GetMatchedVolume(order)

To calculate the implemented part of volume for order.

order
The order, for which the implemented part of volume shall be calculated.

Returns: The implemented part of volume.

GetMedianPrice
public static decimal GetMedianPrice(ICandleMessage candle)
result = Extensions.GetMedianPrice(candle)

Calculate median price of candle.

candle
ICandleMessage

Returns: Median price.

GetOrderLogCancelReason
public static OrderLogCancelReasons GetOrderLogCancelReason(ExecutionMessage item)
result = Extensions.GetOrderLogCancelReason(item)

To get the reason for cancelling order in orders log.

item
Order log item.

Returns: The reason for order cancelling in order log.

GetPair
public static ValueTuple<QuoteChange?, QuoteChange?> GetPair(IOrderBookMessage book, int depthIndex)
result = Extensions.GetPair(book, depthIndex)

To get a pair of quotes (bid + offer) by the depth index.

book
IOrderBookMessage
depthIndex
Depth index. Zero index means the best pair of quotes.

Returns: The pair of quotes. If the index is larger than book order depth, then the is returned.

GetPlazaTimeInForce
public static TimeInForce? GetPlazaTimeInForce(long status)
result = Extensions.GetPlazaTimeInForce(status)

Extract TimeInForce from bits flag.

status
Bits flag.

Returns: TimeInForce.

GetPreferredLanguage
public static string GetPreferredLanguage(MessageAdapterCategories? categories)
result = Extensions.GetPreferredLanguage(categories)

Get preferred language.

categories
Message adapter categories.

Returns: Language

GetPrice
public static decimal? GetPrice(IOrderBookMessage message, Sides? side)
result = Extensions.GetPrice(message, side)

Get price by side.

message
IOrderBookMessage
side
Sides

Returns: Price.

GetPriceStep
public static decimal GetPriceStep(int decimals)
result = Extensions.GetPriceStep(decimals)

To get the price increment on the basis of accuracy.

decimals
Decimals.

Returns: Price step.

GetProcessorType
public static Type GetProcessorType(IBasketSecurityProcessorProvider provider, string basketCode)
result = Extensions.GetProcessorType(provider, basketCode)

Get processor type.

provider
IBasketSecurityProcessorProvider
basketCode
Basket security type.

Returns: Processor type.

GetSecurityType
public static Type GetSecurityType(IBasketSecurityProcessorProvider provider, string basketCode)
result = Extensions.GetSecurityType(provider, basketCode)

Get security type.

provider
IBasketSecurityProcessorProvider
basketCode
Basket security type.

Returns: Security type.

GetSecurityTypes
public static HashSet<SecurityTypes> GetSecurityTypes(ISecurityTypesMessage message)
result = Extensions.GetSecurityTypes(message)

Get SecurityTypes.

message
Message security lookup for specified criteria.

Returns: Securities types.

GetServerTime
public static DateTime GetServerTime(Message message)
result = Extensions.GetServerTime(message)

Get message server time.

message
Message.

Returns: Server time.

GetSpreadMiddle
public static decimal? GetSpreadMiddle(decimal? bestBidPrice, decimal? bestAskPrice, decimal? priceStep)
result = Extensions.GetSpreadMiddle(bestBidPrice, bestAskPrice, priceStep)

Get middle of spread.

bestBidPrice
Best bid price.
bestAskPrice
Best ask price.
priceStep
PriceStep

Returns: The middle of spread. Is , if quotes are empty.

GetSpreadMiddle
public static decimal GetSpreadMiddle(decimal bestBidPrice, decimal bestAskPrice, decimal? priceStep)
result = Extensions.GetSpreadMiddle(bestBidPrice, bestAskPrice, priceStep)

Get middle of spread.

bestBidPrice
Best bid price.
bestAskPrice
Best ask price.
priceStep
PriceStep

Returns: The middle of spread. Is , if quotes are empty.

GetSpreadMiddle
public static decimal? GetSpreadMiddle(IOrderBookMessage message, decimal? priceStep)
result = Extensions.GetSpreadMiddle(message, priceStep)

Get middle of spread.

message
Market depth.
priceStep
PriceStep

Returns: The middle of spread. Is , if quotes are empty.

GetSpreadMiddle
public static decimal? GetSpreadMiddle(Level1ChangeMessage message, decimal? priceStep)
result = Extensions.GetSpreadMiddle(message, priceStep)

Get middle of spread.

message
Market depth.
priceStep
PriceStep

Returns: The middle of spread. Is , if quotes are empty.

GetSubscriptionIds
public static long[] GetSubscriptionIds(ISubscriptionIdMessage message)
result = Extensions.GetSubscriptionIds(message)

Get subscription identifiers from the specified message.

message
Message.

Returns: Identifiers.

GetTimeFrame
public static TimeSpan GetTimeFrame(MarketDataMessage mdMsg)
result = Extensions.GetTimeFrame(mdMsg)

Get time-frame from the specified market-data message.

mdMsg
Market-data message (uses as a subscribe/unsubscribe in outgoing case, confirmation event in incoming case).

Returns: Time-frame.

GetTimeFrame
public static TimeSpan GetTimeFrame(DataType dataType)
result = Extensions.GetTimeFrame(dataType)

Get time-frame.

dataType
DataType.

Returns: Time-frame.

GetTimeFrameCount
public static long GetTimeFrameCount(Range<DateTime> range, TimeSpan timeFrame, WorkingTime workingTime)
result = Extensions.GetTimeFrameCount(range, timeFrame, workingTime)

To get the number of time frames within the specified time range.

range
The specified time range for which you need to get the number of time frames.
timeFrame
The time frame size.
workingTime
WorkingTime.

Returns: The received number of time frames.

GetTimeFrames
public static IEnumerable<TimeSpan> GetTimeFrames(IMessageAdapter adapter, SecurityId securityId, DateTime? from, DateTime? to)
result = Extensions.GetTimeFrames(adapter, securityId, from, to)

Get possible time-frames for the specified instrument.

adapter
Trading system adapter.
securityId
Security ID.
from
The initial date from which you need to get data.
to
The final date by which you need to get data.

Returns: Possible time-frames.

GetTimeFramesAsync
public static IAsyncEnumerable<TimeSpan> GetTimeFramesAsync(IMessageAdapter adapter, SecurityId securityId, DateTime? from, DateTime? to)
result = Extensions.GetTimeFramesAsync(adapter, securityId, from, to)

Get possible time-frames for the specified instrument.

adapter
Trading system adapter.
securityId
Security ID.
from
The initial date from which you need to get data.
to
The final date by which you need to get data.

Returns: Possible time-frames.

GetTopPairs
public static IEnumerable<ValueTuple<QuoteChange?, QuoteChange?>> GetTopPairs(IOrderBookMessage book, int depth)
result = Extensions.GetTopPairs(book, depth)

To get a pair of quotes for a given book depth.

book
IOrderBookMessage
depth
Book depth. The counting is from the best quotes.

Returns: Spread.

GetTopQuotes
public static IEnumerable<QuoteChange> GetTopQuotes(IOrderBookMessage book, int depth)
result = Extensions.GetTopQuotes(book, depth)

To get quotes for a given book depth.

book
IOrderBookMessage
depth
Book depth. Quotes are in order of price increasing from bids to offers.

Returns: Spread.

GetTradePrice
public static decimal GetTradePrice(ExecutionMessage message)
result = Extensions.GetTradePrice(message)

Get TradePrice.

message
The message contains information about the execution.

Returns: Trade price.

GetTradeVolume
public static decimal GetTradeVolume(ExecutionMessage message)
result = Extensions.GetTradeVolume(message)

Get TradeVolume.

message
The message contains information about the execution.

Returns: Trade volume.

GetTypicalPrice
public static decimal GetTypicalPrice(ICandleMessage candle)
result = Extensions.GetTypicalPrice(candle)

Calculate typical price of candle.

candle
ICandleMessage

Returns: Typical price.

GetUnderlyingCode
public static string GetUnderlyingCode(SecurityMessage secMsg)
result = Extensions.GetUnderlyingCode(secMsg)

Get underlying asset.

secMsg
SecurityMessage

Returns: Underlying asset.

Group
public static QuoteChangeMessage Group(IOrderBookMessage depth, decimal priceRange)
result = Extensions.Group(depth, priceRange)

To group the order book by the price range.

depth
The order book to be grouped.
priceRange
The price range, for which grouping shall be performed.

Returns: The grouped order book.

Group
public static QuoteChange[] Group(QuoteChange[] quotes, Sides side, decimal priceRange)
result = Extensions.Group(quotes, side, priceRange)

To group quotes by the price range.

quotes
Quotes to be grouped.
side
Side.
priceRange
The price range, for which grouping shall be performed.

Returns: Grouped quotes.

HasChanges``2
public static bool HasChanges<TMessage, TChange>(BaseChangeMessage<TMessage, TChange> message)
result = Extensions.HasChanges(message)

Determines the message contains any changes.

message
Change message.

Returns: Check result.

HasOrderId
public static bool HasOrderId(OrderStatusMessage message)
result = Extensions.HasOrderId(message)

Determines the specified message contains single order request.

message
Message.

Returns: Check result.

HasOrderInfo
public static bool HasOrderInfo(ExecutionMessage message)
result = Extensions.HasOrderInfo(message)

Determines whether the specified message contains order information.

message
The message.

Returns: if the specified message contains order information, otherwise, .

HasSubscriptionId
public static bool HasSubscriptionId(ISubscriptionIdMessage message)
result = Extensions.HasSubscriptionId(message)

Check subscription identifiers in the specified message.

message
Message.

Returns: Identifiers.

HasTradeInfo
public static bool HasTradeInfo(ExecutionMessage message)
result = Extensions.HasTradeInfo(message)

Determines whether the specified message contains trade information.

message
The message.

Returns: if the specified message contains trade information, otherwise, .

Invert
public static Sides Invert(Sides side)
result = Extensions.Invert(side)

To change the direction to opposite.

side
The initial direction.

Returns: The opposite direction.

IsAllSecurity
public static bool IsAllSecurity(ISecurityIdMessage message)
result = Extensions.IsAllSecurity(message)

Check if the specified ISecurityIdMessage is SecurityId).

message
ISecurityIdMessage

Returns: , if the specified ISecurityIdMessage is SecurityId), otherwise, .

IsAllSecurity
public static bool IsAllSecurity(SecurityId securityId)
result = Extensions.IsAllSecurity(securityId)

Check if the specified SecurityId is SecurityId).

securityId
SecurityId

Returns: , if the specified SecurityId is SecurityId), otherwise, .

IsAssociated
public static bool IsAssociated(SecurityId securityId, string boardCode)
result = Extensions.IsAssociated(securityId, boardCode)

Is specified security id associated with the board.

securityId
Security ID.
boardCode
Board code.

Returns: , if associated, otherwise, .

IsBack
public static bool IsBack(IMessage message)
result = Extensions.IsBack(message)

Determines the specified message is loopback.

message
Message.

Returns: Is loopback message.

IsBasket
public static bool IsBasket(SecurityMessage security)
result = Extensions.IsBasket(security)

Is specified security is basket.

security
Security.

Returns: Check result.

IsBestAskField
public static bool IsBestAskField(Level1Fields field)
result = Extensions.IsBestAskField(field)

Is the specified Level1Fields is related to best ask.

field
Field.

Returns: Check result.

IsBestBidField
public static bool IsBestBidField(Level1Fields field)
result = Extensions.IsBestBidField(field)

Is the specified Level1Fields is related to best bid.

field
Field.

Returns: Check result.

IsBuildOnly
public static bool IsBuildOnly(Type candleType)
result = Extensions.IsBuildOnly(candleType)

Determines whether the specified candle type can build only from underlying data.

candleType
The type of candle message.

Returns: Check result.

IsCanceled
public static bool IsCanceled(IOrderMessage order)
result = Extensions.IsCanceled(order)

To check, whether the order was cancelled.

order
The order to be checked.

Returns: , if the order is cancelled, otherwise, .

IsCandle
public static bool IsCandle(MessageTypes type)
result = Extensions.IsCandle(type)

Determine the is candle data type.

type
Message type.

Returns: , if data type is candle, otherwise, .

IsCandleMessage
public static bool IsCandleMessage(Type messageType)
result = Extensions.IsCandleMessage(messageType)

Determines whether the specified message type is derived from CandleMessage.

messageType
The message type.

Returns: if the specified message type is derived from CandleMessage, otherwise, .

IsCandlesSupportedAsync
public static ValueTask<bool> IsCandlesSupportedAsync(IMessageAdapter adapter, MarketDataMessage subscription, CancellationToken cancellationToken)
result = Extensions.IsCandlesSupportedAsync(adapter, subscription, cancellationToken)

Determines whether the specified subscription request is supported by the adapter.

adapter
Adapter.
subscription
Subscription.
cancellationToken
CancellationToken

Returns: if the specified subscription request is supported, otherwise, .

IsContainsCandle
public static bool IsContainsCandle(Level1ChangeMessage level1)
result = Extensions.IsContainsCandle(level1)

To check, are there IsCandles in the level1 data.

level1
Level1 data.

Returns: The test result.

IsContainsQuotes
public static bool IsContainsQuotes(Level1ChangeMessage level1)
result = Extensions.IsContainsQuotes(level1)

To check, are there quotes in the level1.

level1
Level1 data.

Returns: Quotes.

IsContainsTick
public static bool IsContainsTick(Level1ChangeMessage level1)
result = Extensions.IsContainsTick(level1)

To check, are there tick data in the level1 data.

level1
Level1 data.

Returns: The test result.

IsFinal
public static bool IsFinal(OrderStates state)
result = Extensions.IsFinal(state)

Is the specified state is final (Done or Failed).

state
Order state.

Returns: Check result.

IsFinal
public static bool IsFinal(IOrderBookMessage depth)
result = Extensions.IsFinal(depth)

Determine whether the order book is final.

depth
Order book message.

Returns: , if the order book is final, otherwise .

IsFullEmpty
public static bool IsFullEmpty(IOrderBookMessage depth)
result = Extensions.IsFullEmpty(depth)

To determine, is the order book empty.

depth
Market depth.

Returns: , if order book is empty, otherwise, .

IsHalfEmpty
public static bool IsHalfEmpty(IOrderBookMessage depth)
result = Extensions.IsHalfEmpty(depth)

To determine, is the order book half-empty.

depth
Market depth.

Returns: , if the order book is half-empty, otherwise, .

IsHistoryOnly
public static bool IsHistoryOnly(ISubscriptionMessage message)
result = Extensions.IsHistoryOnly(message)

Determines the specified message contains historical request only.

message
Subscription.

Returns: Check result.

IsIndex
public static bool IsIndex(SecurityMessage security)
result = Extensions.IsIndex(security)

Is specified security is index.

security
Security.

Returns: Check result.

IsIntraday
public static bool IsIntraday(TimeSpan tf)
result = Extensions.IsIntraday(tf)

Determines the specified time-frame is intraday.

tf
Time-frame.

Returns: Check result.

IsLastTradeField
public static bool IsLastTradeField(Level1Fields field)
result = Extensions.IsLastTradeField(field)

Is the specified Level1Fields is related to last trade.

field
Field.

Returns: Check result.

IsLookup
public static bool IsLookup(MessageTypes type)
result = Extensions.IsLookup(type)

Determines the specified message type is lookup.

type
MessageTypes

Returns: Check result.

IsLookup
public static bool IsLookup(IMessage message)
result = Extensions.IsLookup(message)

Determines the specified message is lookup.

message
Message

Returns: Check result.

IsLookupAll
public static bool IsLookupAll(SecurityLookupMessage criteria)
result = Extensions.IsLookupAll(criteria)

Determine the contains lookup all filter.

criteria
The instrument whose fields will be used as a filter.

Returns: Check result.

IsMarketData
public static bool IsMarketData(ExecutionMessage execMsg)
result = Extensions.IsMarketData(execMsg)

Determines whether the contains market-data info.

execMsg
The message contains information about the execution.

Returns: Check result.

IsMarketData
public static bool IsMarketData(IMessageAdapter adapter)
result = Extensions.IsMarketData(adapter)

Is the specified adapter support market-data.

adapter
Adapter.

Returns: Check result.

IsMarketDataTypeSupportedAsync
public static ValueTask<bool> IsMarketDataTypeSupportedAsync(IMessageAdapter adapter, DataType type, CancellationToken cancellationToken)
result = Extensions.IsMarketDataTypeSupportedAsync(adapter, type, cancellationToken)

Determines whether the specified market-data type is supported by the adapter.

adapter
Adapter.
type
Message type.
cancellationToken
CancellationToken

Returns: if the specified message type is supported, otherwise, .

IsMatch
public static bool IsMatch(ExecutionMessage transaction, OrderStatusMessage criteria, ISet<OrderStates> states)
result = Extensions.IsMatch(transaction, criteria, states)

Determines the specified transaction is matched lookup criteria.

transaction
Transaction.
criteria
The order which fields will be used as a filter.
states
Filter order by the specified states.

Returns: Check result.

IsMatch
public static bool IsMatch(SecurityMessage security, SecurityLookupMessage criteria, HashSet<SecurityTypes> secTypes)
result = Extensions.IsMatch(security, criteria, secTypes)

Determines the specified security is matched lookup criteria.

security
Security.
criteria
Message security lookup for specified criteria.
secTypes
Securities types.

Returns: Check result.

IsMatch
public static bool IsMatch(SecurityMessage security, SecurityLookupMessage criteria)
result = Extensions.IsMatch(security, criteria)

Determines the specified security is matched lookup criteria.

security
Security.
criteria
Message security lookup for specified criteria.

Returns: Check result.

IsMatch
public static bool IsMatch(ExecutionMessage transaction, OrderStatusMessage criteria)
result = Extensions.IsMatch(transaction, criteria)

Determines the specified message is matched lookup criteria.

transaction
Transaction.
criteria
The message which fields will be used as a filter.

Returns: Check result.

IsMatch
public static bool IsMatch(PositionChangeMessage position, PortfolioLookupMessage criteria, bool compareName)
result = Extensions.IsMatch(position, criteria, compareName)

Determines the specified message is matched lookup criteria.

position
Position.
criteria
The message which fields will be used as a filter.
compareName
Fully compare PortfolioName.

Returns: Check result.

IsMatch
public static bool IsMatch(PortfolioMessage portfolio, PortfolioLookupMessage criteria, bool compareName)
result = Extensions.IsMatch(portfolio, criteria, compareName)

Determines the specified message is matched lookup criteria.

portfolio
Portfolio.
criteria
The message which fields will be used as a filter.
compareName
Fully compare PortfolioName.

Returns: Check result.

IsMatch
public static bool IsMatch(BoardMessage board, BoardLookupMessage criteria)
result = Extensions.IsMatch(board, criteria)

Determines the specified message is matched lookup criteria.

board
Board.
criteria
The message which fields will be used as a filter.

Returns: Check result.

IsMatch
public static bool IsMatch(ISubscriptionIdMessage message, MessageTypes type, ISubscriptionMessage criteria)
result = Extensions.IsMatch(message, type, criteria)

Determines the specified message is matched lookup criteria.

message
Message.
type
Type
criteria
The message which fields will be used as a filter.

Returns: Check result.

IsMatched
public static bool IsMatched(IOrderMessage order)
result = Extensions.IsMatched(order)

To check, is the order matched completely.

order
The order to be checked.

Returns: , if the order is matched completely, otherwise, .

IsMatchedEmpty
public static bool IsMatchedEmpty(IOrderMessage order)
result = Extensions.IsMatchedEmpty(order)

To check, if no contract in order is implemented.

order
The order to be checked.

Returns: , if no contract is implemented, otherwise, .

IsMatchedPartially
public static bool IsMatchedPartially(IOrderMessage order)
result = Extensions.IsMatchedPartially(order)

To check, is a part of volume is implemented in the order.

order
The order to be checked.

Returns: , if part of volume is implemented, otherwise, .

IsMessageSupported
public static bool IsMessageSupported(IMessageAdapter adapter, MessageTypes type)
result = Extensions.IsMessageSupported(adapter, type)

Determines whether the specified message type is contained in SupportedInMessages.

adapter
Adapter.
type
Message type.

Returns: if the specified message type is supported, otherwise, .

IsMoney
public static bool IsMoney(SecurityId secId)
result = Extensions.IsMoney(secId)

Check if the specified id is money id.

secId
The message contains information about the position changes.

Returns: Check result.

IsMoney
public static bool IsMoney(PositionChangeMessage posMsg)
result = Extensions.IsMoney(posMsg)

Determines the specified message contains Money position.

posMsg
The message contains information about the position changes.

Returns: Check result.

IsNotSupported
public static bool IsNotSupported(SubscriptionResponseMessage message)
result = Extensions.IsNotSupported(message)

Determines whether the reply contains the error NotSupported.

message
Reply.

Returns: Check result.

Iso10962
public static string Iso10962(SecurityMessage security)
result = Extensions.Iso10962(security)

To get the type for the instrument in the ISO 10962 standard.

security
Security.

Returns: Type in ISO 10962 standard.

Iso10962ToOptionType
public static OptionTypes? Iso10962ToOptionType(string cfi)
result = Extensions.Iso10962ToOptionType(cfi)

To convert the type in the ISO 10962 standard into OptionTypes.

cfi
Type in ISO 10962 standard.

Returns: Option type.

Iso10962ToSecurityType
public static SecurityTypes? Iso10962ToSecurityType(string cfi)
result = Extensions.Iso10962ToSecurityType(cfi)

To convert the type in the ISO 10962 standard into SecurityTypes.

cfi
Type in ISO 10962 standard.

Returns: Security type.

IsObsolete
public static bool IsObsolete(Level1Fields field)
result = Extensions.IsObsolete(field)

Is the specified Level1Fields was obsolete.

field
Level1Fields value.

Returns: , if obsolete, otherwise, not obsolete.

IsObsolete
public static bool IsObsolete(PositionChangeTypes type)
result = Extensions.IsObsolete(type)

Is the specified PositionChangeTypes was marked by ObsoleteAttribute.

type
PositionChangeTypes value.

Returns: , if obsolete, otherwise, not obsolete.

IsOk
public static bool IsOk(IErrorMessage message)
result = Extensions.IsOk(message)

Determines whether the reply contains an error Error.

message
IErrorMessage

Returns: Check result.

IsOpened
public static bool IsOpened(IMessageChannel channel)
result = Extensions.IsOpened(channel)

Is channel opened.

channel
Message channel.

Returns: Check result.

IsOrderLogCanceled
public static bool IsOrderLogCanceled(ExecutionMessage item)
result = Extensions.IsOrderLogCanceled(item)

To check, does the string contain the cancelled order.

item
Order log item.

Returns: , if the string contain the cancelled order, otherwise, .

IsOrderLogMatched
public static bool IsOrderLogMatched(ExecutionMessage item)
result = Extensions.IsOrderLogMatched(item)

To check, does the string contain the order matching.

item
Order log item.

Returns: , if the string contains order matching, otherwise, .

IsOrderLogRegistered
public static bool IsOrderLogRegistered(ExecutionMessage item)
result = Extensions.IsOrderLogRegistered(item)

To check, does the string contain the order registration.

item
Order log item.

Returns: , if the string contains the order registration, otherwise, .

IsPlazaSystem
public static bool IsPlazaSystem(long status)
result = Extensions.IsPlazaSystem(status)

Extract system attribute from the bits flag.

status
Bits flag.

Returns: if an order is system, otherwise, .

IsResultMessageNotSupported
public static bool IsResultMessageNotSupported(IMessageAdapter adapter, MessageTypes type)
result = Extensions.IsResultMessageNotSupported(adapter, type)

Determines whether the specified message type is contained in NotSupportedResultMessages..

adapter
Adapter.
type
Message type.

Returns: if the specified message type is supported, otherwise, .

IsSet
public static bool IsSet(Unit value)
result = Extensions.IsSet(value)

Determines the value is set.

value
Unit

Returns: Check result.

IsStorageSupported
public static bool IsStorageSupported(DataType dataType)
result = Extensions.IsStorageSupported(dataType)

Determines whether the specified data type is supported by the storage.

dataType
DataType

Returns: Check result.

IsSupportSecuritiesLookupAll
public static bool IsSupportSecuritiesLookupAll(IMessageAdapter adapter)
result = Extensions.IsSupportSecuritiesLookupAll(adapter)

Support lookup all securities.

adapter
Adapter.

Returns: Check result.

IsSupportStopLoss
public static bool IsSupportStopLoss(IMessageAdapter adapter)
result = Extensions.IsSupportStopLoss(adapter)

Determines whether the adapter support stop-loss orders.

adapter
Adapter.

Returns: Check result.

IsSupportTakeProfit
public static bool IsSupportTakeProfit(IMessageAdapter adapter)
result = Extensions.IsSupportTakeProfit(adapter)

Determines whether the adapter support take-profit orders.

adapter
Adapter.

Returns: Check result.

IsSupportWithdraw
public static bool IsSupportWithdraw(IMessageAdapter adapter)
result = Extensions.IsSupportWithdraw(adapter)

Determines whether the adapter support withdraw orders.

adapter
Adapter.

Returns: Check result.

IsToday
public static bool IsToday(DateTime date)
result = Extensions.IsToday(date)

To check the specified date is today.

date
The specified date.

Returns: if the specified date is today, otherwise, .

IsToday
public static bool IsToday(DateTime? date)
result = Extensions.IsToday(date)

To check the specified date is today.

date
The specified date.

Returns: if the specified date is today, otherwise, .

IsTransactional
public static bool IsTransactional(IMessageAdapter adapter)
result = Extensions.IsTransactional(adapter)

Is the specified adapter support transactions.

adapter
Adapter.

Returns: Check result.

IsWorkingDate
public static bool IsWorkingDate(BoardMessage board, DateTime date, bool checkHolidays)
result = Extensions.IsWorkingDate(board, date, checkHolidays)

To check, whether date is traded.

board
Board info.
date
The passed date to be checked.
checkHolidays
Whether to check the passed date for a weekday (Saturday and Sunday are days off, returned value for them is ).

Returns: , if the date is traded, otherwise, is not traded.

IsWorkingTime
public static bool IsWorkingTime(BoardMessage board, DateTime time, bool? isWorkingDay, WorkingTimePeriod period)
result = Extensions.IsWorkingTime(board, time, isWorkingDay, period)

To check, whether the time is traded (has the session started, ended, is there a clearing).

board
Board info.
time
The passed time to be checked.
isWorkingDay
, if the date is traded, otherwise, is not traded.
period
Current working time period.

Returns: , if time is traded, otherwise, not traded.

IsWorkingTime
public static bool IsWorkingTime(BoardMessage board, DateTime time)
result = Extensions.IsWorkingTime(board, time)

To check, whether the time is traded (has the session started, ended, is there a clearing).

board
Board info.
time
The passed time to be checked.

Returns: , if time is traded, otherwise, not traded.

Join
public static QuoteChangeMessage Join(IOrderBookMessage original, IOrderBookMessage rare)
result = Extensions.Join(original, rare)

To merge the initial order book and its sparse representation.

original
The initial order book.
rare
The sparse order book.

Returns: The merged order book.

LastTradeDay
public static DateTime LastTradeDay(BoardMessage board, DateTime date, bool checkHolidays)
result = Extensions.LastTradeDay(board, date, checkHolidays)

Get last trade date.

board
Board info.
date
The date from which to start checking.
checkHolidays
Whether to check the passed date for a weekday (Saturday and Sunday are days off, returned value for them is ).

Returns: Last trade date.

LookupByCode
public static IEnumerable<SecurityMessage> LookupByCode(ISecurityMessageProvider provider, string code, SecurityTypes? type)
result = Extensions.LookupByCode(provider, code, type)

To get the instrument by the instrument code.

provider
The provider of information about instruments.
code
Security code.
type
Security type.

Returns: The got instrument. If there is no instrument by given criteria, is returned.

LookupByCodeAsync
public static IAsyncEnumerable<SecurityMessage> LookupByCodeAsync(ISecurityMessageProvider provider, string code, SecurityTypes? type)
result = Extensions.LookupByCodeAsync(provider, code, type)

To get the instrument by the instrument code.

provider
The provider of information about instruments.
code
Security code.
type
Security type.

Returns: The got instrument. If there is no instrument by given criteria, is returned.

LookupMessageById
public static SecurityMessage LookupMessageById(ISecurityMessageProvider provider, SecurityId id)
result = Extensions.LookupMessageById(provider, id)

To get the instrument by the identifier.

provider
ISecurityMessageProvider
id
Security ID.

Returns: The got instrument. If there is no instrument by given criteria, is returned.

LookupMessages
public static IEnumerable<SecurityMessage> LookupMessages(ISecurityMessageProvider provider, SecurityLookupMessage criteria)
result = Extensions.LookupMessages(provider, criteria)

Lookup securities by criteria .

provider
ISecurityMessageProvider
criteria
Message security lookup for specified criteria.

Returns: Found instruments.

LoopBack``1
public static TMessage LoopBack<TMessage>(TMessage message, IMessageAdapter adapter, MessageBackModes mode)
result = Extensions.LoopBack(message, adapter, mode)

Made the specified message as BackMode.

message
Message.
adapter
Adapter.
mode
Back mode.

Returns: Message.

MakeVectorIconUri
public static Uri MakeVectorIconUri(string key)
result = Extensions.MakeVectorIconUri(key)

get icon uri

NearestSupportedDepth
public static int? NearestSupportedDepth(IMessageAdapter adapter, int depth)
result = Extensions.NearestSupportedDepth(adapter, depth)

Get the nearest supported depth for the specified.

adapter
Adapter.
depth
Depth.

Returns: Supported depth.

PnF
public static DataType PnF(PnFArg arg)
result = Extensions.PnF(arg)

Create data type info for PnFCandleMessage.

arg
Candle arg.

Returns: Data type info.

Portfolio
public static DataType Portfolio(string portfolioName)
result = Extensions.Portfolio(portfolioName)

Create data type info for PortfolioMessage.

portfolioName
Portfolio name.

Returns: Data type info.

Range
public static DataType Range(Unit arg)
result = Extensions.Range(arg)

Create data type info for RangeCandleMessage.

arg
Candle arg.

Returns: Data type info.

RegisterCandleType``1
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)
Extensions.RegisterCandleType(messageType, type, fileName, argParse, argToString, argValidator, isBuildOnly)

Register new candle type.

messageType
The type of candle message.
type
Message type.
fileName
File name.
argParse
String to converter.
argToString
to String converter.
argValidator
Arg validator.
isBuildOnly
The candle type can build only from underlying data.
RemoveMarketDataSupport
public static void RemoveMarketDataSupport(MessageAdapter adapter)
Extensions.RemoveMarketDataSupport(adapter)

Remove from SupportedInMessages message types related to market-data.

adapter
Adapter.
RemoveNotSupportedResultMessage
public static void RemoveNotSupportedResultMessage(MessageAdapter adapter, MessageTypes type)
Extensions.RemoveNotSupportedResultMessage(adapter, type)

Remove the message type from NotSupportedResultMessages.

adapter
Adapter.
type
Message type.
RemoveSupportedAllMarketDataTypes
public static void RemoveSupportedAllMarketDataTypes(MessageAdapter adapter)
Extensions.RemoveSupportedAllMarketDataTypes(adapter)

Remove all market data types from DateTime}).

adapter
Adapter.
RemoveSupportedMarketDataType
public static void RemoveSupportedMarketDataType(MessageAdapter adapter, DataType type)
Extensions.RemoveSupportedMarketDataType(adapter, type)

Remove market data type from DateTime}).

adapter
Adapter.
type
Market data type.
RemoveSupportedMessage
public static void RemoveSupportedMessage(MessageAdapter adapter, MessageTypes type)
Extensions.RemoveSupportedMessage(adapter, type)

Remove the message type from PossibleSupportedMessages.

adapter
Adapter.
type
Message type.
RemoveTransactionalSupport
public static void RemoveTransactionalSupport(MessageAdapter adapter)
Extensions.RemoveTransactionalSupport(adapter)

Remove from SupportedInMessages message types related to transactional.

adapter
Adapter.
Renko
public static DataType Renko(Unit arg)
result = Extensions.Renko(arg)

Create data type info for RenkoCandleMessage.

arg
Candle arg.

Returns: Data type info.

ReplaceSecurityId
public static Message ReplaceSecurityId(Message message, SecurityId securityId)
result = Extensions.ReplaceSecurityId(message, securityId)

Replace security id by the specified.

message
Message.
securityId
Security ID.

Returns: Message.

SafeGetOrderId
public static long SafeGetOrderId(ExecutionMessage message)
result = Extensions.SafeGetOrderId(message)

To get order identifier, or discard exception, if no information available.

message
Operations.

Returns: Order ID.

SafeGetVolume
public static decimal SafeGetVolume(ExecutionMessage message)
result = Extensions.SafeGetVolume(message)

To get the number of operations, or discard the exception, if no information available.

message
Operations.

Returns: Quantity.

SetId``1
public static void SetId<T>(CommandMessage message, T id)
Extensions.SetId(message, id)

Set typed ObjectId.

message
CommandMessage.
id
Typed ObjectId.
SetNativeId
public static SecurityId SetNativeId(SecurityId secId, object nativeId)
result = Extensions.SetNativeId(secId, nativeId)

Initialize Native.

secId
Security ID.
nativeId
Native (internal) trading system security id.

Returns: Security ID.

SetSecurityCode
public static void SetSecurityCode(SecurityMessage message, string secCode)
Extensions.SetSecurityCode(message, secCode)

Initialize SecurityCode.

message
A message containing info about the security.
secCode
Security code.
SetSecurityTypes
public static void SetSecurityTypes(ISecurityTypesMessage message, SecurityTypes? type, IEnumerable<SecurityTypes> types)
Extensions.SetSecurityTypes(message, type, types)

Initialize SecurityTypes.

message
Message security lookup for specified criteria.
type
Security type.
types
Securities types.
SetSubscriptionIds``1
public static TMessage SetSubscriptionIds<TMessage>(TMessage message, long[] subscriptionIds, long subscriptionId)
result = Extensions.SetSubscriptionIds(message, subscriptionIds, subscriptionId)

Set subscription identifiers into the specified message.

message
Message.
subscriptionIds
Identifiers.
subscriptionId
Identifier.

Returns: Message.

ShrinkPrice
public static decimal ShrinkPrice(decimal price, decimal? priceStep, int? decimals, ShrinkRules rule)
result = Extensions.ShrinkPrice(price, priceStep, decimals, rule)

To cut the price, to make it multiple of minimal step, also to limit number of signs after the comma.

price
The price to be made multiple.
priceStep
Price step.
decimals
Number of digits in price after coma.
rule

Returns: The multiple price.

ShrinkPrice
public static decimal ShrinkPrice(decimal price, SecurityMessage secMsg, ShrinkRules rule)
result = Extensions.ShrinkPrice(price, secMsg, rule)

To cut the price, to make it multiple of minimal step, also to limit number of signs after the comma.

price
The price to be made multiple.
secMsg
SecurityMessage
rule

Returns: The multiple price.

Sparse
public static ValueTuple<QuoteChange[], QuoteChange[]> Sparse(QuoteChange bid, QuoteChange ask, decimal priceRange, decimal? priceStep, int maxDepth)
result = Extensions.Sparse(bid, ask, priceRange, priceStep, maxDepth)

To create form pair of quotes a sparse collection of quotes, which will be included into the range between the pair.

bid
Bid.
ask
Ask.
priceRange
Minimum price step.
priceStep
Security price step.
maxDepth
Max depth.

Returns: The sparse collection of quotes.

Sparse
public static QuoteChange[] Sparse(QuoteChange[] quotes, Sides side, decimal priceRange, decimal? priceStep, int maxDepth)
result = Extensions.Sparse(quotes, side, priceRange, priceStep, maxDepth)

To create the sparse collection of quotes from regular quotes.

quotes
Regular quotes. The collection shall contain quotes of the same direction (only bids or only offers).
side
Side.
priceRange
Minimum price step.
priceStep
Security price step.
maxDepth
Max depth.

Returns: The sparse collection of quotes.

Sparse
public static QuoteChangeMessage Sparse(IOrderBookMessage depth, decimal priceRange, decimal? priceStep, int maxDepth)
result = Extensions.Sparse(depth, priceRange, priceStep, maxDepth)

To create from regular order book a sparse one.

depth
The regular order book.
priceRange
Minimum price step.
priceStep
Security price step.
maxDepth
Max depth.

Returns: The sparse order book.

SplitToPair
public static ValueTuple<string, string> SplitToPair(string symbol)
result = Extensions.SplitToPair(symbol)

Split to pair.

symbol
Symbol.

Returns: Pair.

Tick
public static DataType Tick(int arg)
result = Extensions.Tick(arg)

Create data type info for TickCandleMessage.

arg
Candle arg.

Returns: Data type info.

TimeFrame
public static DataType TimeFrame(TimeSpan tf)
result = Extensions.TimeFrame(tf)

Create data type info for TimeFrameCandleMessage.

tf
Candle arg.

Returns: Data type info.

ToCandleMessage
public static Type ToCandleMessage(MessageTypes type)
result = Extensions.ToCandleMessage(type)

Cast candle type MessageTypes to the message CandleMessage.

type
Candle type.

Returns: Message type CandleMessage.

ToCandleMessageType
public static Type ToCandleMessageType(MessageTypes type)
result = Extensions.ToCandleMessageType(type)

To convert the type of message MessageTypes into type of candles CandleMessage.

type
Message type.

Returns: Candles type.

ToDataType
public static DataType ToDataType(string type, string arg)
result = Extensions.ToDataType(type, arg)

Convert String to DataType value.

type
type.
arg
Arg.

Returns: Data type info.

ToDataType
public static DataType ToDataType(ExecutionTypes type)
result = Extensions.ToDataType(type)

Convert ExecutionTypes to DataType value.

type
ExecutionTypes.

Returns: DataType.

ToDataTypeArg
public static object ToDataTypeArg(Type messageType, string str)
result = Extensions.ToDataTypeArg(messageType, str)

To convert string representation of the candle argument into typified.

messageType
The type of candle message.
str
The string representation of the argument.

Returns: Argument.

ToErrorMessage
public static ErrorMessage ToErrorMessage(Exception error, long originalTransactionId)
result = Extensions.ToErrorMessage(error, originalTransactionId)

Convert error info into ErrorMessage.

error
Error info.
originalTransactionId
ID of the original message TransactionId for which this message is a response.

Returns: Error message.

ToErrorMessage
public static ErrorMessage ToErrorMessage(string description)
result = Extensions.ToErrorMessage(description)

Convert error text message to ErrorMessage instance.

description
Error text message.

Returns: ErrorMessage instance.

ToExec
public static ExecutionMessage ToExec(OrderRegisterMessage regMsg)
result = Extensions.ToExec(regMsg)

Convert OrderRegisterMessage to ExecutionMessage.

regMsg
The message containing the information for the order registration.

Returns: The message contains information about the execution.

ToExecutionType
public static ExecutionTypes ToExecutionType(DataType type)
result = Extensions.ToExecutionType(type)

Convert DataType to ExecutionTypes value.

type
DataType.

Returns: ExecutionTypes.

ToInfo
public static MessageTypeInfo ToInfo(MessageTypes type, bool? isMarketData)
result = Extensions.ToInfo(type, isMarketData)

Convert MessageTypes to MessageTypeInfo value.

type
MessageTypes value.
isMarketData
Market data.

Returns: MessageTypeInfo value.

ToLevel1
public static Level1ChangeMessage ToLevel1(IOrderBookMessage message)
result = Extensions.ToLevel1(message)

Convert IOrderBookMessage to Level1ChangeMessage value.

message
IOrderBookMessage instance.

Returns: Level1ChangeMessage instance.

ToLevel1
public static Level1ChangeMessage ToLevel1(ExecutionMessage message)
result = Extensions.ToLevel1(message)

Convert ExecutionMessage to Level1ChangeMessage value.

message
ExecutionMessage instance.

Returns: Level1ChangeMessage instance.

ToLevel1
public static IEnumerable<Level1ChangeMessage> ToLevel1(IEnumerable<QuoteChangeMessage> quotes)
result = Extensions.ToLevel1(quotes)

To build level1 from the order books.

quotes
Order books.

Returns: Level1.

ToLevel1
public static IEnumerable<Level1ChangeMessage> ToLevel1(IEnumerable<ExecutionMessage> items, IOrderLogMarketDepthBuilder builder, TimeSpan interval)
result = Extensions.ToLevel1(items, builder, interval)

To build level1 from the orders log.

items
Orders log lines.
builder
Order log to market depth builder.
interval
The interval of the order book generation. The default is Zero, which means order books generation at each new item of orders log.

Returns: Tick trades.

ToLevel1
public static IAsyncEnumerable<Level1ChangeMessage> ToLevel1(IAsyncEnumerable<QuoteChangeMessage> quotes)
result = Extensions.ToLevel1(quotes)

To build level1 from the order books.

quotes
Order books.

Returns: Level1.

ToLevel1
public static IAsyncEnumerable<Level1ChangeMessage> ToLevel1(IAsyncEnumerable<ExecutionMessage> items, IOrderLogMarketDepthBuilder builder, TimeSpan interval)
result = Extensions.ToLevel1(items, builder, interval)

To build level1 from the orders log.

items
Orders log lines.
builder
Order log to market depth builder.
interval
The interval of the order book generation. The default is Zero, which means order books generation at each new item of orders log.

Returns: Tick trades.

ToLevel1
public static Level1ChangeMessage ToLevel1(CandleMessage message)
result = Extensions.ToLevel1(message)

Convert CandleMessage to Level1ChangeMessage value.

message
CandleMessage instance.

Returns: Level1ChangeMessage instance.

ToMessage
public static Message ToMessage(ConnectionStates state)
result = Extensions.ToMessage(state)

Convert ConnectionStates to Message.

state
ConnectionStates value.

Returns: Message value.

ToMessageType
public static MessageTypes ToMessageType(Type type)
result = Extensions.ToMessageType(type)

Convert Type to MessageTypes value.

type
Type value.

Returns: MessageTypes value.

ToMessageType
public static Type ToMessageType(MessageTypes type)
result = Extensions.ToMessageType(type)

Convert MessageTypes to Type value.

type
MessageTypes value.

Returns: Type value.

ToMessageType
public static MessageTypes ToMessageType(string str)
result = Extensions.ToMessageType(str)

Convert String into MessageTypes.

str
String

Returns: MessageTypes

ToMessageType2
public static MessageTypes ToMessageType2(DataType type)
result = Extensions.ToMessageType2(type)

Convert DataType to MessageTypes value.

type
DataType value.

Returns: Message type.

ToMicexCurrencyName
public static string ToMicexCurrencyName(CurrencyTypes type)
result = Extensions.ToMicexCurrencyName(type)

To convert the currency type into the name in the MICEX format.

type
Currency type.

Returns: The currency name in the MICEX format.

ToNullableSecurityId
public static SecurityId ToNullableSecurityId(string id, SecurityIdGenerator generator)
result = Extensions.ToNullableSecurityId(id, generator)

Convert String to SecurityId value.

id
String value.
generator
The instrument identifiers generator SecurityId. Can be .

Returns: SecurityId value.

ToOrderBooks
public static IEnumerable<QuoteChangeMessage> ToOrderBooks(IEnumerable<Level1ChangeMessage> level1)
result = Extensions.ToOrderBooks(level1)

To convert level1 data into order books.

level1
Level1 data.

Returns: Market depths.

ToOrderBooks
public static IAsyncEnumerable<QuoteChangeMessage> ToOrderBooks(IAsyncEnumerable<Level1ChangeMessage> level1)
result = Extensions.ToOrderBooks(level1)

To convert level1 data into order books.

level1
Level1 data.

Returns: Market depths.

ToOrderBooks
public static IAsyncEnumerable<QuoteChangeMessage> ToOrderBooks(IAsyncEnumerable<ExecutionMessage> items, IOrderLogMarketDepthBuilder builder, TimeSpan interval, int maxDepth)
result = Extensions.ToOrderBooks(items, builder, interval, maxDepth)

Build market depths from order log.

items
Orders log lines.
builder
Order log to market depth builder.
interval
The interval of the order book generation. The default is Zero, which means order books generation at each new item of orders log.
maxDepth
The maximal depth of order book. The default is MaxValue, which means endless depth.

Returns: Market depths.

ToOrderBooks
public static IEnumerable<QuoteChangeMessage> ToOrderBooks(IEnumerable<ExecutionMessage> items, IOrderLogMarketDepthBuilder builder, TimeSpan interval, int maxDepth)
result = Extensions.ToOrderBooks(items, builder, interval, maxDepth)

Build market depths from order log.

items
Orders log lines.
builder
Order log to market depth builder.
interval
The interval of the order book generation. The default is Zero, which means order books generation at each new item of orders log.
maxDepth
The maximal depth of order book. The default is MaxValue, which means endless depth.

Returns: Market depths.

ToOrderSnapshot
public static ExecutionMessage ToOrderSnapshot(IEnumerable<ExecutionMessage> diffs, long transactionId, ILogReceiver logs)
result = Extensions.ToOrderSnapshot(diffs, transactionId, logs)

Convert order changes to final snapshot.

diffs
Changes.
transactionId
Transaction ID.
logs
Logs.

Returns: Snapshot.

ToReadableString
public static string ToReadableString(DataType dt)
result = Extensions.ToReadableString(dt)

Convert DataType to readable string.

dt
DataType instance.

Returns: Readable string.

ToReg
public static OrderRegisterMessage ToReg(ExecutionMessage execMsg)
result = Extensions.ToReg(execMsg)

Convert ExecutionMessage to OrderRegisterMessage.

execMsg
The message contains information about the execution.

Returns: The message containing the information for the order registration.

ToSecurityId
public static SecurityId ToSecurityId(string id, SecurityIdGenerator generator)
result = Extensions.ToSecurityId(id, generator)

Convert String to SecurityId value.

id
String value.
generator
The instrument identifiers generator SecurityId. Can be .

Returns: SecurityId value.

ToStringId
public static string ToStringId(SecurityId securityId, SecurityIdGenerator generator, bool nullIfEmpty)
result = Extensions.ToStringId(securityId, generator, nullIfEmpty)

Convert SecurityId to SecurityId value.

securityId
SecurityId value.
generator
The instrument identifiers generator SecurityId. Can be .
nullIfEmpty
Return if SecurityId is empty.

Returns: SecurityId value.

ToTick
public static ExecutionMessage ToTick(ExecutionMessage item)
result = Extensions.ToTick(item)

To tick trade from the order log.

item
Order log item.

Returns: Tick trade.

ToTick
public static ExecutionMessage ToTick(Level1ChangeMessage level1)
result = Extensions.ToTick(level1)

To convert level1 data into tick data.

level1
Level1 data.

Returns: Tick data.

ToTicks
public static IAsyncEnumerable<ExecutionMessage> ToTicks(IAsyncEnumerable<Level1ChangeMessage> level1)
result = Extensions.ToTicks(level1)

To convert level1 data into tick data.

level1
Level1 data.

Returns: Tick data.

ToTicks
public static IAsyncEnumerable<ExecutionMessage> ToTicks(IAsyncEnumerable<ExecutionMessage> items)
result = Extensions.ToTicks(items)

To build tick trades from the orders log.

items
Orders log lines.

Returns: Tick trades.

ToTicks
public static IEnumerable<ExecutionMessage> ToTicks(IEnumerable<ExecutionMessage> items)
result = Extensions.ToTicks(items)

To build tick trades from the orders log.

items
Orders log lines.

Returns: Tick trades.

ToTicks
public static IEnumerable<ExecutionMessage> ToTicks(IEnumerable<Level1ChangeMessage> level1)
result = Extensions.ToTicks(level1)

To convert level1 data into tick data.

level1
Level1 data.

Returns: Tick data.

ToType
public static Type ToType(PositionChangeTypes type)
result = Extensions.ToType(type)

Convert PositionChangeTypes to Type value.

type
PositionChangeTypes value.

Returns: Type value.

ToType
public static Type ToType(Level1Fields field)
result = Extensions.ToType(field)

Convert Level1Fields to Type value.

field
Level1Fields value.

Returns: Type value.

Truncate
public static QuoteChangeMessage Truncate(IOrderBookMessage depth, int maxDepth)
result = Extensions.Truncate(depth, maxDepth)

Truncate the specified order book by max depth value.

depth
Order book.
maxDepth
The maximum depth of order book.

Returns: Truncated order book.

TryAdd``2
public static TMessage TryAdd<TMessage, TChange>(TMessage message, TChange type, int? value, bool isZeroAcceptable)
result = Extensions.TryAdd(message, type, value, isZeroAcceptable)

To add a change to the collection, if value is other than 0 and .

message
Change message.
type
Change type.
value
Change value.
isZeroAcceptable
Is zero value is acceptable values.

Returns: Change message.

TryAdd``2
public static TMessage TryAdd<TMessage, TChange>(TMessage message, TChange type, string value)
result = Extensions.TryAdd(message, type, value)

To add a change to the collection, if value is other than .

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

TryAdd``2
public static TMessage TryAdd<TMessage, TChange>(TMessage message, TChange type, int value, bool isZeroAcceptable)
result = Extensions.TryAdd(message, type, value, isZeroAcceptable)

To add a change to the collection, if value is other than 0.

message
Change message.
type
Change type.
value
Change value.
isZeroAcceptable
Is zero value is acceptable values.

Returns: Change message.

TryAdd``2
public static TMessage TryAdd<TMessage, TChange>(TMessage message, TChange type, decimal? value, bool isZeroAcceptable)
result = Extensions.TryAdd(message, type, value, isZeroAcceptable)

To add a change to the collection, if value is other than 0 and .

message
Change message.
type
Change type.
value
Change value.
isZeroAcceptable
Is zero value is acceptable values.

Returns: Change message.

TryAdd``2
public static TMessage TryAdd<TMessage, TChange>(TMessage message, TChange type, decimal value, bool isZeroAcceptable)
result = Extensions.TryAdd(message, type, value, isZeroAcceptable)

To add a change to the collection, if value is other than 0.

message
Change message.
type
Change type.
value
Change value.
isZeroAcceptable
Is zero value is acceptable values.

Returns: Change message.

TryAdd``2
public static TMessage TryAdd<TMessage, TChange>(TMessage message, TChange type, bool? value)
result = Extensions.TryAdd(message, type, value)

To add a change to the collection, if value is other than .

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

TryAdd``2
public static TMessage TryAdd<TMessage, TChange>(TMessage message, TChange type, DateTime? value)
result = Extensions.TryAdd(message, type, value)

To add a change to the collection, if value is other than .

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

TryAdd``2
public static TMessage TryAdd<TMessage, TChange>(TMessage message, TChange type, PortfolioStates? value)
result = Extensions.TryAdd(message, type, value)

To add a change to the collection, if value is other than .

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

TryAdd``2
public static TMessage TryAdd<TMessage, TChange>(TMessage message, TChange type, CurrencyTypes? value)
result = Extensions.TryAdd(message, type, value)

To add a change to the collection, if value is other than .

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

TryAdd``2
public static TMessage TryAdd<TMessage, TChange>(TMessage message, TChange type, SecurityStates? value)
result = Extensions.TryAdd(message, type, value)

To add a change to the collection, if value is other than .

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

TryAdd``2
public static TMessage TryAdd<TMessage, TChange>(TMessage message, TChange type, Sides? value)
result = Extensions.TryAdd(message, type, value)

To add a change to the collection, if value is other than .

message
Change message.
type
Change type.
value
Change value.

Returns: Change message.

TryAdd``2
public static TMessage TryAdd<TMessage, TChange>(TMessage message, TChange type, long? value, bool isZeroAcceptable)
result = Extensions.TryAdd(message, type, value, isZeroAcceptable)

To add a change to the collection, if value is other than 0 and .

message
Change message.
type
Change type.
value
Change value.
isZeroAcceptable
Is zero value is acceptable values.

Returns: Change message.

TryAdd``2
public static TMessage TryAdd<TMessage, TChange>(TMessage message, TChange type, long value, bool isZeroAcceptable)
result = Extensions.TryAdd(message, type, value, isZeroAcceptable)

To add a change to the collection, if value is other than 0.

message
Change message.
type
Change type.
value
Change value.
isZeroAcceptable
Is zero value is acceptable values.

Returns: Change message.

TryFillUnderlyingId
public static SecurityMessage TryFillUnderlyingId(SecurityMessage secMsg, string underlyingCode)
result = Extensions.TryFillUnderlyingId(secMsg, underlyingCode)

Fill UnderlyingSecurityId property.

secMsg
SecurityMessage
underlyingCode
Underlying asset id.

Returns: SecurityMessage

TryGet
public static string TryGet(IDictionary<string, string> parameters, string name, string defaultValue)
result = Extensions.TryGet(parameters, name, defaultValue)
parameters
name
defaultValue
TryGetDecimal``2
public static decimal? TryGetDecimal<TMessage, TChange>(TMessage message, TChange type)
result = Extensions.TryGetDecimal(message, type)

Try get change from message.

message
Change message.
type
Change type.

Returns: Change value.

TryGetIconUrl
public static Uri TryGetIconUrl(Type type)
result = Extensions.TryGetIconUrl(type)
type

Returns: Icon url.

TryGetSecurityId
public static SecurityId? TryGetSecurityId(Message message)
result = Extensions.TryGetSecurityId(message)

Try get security ID from the specified message.

message
Message.

Returns: Security ID or if message do not provide it.

TryGetServerTime
public static bool TryGetServerTime(Message message, DateTime serverTime)
result = Extensions.TryGetServerTime(message, serverTime)

Try get message server time.

message
Message.
serverTime
Server time. If the value is , the message does not contain the server time.

Returns: Operation result.

TryGetVectorIcon
public static Uri TryGetVectorIcon(Type type)
result = Extensions.TryGetVectorIcon(type)

Try get Icon path.

type
Component type with applied VectorIconAttribute.

Returns: Icon url.

TryGet``2
public static object TryGet<TMessage, TChange>(TMessage message, TChange type)
result = Extensions.TryGet(message, type)

Try get change from message.

message
Change message.
type
Change type.

Returns: Change value.

TryInitLocalTime
public static void TryInitLocalTime(Message message, ILogSource source)
Extensions.TryInitLocalTime(message, source)

Try to initialize LocalTime by CurrentTime.

message
Message.
source
Source.
TryLimitByCount``1
public static IEnumerable<T> TryLimitByCount<T>(IEnumerable<T> set, SecurityLookupMessage msg)
result = Extensions.TryLimitByCount(set, msg)
set
msg
TryRemoveWrapper``1
public static TAdapter TryRemoveWrapper<TAdapter>(IMessageAdapter adapter)
result = Extensions.TryRemoveWrapper(adapter)

Remove adapter by the specified type.

adapter
Adapter.

Returns: Removed adapter or .

UndoBack``1
public static TMessage UndoBack<TMessage>(TMessage message)
result = Extensions.UndoBack(message)

Undo operation made via MessageBackModes).

message
Message.

Returns: Message.

UnGroup
public static QuoteChangeMessage UnGroup(IOrderBookMessage depth)
result = Extensions.UnGroup(depth)

To de-group the order book, grouped using the method Decimal).

depth
The grouped order book.

Returns: The de-grouped order book.

UseChannels
public static bool UseChannels(IMessageAdapter adapter)
result = Extensions.UseChannels(adapter)

To check, whether the message adapter uses channels.

adapter
IMessageAdapter

Returns: Check result.

ValidateBounds
public static MarketDataMessage ValidateBounds(MarketDataMessage message)
result = Extensions.ValidateBounds(message)

Validate From and To values.

message
Message.

Returns: Message.

ValidateCandleArg
public static bool ValidateCandleArg(Type candleMessageType, object value)
result = Extensions.ValidateCandleArg(candleMessageType, value)

Validate candle arg.

candleMessageType
Candle message type.
value
Candle arg.

Returns: Check result.

ValidateChannelState
public static bool ValidateChannelState(ChannelStates currState, ChannelStates newState)
result = Extensions.ValidateChannelState(currState, newState)

Validate state change.

currState
Current state.
newState
New state.
Verify
public static bool Verify(IOrderBookMessage book)
result = Extensions.Verify(book)

To determine whether the order book is in the right state.

book
Order book.

Returns: , if the order book contains correct data, otherwise .

VerifyOrderState
public static bool VerifyOrderState(OrderStates? currState, OrderStates newState, long transactionId, ILogReceiver logs, bool throwOnInvalid)
result = Extensions.VerifyOrderState(currState, newState, transactionId, logs, throwOnInvalid)

Check the possibility OrderStates change.

currState
Current order's state.
newState
New state.
transactionId
Transaction id.
logs
Logs.
throwOnInvalid
Throw exception on invalid transition.

Returns: Check result.

Volume
public static DataType Volume(decimal arg)
result = Extensions.Volume(arg)

Create data type info for VolumeCandleMessage.

arg
Candle arg.

Returns: Data type info.

Fields

AllSecurityId
public static readonly string AllSecurityId
value = Extensions.AllSecurityId

"All securities" id.

AnonymousPortfolioName
public const string AnonymousPortfolioName
value = Extensions.AnonymousPortfolioName

Anonymous account.

AnyDepths
public static readonly IEnumerable<int> AnyDepths
value = Extensions.AnyDepths

Special set mean any depth for SupportedOrderBookDepths option.

DefaultFileSystem
public static readonly IFileSystem DefaultFileSystem
value = Extensions.DefaultFileSystem

Default IFileSystem.

LookupAllCriteriaMessage
public static readonly SecurityLookupMessage LookupAllCriteriaMessage
value = Extensions.LookupAllCriteriaMessage

Lookup all securities predefined criteria.

NewsStockSharpSource
public const string NewsStockSharpSource
value = Extensions.NewsStockSharpSource

StockSharp news source.

SimulatorPortfolioName
public const string SimulatorPortfolioName
value = Extensions.SimulatorPortfolioName

Simulator.

Today
public static readonly DateTime Today
value = Extensions.Today

Constant value for TillDate means Today(=Session).