Class TraderHelper
- Namespace
 - StockSharp.Algo
 
- Assembly
 - StockSharp.Algo.dll
 
The auxiliary class for provision of various algorithmic functionalities.
public static class TraderHelper
  - Inheritance
 - 
      
      TraderHelper
 
- Inherited Members
 
Properties
IndicatorValue
Indicator value.
public static DataType IndicatorValue { get; }
  Property Value
UsdRateMinAvailableTime
The earliest date for which there is an indicative rate of US dollar to the Russian ruble. It is 2 November 2009.
[Obsolete]
public static DateTime UsdRateMinAvailableTime { get; }
  Property Value
Methods
AddAdapter(Connector, Type, Action<IMessageAdapter>)
Create IMessageAdapter.
public static IMessageAdapter AddAdapter(this Connector connector, Type adapterType, Action<IMessageAdapter> init)
  Parameters
connectorConnectorThe class to create connections to trading systems.
adapterTypeTypeAdapter type.
initAction<IMessageAdapter>Initialize adapter.
Returns
- IMessageAdapter
 The class to create connections to trading systems.
AddAdapter<TAdapter>(Connector, Action<TAdapter>)
Create IMessageAdapter.
public static TAdapter AddAdapter<TAdapter>(this Connector connector, Action<TAdapter> init) where TAdapter : IMessageAdapter
  Parameters
connectorConnectorThe class to create connections to trading systems.
initAction<TAdapter>Initialize adapter.
Returns
- TAdapter
 The class to create connections to trading systems.
Type Parameters
TAdapterAdapter type.
AddOrderErrorLog(ILogReceiver, Order, string, Func<string>)
Write order error to the log.
public static void AddOrderErrorLog(this ILogReceiver receiver, Order order, string operation, Func<string> getAdditionalInfo = null)
  Parameters
receiverILogReceiverLogs receiver.
orderOrderOrder.
operationstringOrder action name.
getAdditionalInfoFunc<string>Extended order info.
AddOrderInfoLog(ILogReceiver, Order, string, Func<string>)
Write order info to the log.
public static void AddOrderInfoLog(this ILogReceiver receiver, Order order, string operation, Func<string> getAdditionalInfo = null)
  Parameters
receiverILogReceiverLogs receiver.
orderOrderOrder.
operationstringOrder action name.
getAdditionalInfoFunc<string>Extended order info.
ApplyOffset(decimal, Sides, Unit, Security)
To use shifting for price, depending on direction side.
public static decimal ApplyOffset(this decimal price, Sides side, Unit offset, Security security)
  Parameters
pricedecimalPrice.
sideSidesThe order direction, used as shift direction (for buy the shift is added, for sell - subtracted).
offsetUnitPrice shift.
securitySecuritySecurity.
Returns
- decimal
 New price.
CancelOrders(IConnector, IEnumerable<Order>, bool?, Portfolio, Sides?, ExchangeBoard, Security, SecurityTypes?)
Cancel orders by filter.
public static void CancelOrders(this IConnector connector, IEnumerable<Order> orders, bool? isStopOrder = null, Portfolio portfolio = null, Sides? side = null, ExchangeBoard board = null, Security security = null, SecurityTypes? securityType = null)
  Parameters
connectorIConnectorThe connection of interaction with trade systems.
ordersIEnumerable<Order>The group of orders, from which the required orders shall be found and cancelled.
isStopOrderbool?true, if cancel only a stop orders, false - if regular orders, null - both.
portfolioPortfolioPortfolio. If the value is equal to null, then the portfolio does not match the orders cancel filter.
sideSides?Order side. If the value is null, the direction does not use.
boardExchangeBoardTrading board. If the value is equal to null, then the board does not match the orders cancel filter.
securitySecurityInstrument. If the value is equal to null, then the instrument does not match the orders cancel filter.
securityTypeSecurityTypes?Security type. If the value is null, the type does not use.
Compile(string, AssemblyLoadContextTracker)
Compile mathematical formula.
public static ExpressionFormula<decimal> Compile(this string expression, AssemblyLoadContextTracker tracker)
  Parameters
expressionstringText expression.
trackerAssemblyLoadContextTracker
Returns
- ExpressionFormula<decimal>
 Compiled mathematical formula.
CompileAsync(string, AssemblyLoadContextTracker, CancellationToken)
Compile mathematical formula.
public static Task<ExpressionFormula<decimal>> CompileAsync(this string expression, AssemblyLoadContextTracker tracker, CancellationToken cancellationToken)
  Parameters
expressionstringText expression.
trackerAssemblyLoadContextTrackercancellationTokenCancellationToken
Returns
- Task<ExpressionFormula<decimal>>
 Compiled mathematical formula.
CompileAsync<TResult>(string, AssemblyLoadContextTracker, CancellationToken)
Compile mathematical formula.
public static Task<ExpressionFormula<TResult>> CompileAsync<TResult>(this string expression, AssemblyLoadContextTracker tracker, CancellationToken cancellationToken)
  Parameters
expressionstringText expression.
trackerAssemblyLoadContextTrackercancellationTokenCancellationToken
Returns
- Task<ExpressionFormula<TResult>>
 Compiled mathematical formula.
Type Parameters
TResultResult type.
Compile<TResult>(string, AssemblyLoadContextTracker)
Compile mathematical formula.
public static ExpressionFormula<TResult> Compile<TResult>(this string expression, AssemblyLoadContextTracker tracker)
  Parameters
expressionstringText expression.
trackerAssemblyLoadContextTracker
Returns
- ExpressionFormula<TResult>
 Compiled mathematical formula.
Type Parameters
TResultResult type.
Contains(BasketSecurity, ISecurityProvider, Security)
To check whether specified instrument is used now.
public static bool Contains(this BasketSecurity basketSecurity, ISecurityProvider securityProvider, Security security)
  Parameters
basketSecurityBasketSecurityInstruments basket.
securityProviderISecurityProviderThe provider of information about instruments.
securitySecurityThe instrument that should be checked.
Returns
CreateProcessor(IBasketSecurityProcessorProvider, Security)
Create market data processor for basket securities.
public static IBasketSecurityProcessor CreateProcessor(this IBasketSecurityProcessorProvider processorProvider, Security security)
  Parameters
processorProviderIBasketSecurityProcessorProviderBasket security processors provider.
securitySecurityBasket security.
Returns
- IBasketSecurityProcessor
 Market data processor for basket securities.
DeleteAll(ISecurityStorage)
To delete all instruments.
public static void DeleteAll(this ISecurityStorage storage)
  Parameters
storageISecurityStorageSecurities meta info storage.
DownloadCandles(IMessageAdapter, Action<TimeFrameCandleMessage>, TimeSpan, SecurityId, TimeSpan, DateTimeOffset, DateTimeOffset, long?, Level1Fields?, SecurityTypes?)
To download candles.
public static void DownloadCandles(this IMessageAdapter adapter, Action<TimeFrameCandleMessage> receiver, TimeSpan timeout, SecurityId securityId, TimeSpan timeFrame, DateTimeOffset from, DateTimeOffset to, long? count = null, Level1Fields? buildField = null, SecurityTypes? secType = null)
  Parameters
adapterIMessageAdapterAdapter.
receiverAction<TimeFrameCandleMessage>Downloaded data receiver.
timeoutTimeSpanTimeout.
securityIdSecurityIdSecurity ID.
timeFrameTimeSpanTime-frame.
fromDateTimeOffsetBegin period.
toDateTimeOffsetEnd period.
countlong?Candles count.
buildFieldLevel1Fields?Extra info for the BuildFrom.
secTypeSecurityTypes?
DownloadLevel1(IMessageAdapter, Action<Level1ChangeMessage>, TimeSpan, SecurityId, DateTime, DateTime, int?, IEnumerable<Level1Fields>, SecurityTypes?)
To get level1 market data.
public static void DownloadLevel1(this IMessageAdapter adapter, Action<Level1ChangeMessage> receiver, TimeSpan timeout, SecurityId securityId, DateTime beginDate, DateTime endDate, int? maxCount = null, IEnumerable<Level1Fields> fields = null, SecurityTypes? secType = null)
  Parameters
adapterIMessageAdapterAdapter.
receiverAction<Level1ChangeMessage>Downloaded data receiver.
timeoutTimeSpanTimeout.
securityIdSecurityIdSecurity ID.
beginDateDateTimeStart date.
endDateDateTimeEnd date.
maxCountint?fieldsIEnumerable<Level1Fields>Market data fields.
secTypeSecurityTypes?
DownloadOrderBook(IMessageAdapter, Action<QuoteChangeMessage>, TimeSpan, SecurityId, DateTime, DateTime, int?, SecurityTypes?)
To get order book (depth of market).
public static void DownloadOrderBook(this IMessageAdapter adapter, Action<QuoteChangeMessage> receiver, TimeSpan timeout, SecurityId securityId, DateTime beginDate, DateTime endDate, int? maxCount = null, SecurityTypes? secType = null)
  Parameters
adapterIMessageAdapterAdapter.
receiverAction<QuoteChangeMessage>Downloaded data receiver.
timeoutTimeSpanTimeout.
securityIdSecurityIdSecurity ID.
beginDateDateTimeStart date.
endDateDateTimeEnd date.
maxCountint?secTypeSecurityTypes?
DownloadOrderLog(IMessageAdapter, Action<ExecutionMessage>, TimeSpan, SecurityId, DateTime, DateTime, int?, SecurityTypes?)
To get order log.
public static void DownloadOrderLog(this IMessageAdapter adapter, Action<ExecutionMessage> receiver, TimeSpan timeout, SecurityId securityId, DateTime beginDate, DateTime endDate, int? maxCount = null, SecurityTypes? secType = null)
  Parameters
adapterIMessageAdapterAdapter.
receiverAction<ExecutionMessage>Downloaded data receiver.
timeoutTimeSpanTimeout.
securityIdSecurityIdSecurity ID.
beginDateDateTimeStart date.
endDateDateTimeEnd date.
maxCountint?secTypeSecurityTypes?
DownloadSecurities(IMessageAdapter, Action<SecurityMessage>, TimeSpan, SecurityLookupMessage)
Download all securities.
public static void DownloadSecurities(this IMessageAdapter adapter, Action<SecurityMessage> receiver, TimeSpan timeout, SecurityLookupMessage lookupMsg)
  Parameters
adapterIMessageAdapterAdapter.
receiverAction<SecurityMessage>Downloaded data receiver.
timeoutTimeSpanTimeout.
lookupMsgSecurityLookupMessageMessage security lookup for specified criteria.
DownloadTicks(IMessageAdapter, Action<ExecutionMessage>, TimeSpan, SecurityId, DateTime, DateTime, int?, SecurityTypes?)
To get tick data.
public static void DownloadTicks(this IMessageAdapter adapter, Action<ExecutionMessage> receiver, TimeSpan timeout, SecurityId securityId, DateTime beginDate, DateTime endDate, int? maxCount = null, SecurityTypes? secType = null)
  Parameters
adapterIMessageAdapterAdapter.
receiverAction<ExecutionMessage>Downloaded data receiver.
timeoutTimeSpanTimeout.
securityIdSecurityIdSecurity ID.
beginDateDateTimeStart date.
endDateDateTimeEnd date.
maxCountint?secTypeSecurityTypes?
Download<TResult>(IMessageAdapter, Message, Action<TResult>, TimeSpan, out byte[])
Download data.
public static void Download<TResult>(this IMessageAdapter adapter, Message request, Action<TResult> receiver, TimeSpan timeout, out byte[] archive) where TResult : Message
  Parameters
adapterIMessageAdapterAdapter.
requestMessageRequest.
receiverAction<TResult>Downloaded data receiver.
timeoutTimeSpanTimeout.
archivebyte[]Result data was sent as archive.
Type Parameters
TResultResult message.
EmulateTrades(MarketDepth, IEnumerable<ExecutionMessage>)
To delete in order book levels, which shall disappear in case of trades occurrence trades.
[Obsolete]
public static void EmulateTrades(this MarketDepth depth, IEnumerable<ExecutionMessage> trades)
  Parameters
depthMarketDepthThe order book to be cleared.
tradesIEnumerable<ExecutionMessage>Trades.
ExtractBoards(byte[])
Extract boards from the archive.
public static IEnumerable<BoardMessage> ExtractBoards(this byte[] archive)
  Parameters
archivebyte[]The archive.
Returns
- IEnumerable<BoardMessage>
 Boards.
ExtractSecurities(byte[])
Extract securities from the archive.
public static IEnumerable<SecurityMessage> ExtractSecurities(this byte[] archive)
  Parameters
archivebyte[]The archive.
Returns
- IEnumerable<SecurityMessage>
 Securities.
FillFortsJumps(ExpirationContinuousSecurity, ISecurityProvider, string, DateTime, DateTime)
To fill transitions ExpirationJumps.
public static void FillFortsJumps(this ExpirationContinuousSecurity continuousSecurity, ISecurityProvider provider, string baseCode, DateTime from, DateTime to)
  Parameters
continuousSecurityExpirationContinuousSecurityContinuous security.
providerISecurityProviderThe provider of information about instruments.
baseCodestringThe base part of the instrument code.
fromDateTimeThe start of the expiration range.
toDateTimeThe end of the expiration range.
Filter(IEnumerable<MyTrade>, Security)
To filter own trades for the given instrument.
public static IEnumerable<MyTrade> Filter(this IEnumerable<MyTrade> myTrades, Security security)
  Parameters
myTradesIEnumerable<MyTrade>All own trades, in which the required shall be looked for.
securitySecurityThe instrument, on which the trades shall be found.
Returns
- IEnumerable<MyTrade>
 Filtered trades.
Filter(IEnumerable<Order>, Security)
To filter orders for the given instrument.
public static IEnumerable<Order> Filter(this IEnumerable<Order> orders, Security security)
  Parameters
ordersIEnumerable<Order>All orders, in which the required shall be searched for.
securitySecurityThe instrument, for which the orders shall be filtered.
Returns
- IEnumerable<Order>
 Filtered orders.
Filter(IEnumerable<Position>, Security)
To filter positions for the given instrument.
public static IEnumerable<Position> Filter(this IEnumerable<Position> positions, Security security)
  Parameters
positionsIEnumerable<Position>All positions, in which the required shall be searched for.
securitySecurityThe instrument, for which positions shall be filtered.
Returns
- IEnumerable<Position>
 Filtered positions.
Filter(IEnumerable<Trade>, Security)
To filter orders for the given instrument.
[Obsolete("Use ITickTradeMessage.")]
public static IEnumerable<Trade> Filter(this IEnumerable<Trade> trades, Security security)
  Parameters
tradesIEnumerable<Trade>All trades, in which the required shall be searched for.
securitySecurityThe instrument, for which the trades shall be filtered.
Returns
- IEnumerable<Trade>
 Filtered trades.
GenerateId(SecurityIdGenerator, string, ExchangeBoard)
Generate SecurityId security.
public static string GenerateId(this SecurityIdGenerator generator, string secCode, ExchangeBoard board)
  Parameters
generatorSecurityIdGeneratorsecCodestringSecurity code.
boardExchangeBoardSecurity board.
Returns
GetAllSecurity(ISecurityProvider)
Find AllSecurity instance in the specified provider.
public static Security GetAllSecurity(this ISecurityProvider provider)
  Parameters
providerISecurityProviderThe provider of information about instruments.
Returns
- Security
 Found instance.
GetAveragePrice(Order, IConnector)
[Obsolete("Use subscriptions.")]
public static decimal GetAveragePrice(this Order order, IConnector connector)
  Parameters
orderOrderconnectorIConnector
Returns
GetCancelReason(OrderLogItem)
To get the reason for cancelling order in orders log.
[Obsolete("Use messages only.")]
public static OrderLogCancelReasons GetCancelReason(this OrderLogItem item)
  Parameters
itemOrderLogItemOrder log item.
Returns
- OrderLogCancelReasons
 The reason for order cancelling in order log.
GetCurrentPrice(MarketDepthPair, Sides, decimal?, MarketPriceTypes)
To calculate the current price based on the best pair of quotes, depending on the order direction.
[Obsolete("Use subscriptions.")]
public static Unit GetCurrentPrice(this MarketDepthPair bestPair, Sides side, decimal? priceStep, MarketPriceTypes priceType = MarketPriceTypes.Following)
  Parameters
bestPairMarketDepthPairThe best pair of quotes, used for the current price calculation.
sideSidesThe order direction. If it is a buy, Ask value is used, otherwise Bid.
priceStepdecimal?priceTypeMarketPriceTypesThe type of current price.
Returns
Remarks
For correct operation of the method the order book export shall be launched.
GetCurrentPrice(Security, IMarketDataProvider, Sides?)
To calculate the current price by the instrument depending on the order direction.
public static decimal? GetCurrentPrice(this Security security, IMarketDataProvider provider, Sides? direction = null)
  Parameters
securitySecurityThe instrument used for the current price calculation.
providerIMarketDataProviderThe market data provider.
directionSides?Order side.
Returns
- decimal?
 The current price. If information in order book is insufficient, then null will be returned.
GetCurrentPrice(IOrderBookMessage, Sides, decimal?, MarketPriceTypes, IEnumerable<Order>)
To calculate the current price by the order book depending on the order direction.
[Obsolete("Use subscriptions.")]
public static Unit GetCurrentPrice(this IOrderBookMessage depth, Sides side, decimal? priceStep, MarketPriceTypes priceType = MarketPriceTypes.Following, IEnumerable<Order> orders = null)
  Parameters
depthIOrderBookMessageThe order book for the current price calculation.
sideSidesThe order direction. If it is a buy, BestAsk value is used, otherwise BestBid.
priceStepdecimal?priceTypeMarketPriceTypesThe type of current price.
ordersIEnumerable<Order>Orders to be ignored.
Returns
Remarks
For correct operation of the method the order book export shall be launched.
GetDirection(Position)
To get the order direction for the position.
public static Sides? GetDirection(this Position position)
  Parameters
positionPositionThe position value.
Returns
- Sides?
 Order side.
Remarks
GetDirection(decimal)
To get the order direction for the position.
public static Sides? GetDirection(this decimal position)
  Parameters
positiondecimalThe position value.
Returns
- Sides?
 Order side.
Remarks
GetFortsEndOfDay(string, DateTime, DateTime)
It returns a list of the data at the end of day (EOD, End-Of-Day) by the selected instrument for the specified period.
[Obsolete]
public static IEnumerable<Level1ChangeMessage> GetFortsEndOfDay(this string securityName, DateTime fromDate, DateTime toDate)
  Parameters
Returns
- IEnumerable<Level1ChangeMessage>
 Historical market-data.
GetFortsJumps(ExpirationContinuousSecurity, ISecurityProvider, string, DateTime, DateTime, bool)
To get real expiration instruments for the continuous instrument.
public static IEnumerable<Security> GetFortsJumps(this ExpirationContinuousSecurity continuousSecurity, ISecurityProvider provider, string baseCode, DateTime from, DateTime to, bool throwIfNotExists = true)
  Parameters
continuousSecurityExpirationContinuousSecurityContinuous security.
providerISecurityProviderThe provider of information about instruments.
baseCodestringThe base part of the instrument code.
fromDateTimeThe start of the expiration range.
toDateTimeThe end of the expiration range.
throwIfNotExistsboolTo generate exception, if some of instruments for passed
continuousSecurityare not available.
Returns
- IEnumerable<Security>
 Expiration instruments.
GetFortsJumps(string, DateTime, DateTime, Func<string, Security>, bool)
To get real expiration instruments for base part of the code.
public static IEnumerable<Security> GetFortsJumps(this string baseCode, DateTime from, DateTime to, Func<string, Security> getSecurity, bool throwIfNotExists = true)
  Parameters
baseCodestringThe base part of the instrument code.
fromDateTimeThe start of the expiration range.
toDateTimeThe end of the expiration range.
getSecurityFunc<string, Security>The function to get instrument by the code.
throwIfNotExistsboolTo generate exception, if some of instruments are not available.
Returns
- IEnumerable<Security>
 Expiration instruments.
GetFortsRate(SecurityId, DateTime, DateTime)
To get an indicative exchange rate of a currency pair.
[Obsolete]
public static IDictionary<DateTimeOffset, decimal> GetFortsRate(this SecurityId securityId, DateTime fromDate, DateTime toDate)
  Parameters
securityIdSecurityIdSecurity ID.
fromDateDateTimeBegin period.
toDateDateTimeEnd period.
Returns
- IDictionary<DateTimeOffset, decimal>
 The indicative rate of US dollar to the Russian ruble.
GetFortsYesterdayEndOfDay(string)
It returns yesterday's data at the end of day (EOD, End-Of-Day) by the selected instrument.
[Obsolete]
public static Level1ChangeMessage GetFortsYesterdayEndOfDay(this string securityName)
  Parameters
securityNamestringSecurity name.
Returns
- Level1ChangeMessage
 Yesterday's market-data.
Remarks
Date is determined by the system time.
GetInnerSecurities(BasketSecurity, ISecurityProvider)
Find inner security instances.
public static IEnumerable<Security> GetInnerSecurities(this BasketSecurity security, ISecurityProvider securityProvider)
  Parameters
securityBasketSecurityInstruments basket.
securityProviderISecurityProviderThe provider of information about instruments.
Returns
- IEnumerable<Security>
 Instruments, from which this basket is created.
GetMatchedVolume(Order, IConnector)
[Obsolete("Use subscriptions.")]
public static decimal GetMatchedVolume(this Order order, IConnector connector)
  Parameters
orderOrderconnectorIConnector
Returns
GetOrCreate(ISecurityStorage, SecurityId, Func<string, Security>, out bool)
Get or create (if not exist).
public static Security GetOrCreate(this ISecurityStorage storage, SecurityId id, Func<string, Security> creator, out bool isNew)
  Parameters
storageISecurityStorageSecurities meta info storage.
idSecurityIdSecurity ID.
creatorFunc<string, Security>Creator.
isNewboolIs newly created.
Returns
- Security
 Security.
GetOrCreatePortfolio(IPositionStorage, string, Func<string, Portfolio>, out bool)
Get or create (if not exist).
public static Portfolio GetOrCreatePortfolio(this IPositionStorage storage, string portfolioName, Func<string, Portfolio> creator, out bool isNew)
  Parameters
storageIPositionStorageStorage.
portfolioNamestringPortfolio code name.
creatorFunc<string, Portfolio>Creator.
isNewboolIs newly created.
Returns
- Portfolio
 Portfolio.
GetOrCreatePosition(IPositionStorage, Portfolio, Security, string, Sides?, string, string, TPlusLimits?, Func<Portfolio, Security, string, Sides?, string, string, TPlusLimits?, Position>, out bool)
Get or create (if not exist).
public static Position GetOrCreatePosition(this IPositionStorage storage, Portfolio portfolio, Security security, string strategyId, Sides? side, string clientCode, string depoName, TPlusLimits? limitType, Func<Portfolio, Security, string, Sides?, string, string, TPlusLimits?, Position> creator, out bool isNew)
  Parameters
storageIPositionStorageStorage.
portfolioPortfolioPortfolio.
securitySecuritySecurity.
strategyIdstringStrategy ID.
sideSides?Side.
clientCodestringClient code.
depoNamestringDepo name.
limitTypeTPlusLimits?Limit type.
creatorFunc<Portfolio, Security, string, Sides?, string, string, TPlusLimits?, Position>Creator.
isNewboolIs newly created.
Returns
- Position
 Position.
GetPnL(IPnLManager)
Get the total profit and loss (PnL) value.
public static decimal GetPnL(this IPnLManager manager)
  Parameters
managerIPnLManager
Returns
- decimal
 Total profit and loss (PnL) value, which is the sum of unrealized and realized PnL.
GetPnL(Portfolio)
To calculate profit-loss based on the portfolio.
public static decimal? GetPnL(this Portfolio portfolio)
  Parameters
portfolioPortfolioThe portfolio, for which the profit-loss shall be calculated.
Returns
- decimal?
 Profit-loss.
GetPosition(MyTrade)
To get the position on own trade.
public static decimal GetPosition(this MyTrade trade)
  Parameters
tradeMyTradeOwn trade, used for position calculation. At buy the trade volume Volume is taken with positive sign, at sell - with negative.
Returns
- decimal
 Position.
GetPosition(ExecutionMessage, bool)
[Obsolete]
public static decimal? GetPosition(this ExecutionMessage message, bool byOrder)
  Parameters
messageExecutionMessagebyOrderbool
Returns
GetSecurityCriteria(Connector, SecurityLookupMessage, IExchangeInfoProvider)
To create the search criteria Security from SecurityLookupMessage.
public static Security GetSecurityCriteria(this Connector connector, SecurityLookupMessage criteria, IExchangeInfoProvider exchangeInfoProvider)
  Parameters
connectorConnectorConnection to the trading system.
criteriaSecurityLookupMessageThe criterion which fields will be used as a filter.
exchangeInfoProviderIExchangeInfoProviderExchanges and trading boards provider.
Returns
- Security
 Search criterion.
GetSecurityValue<T>(IMarketDataProvider, Security, Level1Fields)
To get the value of market data for the instrument.
public static T GetSecurityValue<T>(this IMarketDataProvider provider, Security security, Level1Fields field)
  Parameters
providerIMarketDataProviderThe market data provider.
securitySecuritySecurity.
fieldLevel1FieldsMarket-data field.
Returns
- T
 The field value. If no data, the null will be returned.
Type Parameters
TThe type of the market data field value.
GetSecurityValues(IMarketDataProvider, Security)
To get all market data values for the instrument.
public static IDictionary<Level1Fields, object> GetSecurityValues(this IMarketDataProvider provider, Security security)
  Parameters
providerIMarketDataProviderThe market data provider.
securitySecuritySecurity.
Returns
- IDictionary<Level1Fields, object>
 Filed values. If there is no data, null is returned.
GetTheoreticalTrades(MarketDepth, Order)
To get probable trades for order book for the given order.
[Obsolete]
public static IEnumerable<MyTrade> GetTheoreticalTrades(this MarketDepth depth, Order order)
  Parameters
depthMarketDepthThe order book, reflecting situation on market at the moment of function call.
orderOrderThe order, for which probable trades shall be calculated.
Returns
- IEnumerable<MyTrade>
 Probable trades.
GetTheoreticalTrades(MarketDepth, Sides, decimal)
To get probable trades by the order book for the market price and given volume.
[Obsolete]
public static IEnumerable<MyTrade> GetTheoreticalTrades(this MarketDepth depth, Sides orderDirection, decimal volume)
  Parameters
depthMarketDepthThe order book, reflecting situation on market at the moment of function call.
orderDirectionSidesOrder side.
volumedecimalThe volume, supposed to be implemented.
Returns
- IEnumerable<MyTrade>
 Probable trades.
GetTheoreticalTrades(MarketDepth, Sides, decimal, decimal)
To get probable trades by order book for given price and volume.
[Obsolete]
public static IEnumerable<MyTrade> GetTheoreticalTrades(this MarketDepth depth, Sides side, decimal volume, decimal price)
  Parameters
depthMarketDepthThe order book, reflecting situation on market at the moment of function call.
sideSidesOrder side.
volumedecimalThe volume, supposed to be implemented.
pricedecimalThe price, based on which the order is supposed to be forwarded. If it equals 0, option of market order will be considered.
Returns
- IEnumerable<MyTrade>
 Probable trades.
GetTrades(Order, IConnector)
[Obsolete("Use subscriptions.")]
public static IEnumerable<MyTrade> GetTrades(this Order order, IConnector connector)
  Parameters
orderOrderconnectorIConnector
Returns
IsAssociated(SecurityId, ExchangeBoard)
Is specified security id associated with the board.
public static bool IsAssociated(this SecurityId securityId, ExchangeBoard board)
  Parameters
securityIdSecurityIdSecurity ID.
boardExchangeBoardBoard info.
Returns
IsBasket(Security)
Is specified security is basket.
public static bool IsBasket(this Security security)
  Parameters
securitySecuritySecurity.
Returns
- bool
 Check result.
IsCanceled(OrderLogItem)
To check, does the order log contain the cancelled order.
[Obsolete("Use messages only.")]
public static bool IsCanceled(this OrderLogItem item)
  Parameters
itemOrderLogItemOrder log item.
Returns
IsContinuous(Security)
Is specified security is continuous.
public static bool IsContinuous(this Security security)
  Parameters
securitySecuritySecurity.
Returns
- bool
 Check result.
IsContinuous(SecurityMessage)
Is specified security is continuous.
public static bool IsContinuous(this SecurityMessage security)
  Parameters
securitySecurityMessageSecurity.
Returns
- bool
 Check result.
IsIndex(Security)
Is specified security is index.
public static bool IsIndex(this Security security)
  Parameters
securitySecuritySecurity.
Returns
- bool
 Check result.
IsMatched(OrderLogItem)
To check, does the order log contain the order matching.
[Obsolete("Use messages only.")]
public static bool IsMatched(this OrderLogItem item)
  Parameters
itemOrderLogItemOrder log item.
Returns
IsMicex(ExchangeBoard)
Is MICEX board.
[Obsolete]
public static bool IsMicex(this ExchangeBoard board)
  Parameters
boardExchangeBoardBoard to check.
Returns
- bool
 Check result.
IsRegistered(OrderLogItem)
To check, does the order log contain the order registration.
[Obsolete("Use messages only.")]
public static bool IsRegistered(this OrderLogItem item)
  Parameters
itemOrderLogItemOrder log item.
Returns
IsStockSharp(News)
Determines whether the specified news related with StockSharp.
public static bool IsStockSharp(this News news)
  Parameters
newsNewsNews.
Returns
- bool
 Check result.
IsTradeTime(ExchangeBoard, DateTimeOffset)
To check, whether the time is traded (has the session started, ended, is there a clearing).
public static bool IsTradeTime(this ExchangeBoard board, DateTimeOffset time)
  Parameters
boardExchangeBoardBoard info.
timeDateTimeOffsetThe passed time to be checked.
Returns
IsTradeTime(ExchangeBoard, 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 ExchangeBoard board, DateTimeOffset time, out bool? isWorkingDay, out WorkingTimePeriod period)
  Parameters
boardExchangeBoardBoard info.
timeDateTimeOffsetThe passed time to be checked.
isWorkingDaybool?true, if the date is traded, otherwise, is not traded.
periodWorkingTimePeriodCurrent working time period.
Returns
IsUxStock(ExchangeBoard)
Is the UX exchange stock market board.
[Obsolete]
public static bool IsUxStock(this ExchangeBoard board)
  Parameters
boardExchangeBoardBoard to check.
Returns
- bool
 Check result.
Lookup(ISecurityProvider, Security)
Lookup securities by criteria criteria.
public static IEnumerable<Security> Lookup(this ISecurityProvider provider, Security criteria)
  Parameters
providerISecurityProviderThe provider of information about instruments.
criteriaSecurityThe instrument whose fields will be used as a filter.
Returns
- IEnumerable<Security>
 Found instruments.
LookupAll(Connector)
Lookup securities, portfolios and orders.
public static void LookupAll(this Connector connector)
  Parameters
connectorConnectorThe connection of interaction with trade systems.
LookupAll(ISecurityProvider)
Get all available instruments.
public static IEnumerable<Security> LookupAll(this ISecurityProvider provider)
  Parameters
providerISecurityProviderThe provider of information about instruments.
Returns
- IEnumerable<Security>
 All available instruments.
LookupBoards(ISubscriptionProvider, ExchangeBoard, IMessageAdapter, MessageOfflineModes)
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription LookupBoards(this ISubscriptionProvider provider, ExchangeBoard criteria, IMessageAdapter adapter = null, MessageOfflineModes offlineMode = MessageOfflineModes.None)
  Parameters
providerISubscriptionProvidercriteriaExchangeBoardadapterIMessageAdapterofflineModeMessageOfflineModes
Returns
LookupBoards(ISubscriptionProvider, BoardLookupMessage)
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription LookupBoards(this ISubscriptionProvider provider, BoardLookupMessage criteria)
  Parameters
providerISubscriptionProvidercriteriaBoardLookupMessage
Returns
LookupByCode(ISecurityProvider, string, SecurityTypes?)
To get the instrument by the instrument code.
public static IEnumerable<Security> LookupByCode(this ISecurityProvider provider, string code, SecurityTypes? type = null)
  Parameters
providerISecurityProviderThe provider of information about instruments.
codestringSecurity code.
typeSecurityTypes?Security type.
Returns
- IEnumerable<Security>
 The got instrument. If there is no instrument by given criteria, null is returned.
LookupByNativeId(ISecurityProvider, INativeIdStorage, string, object)
To get the instrument by the system identifier.
public static Security LookupByNativeId(this ISecurityProvider provider, INativeIdStorage nativeIdStorage, string storageName, object nativeId)
  Parameters
providerISecurityProviderThe provider of information about instruments.
nativeIdStorageINativeIdStorageSecurity native identifier storage.
storageNamestringStorage name.
nativeIdobjectNative (internal) trading system security id.
Returns
LookupDataTypes(ISubscriptionProvider, DataTypeLookupMessage)
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription LookupDataTypes(this ISubscriptionProvider provider, DataTypeLookupMessage criteria)
  Parameters
providerISubscriptionProvidercriteriaDataTypeLookupMessage
Returns
LookupOrders(ISubscriptionProvider, Order, IMessageAdapter, MessageOfflineModes)
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription LookupOrders(this ISubscriptionProvider provider, Order criteria, IMessageAdapter adapter = null, MessageOfflineModes offlineMode = MessageOfflineModes.None)
  Parameters
providerISubscriptionProvidercriteriaOrderadapterIMessageAdapterofflineModeMessageOfflineModes
Returns
LookupOrders(ISubscriptionProvider, OrderStatusMessage)
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription LookupOrders(this ISubscriptionProvider provider, OrderStatusMessage criteria)
  Parameters
providerISubscriptionProvidercriteriaOrderStatusMessage
Returns
LookupPortfolios(ISubscriptionProvider, Portfolio, IMessageAdapter, MessageOfflineModes)
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription LookupPortfolios(this ISubscriptionProvider provider, Portfolio criteria, IMessageAdapter adapter = null, MessageOfflineModes offlineMode = MessageOfflineModes.None)
  Parameters
providerISubscriptionProvidercriteriaPortfolioadapterIMessageAdapterofflineModeMessageOfflineModes
Returns
LookupPortfolios(ISubscriptionProvider, PortfolioLookupMessage)
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription LookupPortfolios(this ISubscriptionProvider provider, PortfolioLookupMessage criteria)
  Parameters
providerISubscriptionProvidercriteriaPortfolioLookupMessage
Returns
LookupSecurities(ISubscriptionProvider, Security, IMessageAdapter, MessageOfflineModes)
To find instruments that match the filter criteria. Found instruments will be passed through the event LookupSecuritiesResult.
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription LookupSecurities(this ISubscriptionProvider provider, Security criteria, IMessageAdapter adapter = null, MessageOfflineModes offlineMode = MessageOfflineModes.None)
  Parameters
providerISubscriptionProviderSubscription provider.
criteriaSecurityThe criterion which fields will be used as a filter.
adapterIMessageAdapterTarget adapter. Can be null.
offlineModeMessageOfflineModesOffline mode handling message.
Returns
- Subscription
 Subscription.
LookupSecurities(ISubscriptionProvider, SecurityLookupMessage)
To find instruments that match the filter criteria. Found instruments will be passed through the event LookupSecuritiesResult.
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription LookupSecurities(this ISubscriptionProvider provider, SecurityLookupMessage criteria)
  Parameters
providerISubscriptionProviderSubscription provider.
criteriaSecurityLookupMessageThe criterion which fields will be used as a filter.
Returns
- Subscription
 Subscription.
ShrinkPrice(Order, ShrinkRules)
To cut the price for the order, to make it multiple of the minimal step, also to limit number of decimal places.
public static void ShrinkPrice(this Order order, ShrinkRules rule = ShrinkRules.Auto)
  Parameters
orderOrderThe order for which the price will be cut Price.
ruleShrinkRulesThe price rounding rule.
ShrinkPrice(Security, decimal, 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 Security security, decimal price, ShrinkRules rule = ShrinkRules.Auto)
  Parameters
securitySecurityThe instrument from which the PriceStep and Decimals values are taken.
pricedecimalThe price to be made multiple.
ruleShrinkRulesThe price rounding rule.
Returns
- decimal
 The multiple price.
SubscribeBoard(ISubscriptionProvider, ExchangeBoard, DateTimeOffset?, DateTimeOffset?, long?, IMessageAdapter, long?)
Subscribe on the board changes.
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribeBoard(this ISubscriptionProvider provider, ExchangeBoard board, DateTimeOffset? from = null, DateTimeOffset? to = null, long? count = null, IMessageAdapter adapter = null, long? skip = null)
  Parameters
providerISubscriptionProviderSubscription provider.
boardExchangeBoardBoard for subscription.
fromDateTimeOffset?The initial date from which you need to get data.
toDateTimeOffset?The final date by which you need to get data.
countlong?Max count.
adapterIMessageAdapterTarget adapter. Can be null.
skiplong?Skip count.
Returns
- Subscription
 Subscription.
SubscribeCandles(ISubscriptionProvider, CandleSeries, DateTimeOffset?, DateTimeOffset?, long?, long?, IMessageAdapter, long?, FillGapsDays?)
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribeCandles(this ISubscriptionProvider provider, CandleSeries series, DateTimeOffset? from = null, DateTimeOffset? to = null, long? count = null, long? transactionId = null, IMessageAdapter adapter = null, long? skip = null, FillGapsDays? fillGaps = null)
  Parameters
providerISubscriptionProviderseriesCandleSeriesfromDateTimeOffset?toDateTimeOffset?countlong?transactionIdlong?adapterIMessageAdapterskiplong?fillGapsFillGapsDays?
Returns
SubscribeCandles(ISubscriptionProvider, Security, DataType, DateTimeOffset?, DateTimeOffset?, long?, long?, IMessageAdapter, long?, FillGapsDays?)
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribeCandles(this ISubscriptionProvider provider, Security security, DataType dataType, DateTimeOffset? from = null, DateTimeOffset? to = null, long? count = null, long? transactionId = null, IMessageAdapter adapter = null, long? skip = null, FillGapsDays? fillGaps = null)
  Parameters
providerISubscriptionProvidersecuritySecuritydataTypeDataTypefromDateTimeOffset?toDateTimeOffset?countlong?transactionIdlong?adapterIMessageAdapterskiplong?fillGapsFillGapsDays?
Returns
SubscribeFilteredMarketDepth(ISubscriptionProvider, Security)
To start getting filtered quotes (order book) by the instrument. Quotes values are available through the event OrderBookReceived.
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribeFilteredMarketDepth(this ISubscriptionProvider provider, Security security)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecurityThe instrument by which quotes getting should be started.
Returns
- Subscription
 Subscription.
SubscribeLevel1(ISubscriptionProvider, Security, DateTimeOffset?, DateTimeOffset?, long?, MarketDataBuildModes, DataType, IMessageAdapter, long?, FillGapsDays?)
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribeLevel1(this ISubscriptionProvider provider, Security security, DateTimeOffset? from = null, DateTimeOffset? to = null, long? count = null, MarketDataBuildModes buildMode = MarketDataBuildModes.LoadAndBuild, DataType buildFrom = null, IMessageAdapter adapter = null, long? skip = null, FillGapsDays? fillGaps = null)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecurityThe instrument by which new information getting should be started.
fromDateTimeOffset?The initial date from which you need to get data.
toDateTimeOffset?The final date by which you need to get data.
countlong?Max count.
buildModeMarketDataBuildModesBuild mode.
buildFromDataTypeWhich market-data type is used as a source value.
adapterIMessageAdapterTarget adapter. Can be null.
skiplong?Skip count.
fillGapsFillGapsDays?
Returns
- Subscription
 Subscription.
SubscribeMarketData(ISubscriptionProvider, Security, MarketDataMessage)
To subscribe to get market data by the instrument.
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribeMarketData(this ISubscriptionProvider provider, Security security, MarketDataMessage message)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecurityThe instrument by which new information getting should be started.
messageMarketDataMessageThe message that contain subscribe info.
Returns
- Subscription
 Subscription.
SubscribeMarketData(ISubscriptionProvider, MarketDataMessage)
To subscribe to get market data.
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribeMarketData(this ISubscriptionProvider provider, MarketDataMessage message)
  Parameters
providerISubscriptionProviderSubscription provider.
messageMarketDataMessageThe message that contain subscribe info.
Returns
- Subscription
 Subscription.
SubscribeMarketDepth(ISubscriptionProvider, Security, DateTimeOffset?, DateTimeOffset?, long?, MarketDataBuildModes, DataType, int?, TimeSpan?, IOrderLogMarketDepthBuilder, bool, IMessageAdapter, long?, FillGapsDays?)
To start getting quotes (order book) by the instrument. Quotes values are available through the event OrderBookReceived.
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribeMarketDepth(this ISubscriptionProvider provider, Security security, DateTimeOffset? from = null, DateTimeOffset? to = null, long? count = null, MarketDataBuildModes buildMode = MarketDataBuildModes.LoadAndBuild, DataType buildFrom = null, int? maxDepth = null, TimeSpan? refreshSpeed = null, IOrderLogMarketDepthBuilder depthBuilder = null, bool passThroughOrderBookIncrement = false, IMessageAdapter adapter = null, long? skip = null, FillGapsDays? fillGaps = null)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecurityThe instrument by which quotes getting should be started.
fromDateTimeOffset?The initial date from which you need to get data.
toDateTimeOffset?The final date by which you need to get data.
countlong?Max count.
buildModeMarketDataBuildModesBuild mode.
buildFromDataTypeWhich market-data type is used as a source value.
maxDepthint?Max depth of requested order book.
refreshSpeedTimeSpan?Interval for data refresh.
depthBuilderIOrderLogMarketDepthBuilderOrder log to market depth builder.
passThroughOrderBookIncrementboolPass through incremental QuoteChangeMessage.
adapterIMessageAdapterTarget adapter. Can be null.
skiplong?Skip count.
fillGapsFillGapsDays?
Returns
- Subscription
 Subscription.
SubscribeNews(ISubscriptionProvider, Security, DateTimeOffset?, DateTimeOffset?, long?, IMessageAdapter, long?)
Subscribe on news.
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribeNews(this ISubscriptionProvider provider, Security security = null, DateTimeOffset? from = null, DateTimeOffset? to = null, long? count = null, IMessageAdapter adapter = null, long? skip = null)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecuritySecurity for subscription.
fromDateTimeOffset?The initial date from which you need to get data.
toDateTimeOffset?The final date by which you need to get data.
countlong?Max count.
adapterIMessageAdapterTarget adapter. Can be null.
skiplong?Skip count.
Returns
- Subscription
 Subscription.
SubscribeOrderLog(ISubscriptionProvider, Security, DateTimeOffset?, DateTimeOffset?, long?, IMessageAdapter, long?, FillGapsDays?)
Subscribe on order log for the security.
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribeOrderLog(this ISubscriptionProvider provider, Security security, DateTimeOffset? from = null, DateTimeOffset? to = null, long? count = null, IMessageAdapter adapter = null, long? skip = null, FillGapsDays? fillGaps = null)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecuritySecurity for subscription.
fromDateTimeOffset?The initial date from which you need to get data.
toDateTimeOffset?The final date by which you need to get data.
countlong?Max count.
adapterIMessageAdapterTarget adapter. Can be null.
skiplong?Skip count.
fillGapsFillGapsDays?
Returns
- Subscription
 Subscription.
SubscribeOrders(ISubscriptionProvider, Security, DateTimeOffset?, DateTimeOffset?, long?, IEnumerable<OrderStates>, IMessageAdapter, long?, FillGapsDays?)
Subscribe on orders changes.
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribeOrders(this ISubscriptionProvider provider, Security security = null, DateTimeOffset? from = null, DateTimeOffset? to = null, long? count = null, IEnumerable<OrderStates> states = null, IMessageAdapter adapter = null, long? skip = null, FillGapsDays? fillGaps = null)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecuritySecurity for subscription.
fromDateTimeOffset?The initial date from which you need to get data.
toDateTimeOffset?The final date by which you need to get data.
countlong?Max count.
statesIEnumerable<OrderStates>Filter order by the specified states.
adapterIMessageAdapterTarget adapter. Can be null.
skiplong?Skip count.
fillGapsFillGapsDays?
Returns
- Subscription
 Subscription.
SubscribeOrders(ISubscriptionProvider, OrderStatusMessage)
To find orders that match the filter criteria. Found orders will be passed through the event OrderReceived.
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribeOrders(this ISubscriptionProvider provider, OrderStatusMessage criteria)
  Parameters
providerISubscriptionProviderSubscription provider.
criteriaOrderStatusMessageThe order which fields will be used as a filter.
Returns
- Subscription
 Subscription.
SubscribePositions(ISubscriptionProvider, Security, Portfolio, DateTimeOffset?, DateTimeOffset?, long?, IMessageAdapter, long?, FillGapsDays?)
Subscribe on positions changes.
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribePositions(this ISubscriptionProvider provider, Security security = null, Portfolio portfolio = null, DateTimeOffset? from = null, DateTimeOffset? to = null, long? count = null, IMessageAdapter adapter = null, long? skip = null, FillGapsDays? fillGaps = null)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecurityThe instrument on which the position should be found.
portfolioPortfolioThe portfolio on which the position should be found.
fromDateTimeOffset?The initial date from which you need to get data.
toDateTimeOffset?The final date by which you need to get data.
countlong?Max count.
adapterIMessageAdapterTarget adapter. Can be null.
skiplong?Skip count.
fillGapsFillGapsDays?
Returns
- Subscription
 Subscription.
SubscribePositions(ISubscriptionProvider, PortfolioLookupMessage)
To find portfolios that match the filter criteria. Found portfolios will be passed through the event LookupPortfoliosResult.
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribePositions(this ISubscriptionProvider provider, PortfolioLookupMessage criteria)
  Parameters
providerISubscriptionProviderSubscription provider.
criteriaPortfolioLookupMessageThe criterion which fields will be used as a filter.
Returns
- Subscription
 Subscription.
SubscribeTrades(ISubscriptionProvider, Security, DateTimeOffset?, DateTimeOffset?, long?, MarketDataBuildModes, DataType, IMessageAdapter, long?, FillGapsDays?)
To start getting trades (tick data) by the instrument. New trades will come through the event TickTradeReceived.
[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription SubscribeTrades(this ISubscriptionProvider provider, Security security, DateTimeOffset? from = null, DateTimeOffset? to = null, long? count = null, MarketDataBuildModes buildMode = MarketDataBuildModes.LoadAndBuild, DataType buildFrom = null, IMessageAdapter adapter = null, long? skip = null, FillGapsDays? fillGaps = null)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecurityThe instrument by which trades getting should be started.
fromDateTimeOffset?The initial date from which you need to get data.
toDateTimeOffset?The final date by which you need to get data.
countlong?Max count.
buildModeMarketDataBuildModesBuild mode.
buildFromDataTypeWhich market-data type is used as a source value.
adapterIMessageAdapterTarget adapter. Can be null.
skiplong?Skip count.
fillGapsFillGapsDays?
Returns
- Subscription
 Subscription.
ToBasket(Security, IBasketSecurityProcessorProvider)
Convert Security to BasketSecurity value.
public static BasketSecurity ToBasket(this Security security, IBasketSecurityProcessorProvider processorProvider)
  Parameters
securitySecuritySecurity.
processorProviderIBasketSecurityProcessorProviderBasket security processors provider.
Returns
- BasketSecurity
 Instruments basket.
ToBasket<TBasketSecurity>(Security)
Convert Security to BasketSecurity value.
public static TBasketSecurity ToBasket<TBasketSecurity>(this Security security) where TBasketSecurity : BasketSecurity, new()
  Parameters
securitySecuritySecurity.
Returns
- TBasketSecurity
 Instruments basket.
Type Parameters
TBasketSecurityBasket security type.
ToBasket<TMessage>(IEnumerable<TMessage>, Security, IBasketSecurityProcessorProvider)
Convert inner securities messages to basket.
public static IEnumerable<TMessage> ToBasket<TMessage>(this IEnumerable<TMessage> innerSecMessages, Security security, IBasketSecurityProcessorProvider processorProvider) where TMessage : Message
  Parameters
innerSecMessagesIEnumerable<TMessage>Inner securities messages.
securitySecurityBasket security.
processorProviderIBasketSecurityProcessorProviderBasket security processors provider.
Returns
- IEnumerable<TMessage>
 Messages of basket securities.
Type Parameters
TMessageMessage type.
ToChannelState(ProcessStates)
Convert ProcessStates value to ChannelStates.
public static ChannelStates ToChannelState(this ProcessStates state)
  Parameters
stateProcessStatesProcessStates value.
Returns
- ChannelStates
 ChannelStates value.
ToOrderBooks(IEnumerable<OrderLogItem>, IOrderLogMarketDepthBuilder, TimeSpan, int)
Build market depths from order log.
[Obsolete("Use messages only.")]
public static IEnumerable<MarketDepth> ToOrderBooks(this IEnumerable<OrderLogItem> items, IOrderLogMarketDepthBuilder builder, TimeSpan interval = default, int maxDepth = 2147483647)
  Parameters
itemsIEnumerable<OrderLogItem>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<MarketDepth>
 Market depths.
ToPositionManager(Position)
[Obsolete]
public static IPositionManager ToPositionManager(this Position position)
  Parameters
positionPosition
Returns
ToProcessState(ChannelStates)
Convert ChannelStates value to ProcessStates.
public static ProcessStates ToProcessState(this ChannelStates state)
  Parameters
stateChannelStatesChannelStates value.
Returns
- ProcessStates
 ProcessStates value.
ToTimeQuotes(QuoteChangeMessage)
Convert depth to quotes.
public static IEnumerable<TimeQuoteChange> ToTimeQuotes(this QuoteChangeMessage message)
  Parameters
messageQuoteChangeMessageDepth.
Returns
- IEnumerable<TimeQuoteChange>
 Quotes.
ToTimeQuotes(IEnumerable<QuoteChangeMessage>)
Convert depths to quotes.
public static IEnumerable<TimeQuoteChange> ToTimeQuotes(this IEnumerable<QuoteChangeMessage> messages)
  Parameters
messagesIEnumerable<QuoteChangeMessage>Depths.
Returns
- IEnumerable<TimeQuoteChange>
 Quotes.
ToTrades(IEnumerable<OrderLogItem>)
To build tick trades from the orders log.
[Obsolete("Use messages only.")]
public static IEnumerable<Trade> ToTrades(this IEnumerable<OrderLogItem> items)
  Parameters
itemsIEnumerable<OrderLogItem>Orders log lines.
Returns
- IEnumerable<Trade>
 Tick trades.
TryGetAdapter(IPortfolioMessageAdapterProvider, IMessageAdapterProvider, Portfolio)
Get adapter by portfolio.
public static IMessageAdapter TryGetAdapter(this IPortfolioMessageAdapterProvider portfolioProvider, IMessageAdapterProvider adapterProvider, Portfolio portfolio)
  Parameters
portfolioProviderIPortfolioMessageAdapterProviderThe portfolio based message adapter's provider.
adapterProviderIMessageAdapterProviderThe message adapter's provider.
portfolioPortfolioPortfolio.
Returns
- IMessageAdapter
 Found adapter or null.
TryGetAdapter(IPortfolioMessageAdapterProvider, IEnumerable<IMessageAdapter>, Portfolio)
Get adapter by portfolio.
public static IMessageAdapter TryGetAdapter(this IPortfolioMessageAdapterProvider portfolioProvider, IEnumerable<IMessageAdapter> adapters, Portfolio portfolio)
  Parameters
portfolioProviderIPortfolioMessageAdapterProviderThe portfolio based message adapter's provider.
adaptersIEnumerable<IMessageAdapter>All available adapters.
portfolioPortfolioPortfolio.
Returns
- IMessageAdapter
 Found adapter or null.
UnSubscribe(ISubscriptionProvider, long)
[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribe(this ISubscriptionProvider provider, long subscriptionId)
  Parameters
providerISubscriptionProvidersubscriptionIdlong
UnSubscribeBoard(ISubscriptionProvider, ExchangeBoard)
[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribeBoard(this ISubscriptionProvider provider, ExchangeBoard board)
  Parameters
providerISubscriptionProviderboardExchangeBoard
UnSubscribeCandles(ISubscriptionProvider, CandleSeries)
[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribeCandles(this ISubscriptionProvider provider, CandleSeries series)
  Parameters
providerISubscriptionProviderseriesCandleSeries
UnSubscribeLevel1(ISubscriptionProvider, Security)
To stop getting new information.
[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribeLevel1(this ISubscriptionProvider provider, Security security)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecurityThe instrument by which new information getting should be stopped.
UnSubscribeMarketData(ISubscriptionProvider, Security, MarketDataMessage)
To unsubscribe from getting market data by the instrument.
[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribeMarketData(this ISubscriptionProvider provider, Security security, MarketDataMessage message)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecurityThe instrument by which new information getting should be started.
messageMarketDataMessageThe message that contain unsubscribe info.
UnSubscribeMarketData(ISubscriptionProvider, MarketDataMessage)
To unsubscribe from getting market data.
[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribeMarketData(this ISubscriptionProvider provider, MarketDataMessage message)
  Parameters
providerISubscriptionProviderSubscription provider.
messageMarketDataMessageThe message that contain unsubscribe info.
UnSubscribeMarketDepth(ISubscriptionProvider, Security)
To stop getting quotes by the instrument.
[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribeMarketDepth(this ISubscriptionProvider provider, Security security)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecurityThe instrument by which quotes getting should be stopped.
UnSubscribeNews(ISubscriptionProvider, Security)
Unsubscribe from news.
[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribeNews(this ISubscriptionProvider provider, Security security = null)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecuritySecurity for subscription.
UnSubscribeOrderLog(ISubscriptionProvider, Security)
Unsubscribe from order log for the security.
[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribeOrderLog(this ISubscriptionProvider provider, Security security)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecuritySecurity for unsubscription.
UnSubscribeOrders(ISubscriptionProvider, long)
[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribeOrders(this ISubscriptionProvider provider, long originalTransactionId = 0)
  Parameters
providerISubscriptionProvideroriginalTransactionIdlong
UnSubscribePositions(ISubscriptionProvider, long)
[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribePositions(this ISubscriptionProvider provider, long originalTransactionId = 0)
  Parameters
providerISubscriptionProvideroriginalTransactionIdlong
UnSubscribeTrades(ISubscriptionProvider, Security)
To stop getting trades (tick data) by the instrument.
[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribeTrades(this ISubscriptionProvider provider, Security security)
  Parameters
providerISubscriptionProviderSubscription provider.
securitySecurityThe instrument by which trades getting should be stopped.
Upload<TMessage>(IMessageAdapter, IEnumerable<TMessage>, TimeSpan)
Upload data.
public static void Upload<TMessage>(this IMessageAdapter adapter, IEnumerable<TMessage> messages, TimeSpan timeout) where TMessage : Message
  Parameters
adapterIMessageAdapterAdapter.
messagesIEnumerable<TMessage>Messages.
timeoutTimeSpanTimeout.
Type Parameters
TMessageRequest type.
ValidateId(ref string)
To check the correctness of the entered identifier.
public static string ValidateId(ref string id)
  Parameters
idstringSecurity ID.