Table of Contents

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

DataType

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

DateTime

Methods

AddAdapter(Connector, Type, Action<IMessageAdapter>)

public static IMessageAdapter AddAdapter(this Connector connector, Type adapterType, Action<IMessageAdapter> init)

Parameters

connector Connector

The class to create connections to trading systems.

adapterType Type

Adapter type.

init Action<IMessageAdapter>

Initialize adapter.

Returns

IMessageAdapter

The class to create connections to trading systems.

AddAdapter<TAdapter>(Connector, Action<TAdapter>)

public static TAdapter AddAdapter<TAdapter>(this Connector connector, Action<TAdapter> init) where TAdapter : IMessageAdapter

Parameters

connector Connector

The class to create connections to trading systems.

init Action<TAdapter>

Initialize adapter.

Returns

TAdapter

The class to create connections to trading systems.

Type Parameters

TAdapter

Adapter 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

receiver ILogReceiver

Logs receiver.

order Order

Order.

operation string

Order action name.

getAdditionalInfo Func<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

receiver ILogReceiver

Logs receiver.

order Order

Order.

operation string

Order action name.

getAdditionalInfo Func<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

price decimal

Price.

side Sides

The order direction, used as shift direction (for buy the shift is added, for sell - subtracted).

offset Unit

Price shift.

security Security

Security.

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

connector IConnector

The connection of interaction with trade systems.

orders IEnumerable<Order>

The group of orders, from which the required orders shall be found and cancelled.

isStopOrder bool?

true, if cancel only a stop orders, false - if regular orders, null - both.

portfolio Portfolio

Portfolio. If the value is equal to null, then the portfolio does not match the orders cancel filter.

side Sides?

Order side. If the value is null, the direction does not use.

board ExchangeBoard

Trading board. If the value is equal to null, then the board does not match the orders cancel filter.

security Security

Instrument. If the value is equal to null, then the instrument does not match the orders cancel filter.

securityType SecurityTypes?

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

expression string

Text expression.

tracker AssemblyLoadContextTracker

AssemblyLoadContextTracker

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

expression string

Text expression.

tracker AssemblyLoadContextTracker

AssemblyLoadContextTracker

cancellationToken CancellationToken

CancellationToken

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

expression string

Text expression.

tracker AssemblyLoadContextTracker

AssemblyLoadContextTracker

cancellationToken CancellationToken

CancellationToken

Returns

Task<ExpressionFormula<TResult>>

Compiled mathematical formula.

Type Parameters

TResult

Result type.

Compile<TResult>(string, AssemblyLoadContextTracker)

Compile mathematical formula.

public static ExpressionFormula<TResult> Compile<TResult>(this string expression, AssemblyLoadContextTracker tracker)

Parameters

expression string

Text expression.

tracker AssemblyLoadContextTracker

AssemblyLoadContextTracker

Returns

ExpressionFormula<TResult>

Compiled mathematical formula.

Type Parameters

TResult

Result 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

basketSecurity BasketSecurity

Instruments basket.

securityProvider ISecurityProvider

The provider of information about instruments.

security Security

The instrument that should be checked.

Returns

bool

true, if specified instrument is used now, otherwise false.

CreateProcessor(IBasketSecurityProcessorProvider, Security)

Create market data processor for basket securities.

public static IBasketSecurityProcessor CreateProcessor(this IBasketSecurityProcessorProvider processorProvider, Security security)

Parameters

processorProvider IBasketSecurityProcessorProvider

Basket security processors provider.

security Security

Basket security.

Returns

IBasketSecurityProcessor

Market data processor for basket securities.

DeleteAll(ISecurityStorage)

To delete all instruments.

public static void DeleteAll(this ISecurityStorage storage)

Parameters

storage ISecurityStorage

Securities meta info storage.

Download<TResult>(IMessageAdapter, Message, TimeSpan, out byte[])

Download data.

public static IEnumerable<TResult> Download<TResult>(this IMessageAdapter adapter, Message request, TimeSpan timeout, out byte[] archive) where TResult : Message

Parameters

adapter IMessageAdapter

Adapter.

request Message

Request.

timeout TimeSpan

Timeout.

archive byte[]

Result data was sent as archive.

Returns

IEnumerable<TResult>

Downloaded data.

Type Parameters

TResult

Result 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

depth MarketDepth

The order book to be cleared.

trades IEnumerable<ExecutionMessage>

Trades.

ExtractBoards(byte[])

Extract boards from the archive.

public static IEnumerable<BoardMessage> ExtractBoards(this byte[] archive)

Parameters

archive byte[]

The archive.

Returns

IEnumerable<BoardMessage>

Boards.

ExtractSecurities(byte[])

Extract securities from the archive.

public static IEnumerable<SecurityMessage> ExtractSecurities(this byte[] archive)

Parameters

archive byte[]

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

continuousSecurity ExpirationContinuousSecurity

Continuous security.

provider ISecurityProvider

The provider of information about instruments.

baseCode string

The base part of the instrument code.

from DateTime

The start of the expiration range.

to DateTime

The 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

myTrades IEnumerable<MyTrade>

All own trades, in which the required shall be looked for.

security Security

The 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

orders IEnumerable<Order>

All orders, in which the required shall be searched for.

security Security

The 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

positions IEnumerable<Position>

All positions, in which the required shall be searched for.

security Security

The 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

trades IEnumerable<Trade>

All trades, in which the required shall be searched for.

security Security

The 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

generator SecurityIdGenerator

SecurityIdGenerator

secCode string

Security code.

board ExchangeBoard

Security board.

Returns

string

Id security.

GetAllSecurity(ISecurityProvider)

Find AllSecurity instance in the specified provider.

public static Security GetAllSecurity(this ISecurityProvider provider)

Parameters

provider ISecurityProvider

The 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

order Order
connector IConnector

Returns

decimal

GetCancelReason(OrderLogItem)

To get the reason for cancelling order in orders log.

[Obsolete("Use messages only.")]
public static OrderLogCancelReasons GetCancelReason(this OrderLogItem item)

Parameters

item OrderLogItem

Order log item.

Returns

OrderLogCancelReasons

The reason for order cancelling in order log.

GetCandles(IMessageAdapter, TimeSpan, SecurityId, TimeSpan, DateTimeOffset, DateTimeOffset, long?, Level1Fields?, SecurityTypes?)

To download candles.

public static IEnumerable<TimeFrameCandleMessage> GetCandles(this IMessageAdapter adapter, TimeSpan timeout, SecurityId securityId, TimeSpan timeFrame, DateTimeOffset from, DateTimeOffset to, long? count = null, Level1Fields? buildField = null, SecurityTypes? secType = null)

Parameters

adapter IMessageAdapter

Adapter.

timeout TimeSpan

Timeout.

securityId SecurityId

Security ID.

timeFrame TimeSpan

Time-frame.

from DateTimeOffset

Begin period.

to DateTimeOffset

End period.

count long?

Candles count.

buildField Level1Fields?

Extra info for the BuildFrom.

secType SecurityTypes?

SecurityType.

Returns

IEnumerable<TimeFrameCandleMessage>

Downloaded candles.

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

bestPair MarketDepthPair

The best pair of quotes, used for the current price calculation.

side Sides

The order direction. If it is a buy, Ask value is used, otherwise Bid.

priceStep decimal?

PriceStep

priceType MarketPriceTypes

The type of current price.

Returns

Unit

The current price. If information in order book is insufficient, then null will be returned.

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

security Security

The instrument used for the current price calculation.

provider IMarketDataProvider

The market data provider.

direction Sides?

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

depth IOrderBookMessage

The order book for the current price calculation.

side Sides

The order direction. If it is a buy, BestAsk value is used, otherwise BestBid.

priceStep decimal?

PriceStep

priceType MarketPriceTypes

The type of current price.

orders IEnumerable<Order>

Orders to be ignored.

Returns

Unit

The current price. If information in order book is insufficient, then null will be returned.

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

position Position

The position value.

Returns

Sides?

Order side.

Remarks

A positive value equals Buy, a negative - Sell, zero - null.

GetDirection(decimal)

To get the order direction for the position.

public static Sides? GetDirection(this decimal position)

Parameters

position decimal

The position value.

Returns

Sides?

Order side.

Remarks

A positive value equals Buy, a negative - Sell, zero - null.

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

securityName string

Security name.

fromDate DateTime

Begin period.

toDate DateTime

End period.

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

continuousSecurity ExpirationContinuousSecurity

Continuous security.

provider ISecurityProvider

The provider of information about instruments.

baseCode string

The base part of the instrument code.

from DateTime

The start of the expiration range.

to DateTime

The end of the expiration range.

throwIfNotExists bool

To generate exception, if some of instruments for passed continuousSecurity are 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

baseCode string

The base part of the instrument code.

from DateTime

The start of the expiration range.

to DateTime

The end of the expiration range.

getSecurity Func<string, Security>

The function to get instrument by the code.

throwIfNotExists bool

To 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

securityId SecurityId

Security ID.

fromDate DateTime

Begin period.

toDate DateTime

End 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

securityName string

Security 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

security BasketSecurity

Instruments basket.

securityProvider ISecurityProvider

The provider of information about instruments.

Returns

IEnumerable<Security>

Instruments, from which this basket is created.

GetLevel1(IMessageAdapter, TimeSpan, SecurityId, DateTime, DateTime, int?, IEnumerable<Level1Fields>, SecurityTypes?)

To get level1 market data.

public static IEnumerable<Level1ChangeMessage> GetLevel1(this IMessageAdapter adapter, TimeSpan timeout, SecurityId securityId, DateTime beginDate, DateTime endDate, int? maxCount = null, IEnumerable<Level1Fields> fields = null, SecurityTypes? secType = null)

Parameters

adapter IMessageAdapter

Adapter.

timeout TimeSpan

Timeout.

securityId SecurityId

Security ID.

beginDate DateTime

Start date.

endDate DateTime

End date.

maxCount int?

Count

fields IEnumerable<Level1Fields>

Market data fields.

secType SecurityTypes?

SecurityType.

Returns

IEnumerable<Level1ChangeMessage>

Level1 market data.

GetMatchedVolume(Order, IConnector)

[Obsolete("Use subscriptions.")]
public static decimal GetMatchedVolume(this Order order, IConnector connector)

Parameters

order Order
connector IConnector

Returns

decimal

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

storage ISecurityStorage

Securities meta info storage.

id SecurityId

Security ID.

creator Func<string, Security>

Creator.

isNew bool

Is 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

storage IPositionStorage

Storage.

portfolioName string

Portfolio code name.

creator Func<string, Portfolio>

Creator.

isNew bool

Is 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

storage IPositionStorage

Storage.

portfolio Portfolio

Portfolio.

security Security

Security.

strategyId string

Strategy ID.

side Sides?

Side.

clientCode string

Client code.

depoName string

Depo name.

limitType TPlusLimits?

Limit type.

creator Func<Portfolio, Security, string, Sides?, string, string, TPlusLimits?, Position>

Creator.

isNew bool

Is newly created.

Returns

Position

Position.

GetOrderLog(IMessageAdapter, TimeSpan, SecurityId, DateTime, DateTime, int?, SecurityTypes?)

To get order log.

public static IEnumerable<ExecutionMessage> GetOrderLog(this IMessageAdapter adapter, TimeSpan timeout, SecurityId securityId, DateTime beginDate, DateTime endDate, int? maxCount = null, SecurityTypes? secType = null)

Parameters

adapter IMessageAdapter

Adapter.

timeout TimeSpan

Timeout.

securityId SecurityId

Security ID.

beginDate DateTime

Start date.

endDate DateTime

End date.

maxCount int?

Count

secType SecurityTypes?

SecurityType.

Returns

IEnumerable<ExecutionMessage>

Order log.

GetPnL(Portfolio)

To calculate profit-loss based on the portfolio.

public static decimal? GetPnL(this Portfolio portfolio)

Parameters

portfolio Portfolio

The 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

trade MyTrade

Own 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

message ExecutionMessage
byOrder bool

Returns

decimal?

GetSecurities(IMessageAdapter, TimeSpan, SecurityLookupMessage)

Download all securities.

public static IEnumerable<SecurityMessage> GetSecurities(this IMessageAdapter adapter, TimeSpan timeout, SecurityLookupMessage lookupMsg)

Parameters

adapter IMessageAdapter

Adapter.

timeout TimeSpan

Timeout.

lookupMsg SecurityLookupMessage

Message security lookup for specified criteria.

Returns

IEnumerable<SecurityMessage>

All securities.

GetSecurityCriteria(Connector, SecurityLookupMessage, IExchangeInfoProvider)

To create the search criteria Security from SecurityLookupMessage.

public static Security GetSecurityCriteria(this Connector connector, SecurityLookupMessage criteria, IExchangeInfoProvider exchangeInfoProvider)

Parameters

connector Connector

Connection to the trading system.

criteria SecurityLookupMessage

The criterion which fields will be used as a filter.

exchangeInfoProvider IExchangeInfoProvider

Exchanges 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

provider IMarketDataProvider

The market data provider.

security Security

Security.

field Level1Fields

Market-data field.

Returns

T

The field value. If no data, the null will be returned.

Type Parameters

T

The 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

provider IMarketDataProvider

The market data provider.

security Security

Security.

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

depth MarketDepth

The order book, reflecting situation on market at the moment of function call.

order Order

The 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

depth MarketDepth

The order book, reflecting situation on market at the moment of function call.

orderDirection Sides

Order side.

volume decimal

The 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

depth MarketDepth

The order book, reflecting situation on market at the moment of function call.

side Sides

Order side.

volume decimal

The volume, supposed to be implemented.

price decimal

The 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.

GetTicks(IMessageAdapter, TimeSpan, SecurityId, DateTime, DateTime, int?, SecurityTypes?)

To get tick data.

public static IEnumerable<ExecutionMessage> GetTicks(this IMessageAdapter adapter, TimeSpan timeout, SecurityId securityId, DateTime beginDate, DateTime endDate, int? maxCount = null, SecurityTypes? secType = null)

Parameters

adapter IMessageAdapter

Adapter.

timeout TimeSpan

Timeout.

securityId SecurityId

Security ID.

beginDate DateTime

Start date.

endDate DateTime

End date.

maxCount int?

Count

secType SecurityTypes?

SecurityType.

Returns

IEnumerable<ExecutionMessage>

Tick data.

GetTrades(Order, IConnector)

[Obsolete("Use subscriptions.")]
public static IEnumerable<MyTrade> GetTrades(this Order order, IConnector connector)

Parameters

order Order
connector IConnector

Returns

IEnumerable<MyTrade>

IsAssociated(SecurityId, ExchangeBoard)

Is specified security id associated with the board.

public static bool IsAssociated(this SecurityId securityId, ExchangeBoard board)

Parameters

securityId SecurityId

Security ID.

board ExchangeBoard

Board info.

Returns

bool

true, if associated, otherwise, false.

IsBasket(Security)

Is specified security is basket.

public static bool IsBasket(this Security security)

Parameters

security Security

Security.

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

item OrderLogItem

Order log item.

Returns

bool

true, if the order log contain the cancelled order, otherwise, false.

IsContinuous(Security)

Is specified security is continuous.

public static bool IsContinuous(this Security security)

Parameters

security Security

Security.

Returns

bool

Check result.

IsContinuous(SecurityMessage)

Is specified security is continuous.

public static bool IsContinuous(this SecurityMessage security)

Parameters

security SecurityMessage

Security.

Returns

bool

Check result.

IsIndex(Security)

Is specified security is index.

public static bool IsIndex(this Security security)

Parameters

security Security

Security.

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

item OrderLogItem

Order log item.

Returns

bool

true, if the order log contains order matching, otherwise, false.

IsMicex(ExchangeBoard)

Is MICEX board.

public static bool IsMicex(this ExchangeBoard board)

Parameters

board ExchangeBoard

Board 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

item OrderLogItem

Order log item.

Returns

bool

true, if the order log contains the order registration, otherwise, false.

IsStockSharp(News)

Determines whether the specified news related with StockSharp.

public static bool IsStockSharp(this News news)

Parameters

news News

News.

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

board ExchangeBoard

Board info.

time DateTimeOffset

The passed time to be checked.

Returns

bool

true, if time is traded, otherwise, not traded.

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

board ExchangeBoard

Board info.

time DateTimeOffset

The passed time to be checked.

isWorkingDay bool?

true, if the date is traded, otherwise, is not traded.

period WorkingTimePeriod

Current working time period.

Returns

bool

true, if time is traded, otherwise, not traded.

IsUxStock(ExchangeBoard)

Is the UX exchange stock market board.

public static bool IsUxStock(this ExchangeBoard board)

Parameters

board ExchangeBoard

Board 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

provider ISecurityProvider

The provider of information about instruments.

criteria Security

The 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

connector Connector

The connection of interaction with trade systems.

LookupAll(ISecurityProvider)

Get all available instruments.

public static IEnumerable<Security> LookupAll(this ISecurityProvider provider)

Parameters

provider ISecurityProvider

The 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

provider ISubscriptionProvider
criteria ExchangeBoard
adapter IMessageAdapter
offlineMode MessageOfflineModes

Returns

Subscription

LookupBoards(ISubscriptionProvider, BoardLookupMessage)

[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription LookupBoards(this ISubscriptionProvider provider, BoardLookupMessage criteria)

Parameters

provider ISubscriptionProvider
criteria BoardLookupMessage

Returns

Subscription

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

provider ISecurityProvider

The provider of information about instruments.

code string

Security code.

type SecurityTypes?

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

provider ISecurityProvider

The provider of information about instruments.

nativeIdStorage INativeIdStorage

Security native identifier storage.

storageName string

Storage name.

nativeId object

Native (internal) trading system security id.

Returns

Security

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

LookupDataTypes(ISubscriptionProvider, DataTypeLookupMessage)

[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription LookupDataTypes(this ISubscriptionProvider provider, DataTypeLookupMessage criteria)

Parameters

provider ISubscriptionProvider
criteria DataTypeLookupMessage

Returns

Subscription

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

provider ISubscriptionProvider
criteria Order
adapter IMessageAdapter
offlineMode MessageOfflineModes

Returns

Subscription

LookupOrders(ISubscriptionProvider, OrderStatusMessage)

[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription LookupOrders(this ISubscriptionProvider provider, OrderStatusMessage criteria)

Parameters

provider ISubscriptionProvider
criteria OrderStatusMessage

Returns

Subscription

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

provider ISubscriptionProvider
criteria Portfolio
adapter IMessageAdapter
offlineMode MessageOfflineModes

Returns

Subscription

LookupPortfolios(ISubscriptionProvider, PortfolioLookupMessage)

[Obsolete("Use ISubscriptionProvider.Subscribe method.")]
public static Subscription LookupPortfolios(this ISubscriptionProvider provider, PortfolioLookupMessage criteria)

Parameters

provider ISubscriptionProvider
criteria PortfolioLookupMessage

Returns

Subscription

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

provider ISubscriptionProvider

Subscription provider.

criteria Security

The criterion which fields will be used as a filter.

adapter IMessageAdapter

Target adapter. Can be null.

offlineMode MessageOfflineModes

Offline 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

provider ISubscriptionProvider

Subscription provider.

criteria SecurityLookupMessage

The 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

order Order

The order for which the price will be cut Price.

rule ShrinkRules

The 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

security Security

The instrument from which the PriceStep and Decimals values are taken.

price decimal

The price to be made multiple.

rule ShrinkRules

The 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

provider ISubscriptionProvider

Subscription provider.

board ExchangeBoard

Board for subscription.

from DateTimeOffset?

The initial date from which you need to get data.

to DateTimeOffset?

The final date by which you need to get data.

count long?

Max count.

adapter IMessageAdapter

Target adapter. Can be null.

skip long?

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

provider ISubscriptionProvider
series CandleSeries
from DateTimeOffset?
to DateTimeOffset?
count long?
transactionId long?
adapter IMessageAdapter
skip long?
fillGaps FillGapsDays?

Returns

Subscription

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

provider ISubscriptionProvider
security Security
dataType DataType
from DateTimeOffset?
to DateTimeOffset?
count long?
transactionId long?
adapter IMessageAdapter
skip long?
fillGaps FillGapsDays?

Returns

Subscription

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

provider ISubscriptionProvider

Subscription provider.

security Security

The instrument by which quotes getting should be started.

Returns

Subscription

Subscription.

SubscribeLevel1(ISubscriptionProvider, Security, DateTimeOffset?, DateTimeOffset?, long?, MarketDataBuildModes, DataType, IMessageAdapter, long?, FillGapsDays?)

To start getting new information (for example, LastTick or BestBid) by the instrument.

[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

provider ISubscriptionProvider

Subscription provider.

security Security

The instrument by which new information getting should be started.

from DateTimeOffset?

The initial date from which you need to get data.

to DateTimeOffset?

The final date by which you need to get data.

count long?

Max count.

buildMode MarketDataBuildModes

Build mode.

buildFrom DataType

Which market-data type is used as a source value.

adapter IMessageAdapter

Target adapter. Can be null.

skip long?

Skip count.

fillGaps FillGapsDays?

FillGapsDays

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

provider ISubscriptionProvider

Subscription provider.

security Security

The instrument by which new information getting should be started.

message MarketDataMessage

The 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

provider ISubscriptionProvider

Subscription provider.

message MarketDataMessage

The 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

provider ISubscriptionProvider

Subscription provider.

security Security

The instrument by which quotes getting should be started.

from DateTimeOffset?

The initial date from which you need to get data.

to DateTimeOffset?

The final date by which you need to get data.

count long?

Max count.

buildMode MarketDataBuildModes

Build mode.

buildFrom DataType

Which market-data type is used as a source value.

maxDepth int?

Max depth of requested order book.

refreshSpeed TimeSpan?

Interval for data refresh.

depthBuilder IOrderLogMarketDepthBuilder

Order log to market depth builder.

passThroughOrderBookIncrement bool

Pass through incremental QuoteChangeMessage.

adapter IMessageAdapter

Target adapter. Can be null.

skip long?

Skip count.

fillGaps FillGapsDays?

FillGapsDays

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

provider ISubscriptionProvider

Subscription provider.

security Security

Security for subscription.

from DateTimeOffset?

The initial date from which you need to get data.

to DateTimeOffset?

The final date by which you need to get data.

count long?

Max count.

adapter IMessageAdapter

Target adapter. Can be null.

skip long?

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

provider ISubscriptionProvider

Subscription provider.

security Security

Security for subscription.

from DateTimeOffset?

The initial date from which you need to get data.

to DateTimeOffset?

The final date by which you need to get data.

count long?

Max count.

adapter IMessageAdapter

Target adapter. Can be null.

skip long?

Skip count.

fillGaps FillGapsDays?

FillGapsDays

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

provider ISubscriptionProvider

Subscription provider.

security Security

Security for subscription.

from DateTimeOffset?

The initial date from which you need to get data.

to DateTimeOffset?

The final date by which you need to get data.

count long?

Max count.

states IEnumerable<OrderStates>

Filter order by the specified states.

adapter IMessageAdapter

Target adapter. Can be null.

skip long?

Skip count.

fillGaps FillGapsDays?

FillGapsDays

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

provider ISubscriptionProvider

Subscription provider.

criteria OrderStatusMessage

The 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

provider ISubscriptionProvider

Subscription provider.

security Security

The instrument on which the position should be found.

portfolio Portfolio

The portfolio on which the position should be found.

from DateTimeOffset?

The initial date from which you need to get data.

to DateTimeOffset?

The final date by which you need to get data.

count long?

Max count.

adapter IMessageAdapter

Target adapter. Can be null.

skip long?

Skip count.

fillGaps FillGapsDays?

FillGapsDays

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

provider ISubscriptionProvider

Subscription provider.

criteria PortfolioLookupMessage

The 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

provider ISubscriptionProvider

Subscription provider.

security Security

The instrument by which trades getting should be started.

from DateTimeOffset?

The initial date from which you need to get data.

to DateTimeOffset?

The final date by which you need to get data.

count long?

Max count.

buildMode MarketDataBuildModes

Build mode.

buildFrom DataType

Which market-data type is used as a source value.

adapter IMessageAdapter

Target adapter. Can be null.

skip long?

Skip count.

fillGaps FillGapsDays?

FillGapsDays

Returns

Subscription

Subscription.

ToBasket(Security, IBasketSecurityProcessorProvider)

Convert Security to BasketSecurity value.

public static BasketSecurity ToBasket(this Security security, IBasketSecurityProcessorProvider processorProvider)

Parameters

security Security

Security.

processorProvider IBasketSecurityProcessorProvider

Basket 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

security Security

Security.

Returns

TBasketSecurity

Instruments basket.

Type Parameters

TBasketSecurity

Basket 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

innerSecMessages IEnumerable<TMessage>

Inner securities messages.

security Security

Basket security.

processorProvider IBasketSecurityProcessorProvider

Basket security processors provider.

Returns

IEnumerable<TMessage>

Messages of basket securities.

Type Parameters

TMessage

Message type.

ToChannelState(ProcessStates)

Convert ProcessStates value to ChannelStates.

public static ChannelStates ToChannelState(this ProcessStates state)

Parameters

state ProcessStates

ProcessStates 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

items IEnumerable<OrderLogItem>

Orders log lines.

builder IOrderLogMarketDepthBuilder

Order log to market depth builder.

interval TimeSpan

The interval of the order book generation. The default is Zero, which means order books generation at each new item of orders log.

maxDepth int

The 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

position Position

Returns

IPositionManager

ToProcessState(ChannelStates)

Convert ChannelStates value to ProcessStates.

public static ProcessStates ToProcessState(this ChannelStates state)

Parameters

state ChannelStates

ChannelStates value.

Returns

ProcessStates

ProcessStates value.

ToTimeQuotes(QuoteChangeMessage)

Convert depth to quotes.

public static IEnumerable<TimeQuoteChange> ToTimeQuotes(this QuoteChangeMessage message)

Parameters

message QuoteChangeMessage

Depth.

Returns

IEnumerable<TimeQuoteChange>

Quotes.

ToTimeQuotes(IEnumerable<QuoteChangeMessage>)

Convert depths to quotes.

public static IEnumerable<TimeQuoteChange> ToTimeQuotes(this IEnumerable<QuoteChangeMessage> messages)

Parameters

messages IEnumerable<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

items IEnumerable<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

portfolioProvider IPortfolioMessageAdapterProvider

The portfolio based message adapter's provider.

adapterProvider IMessageAdapterProvider

The message adapter's provider.

portfolio Portfolio

Portfolio.

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

portfolioProvider IPortfolioMessageAdapterProvider

The portfolio based message adapter's provider.

adapters IEnumerable<IMessageAdapter>

All available adapters.

portfolio Portfolio

Portfolio.

Returns

IMessageAdapter

Found adapter or null.

UnSubscribe(ISubscriptionProvider, long)

[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribe(this ISubscriptionProvider provider, long subscriptionId)

Parameters

provider ISubscriptionProvider
subscriptionId long

UnSubscribeBoard(ISubscriptionProvider, ExchangeBoard)

[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribeBoard(this ISubscriptionProvider provider, ExchangeBoard board)

Parameters

provider ISubscriptionProvider
board ExchangeBoard

UnSubscribeCandles(ISubscriptionProvider, CandleSeries)

[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribeCandles(this ISubscriptionProvider provider, CandleSeries series)

Parameters

provider ISubscriptionProvider
series CandleSeries

UnSubscribeLevel1(ISubscriptionProvider, Security)

To stop getting new information.

[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribeLevel1(this ISubscriptionProvider provider, Security security)

Parameters

provider ISubscriptionProvider

Subscription provider.

security Security

The 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

provider ISubscriptionProvider

Subscription provider.

security Security

The instrument by which new information getting should be started.

message MarketDataMessage

The 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

provider ISubscriptionProvider

Subscription provider.

message MarketDataMessage

The 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

provider ISubscriptionProvider

Subscription provider.

security Security

The 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

provider ISubscriptionProvider

Subscription provider.

security Security

Security 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

provider ISubscriptionProvider

Subscription provider.

security Security

Security for unsubscription.

UnSubscribeOrders(ISubscriptionProvider, long)

[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribeOrders(this ISubscriptionProvider provider, long originalTransactionId = 0)

Parameters

provider ISubscriptionProvider
originalTransactionId long

UnSubscribePositions(ISubscriptionProvider, long)

[Obsolete("Use ISubscriptionProvider.UnSubscribe method.")]
public static void UnSubscribePositions(this ISubscriptionProvider provider, long originalTransactionId = 0)

Parameters

provider ISubscriptionProvider
originalTransactionId long

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

provider ISubscriptionProvider

Subscription provider.

security Security

The 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

adapter IMessageAdapter

Adapter.

messages IEnumerable<TMessage>

Messages.

timeout TimeSpan

Timeout.

Type Parameters

TMessage

Request type.

ValidateId(ref string)

To check the correctness of the entered identifier.

public static string ValidateId(ref string id)

Parameters

id string

Security ID.

Returns

string

An error message text, or null if no error.