Show / Hide Table of Contents

Class TraderHelper

The auxiliary class for provision of various algorithmic functionalities.

Inheritance
Object
TraderHelper
Namespace: StockSharp.Algo
Assembly: StockSharp.Algo.dll
Syntax
public static class TraderHelper : Object

Fields

LookupAllCriteria

Lookup all securities predefined criteria.

Declaration
public static readonly Security LookupAllCriteria
Field Value
Type Description
Security

MoneySecurity

"Money" security instance.

Declaration
public static readonly Security MoneySecurity
Field Value
Type Description
Security

NewsSecurity

"News" security instance.

Declaration
public static readonly Security NewsSecurity
Field Value
Type Description
Security

Properties

AllSecurity

"All securities" instance.

Declaration
public static Security AllSecurity { get; }
Property Value
Type Description
Security

IndicatorValue

Indicator value.

Declaration
public static DataType IndicatorValue { get; }
Property Value
Type Description
DataType

UsdRateMinAvailableTime

The earliest date for which there is an indicative rate of US dollar to the Russian ruble. It is 2 November 2009.

Declaration
public static DateTime UsdRateMinAvailableTime { get; }
Property Value
Type Description
DateTime

Methods

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

Create IMessageAdapter.

Declaration
public static Connector AddAdapter<TAdapter>(this Connector connector, Action<TAdapter> init)
    where TAdapter : IMessageAdapter
Parameters
Type Name Description
Connector connector

The class to create connections to trading systems.

Action<TAdapter> init

Initialize TAdapter.

Returns
Type Description
Connector

The class to create connections to trading systems.

Type Parameters
Name Description
TAdapter

Adapter type.

AddOrderErrorLog(ILogReceiver, Order, String, Func<String>)

Write order error to the log.

Declaration
public static void AddOrderErrorLog(this ILogReceiver receiver, Order order, string operation, Func<string> getAdditionalInfo = null)
Parameters
Type Name Description
ILogReceiver receiver

Logs receiver.

Order order

Order.

String operation

Order action name.

Func<String> getAdditionalInfo

Extended order info.

AddOrderInfoLog(ILogReceiver, Order, String, Func<String>)

Write order info to the log.

Declaration
public static void AddOrderInfoLog(this ILogReceiver receiver, Order order, string operation, Func<string> getAdditionalInfo = null)
Parameters
Type Name Description
ILogReceiver receiver

Logs receiver.

Order order

Order.

String operation

Order action name.

Func<String> getAdditionalInfo

Extended order info.

AddOrSubtractTradingDays(ExchangeBoard, DateTimeOffset, Int32, Boolean)

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

Declaration
public static DateTimeOffset AddOrSubtractTradingDays(this ExchangeBoard board, DateTimeOffset date, int n, bool checkHolidays = true)
Parameters
Type Name Description
ExchangeBoard board

Board info.

DateTimeOffset date

The start T date, to which are added or subtracted N trading days.

Int32 n

The N size. The number of trading days for the addition or subtraction.

Boolean checkHolidays

Whether to check the passed date for a weekday (Saturday and Sunday are days off, returned value for them is false).

Returns
Type Description
DateTimeOffset

The end T +/- N date.

ApplyChanges(Portfolio, PositionChangeMessage, IExchangeInfoProvider)

Apply changes to the portfolio object.

Declaration
public static void ApplyChanges(this Portfolio portfolio, PositionChangeMessage message, IExchangeInfoProvider exchangeInfoProvider)
Parameters
Type Name Description
Portfolio portfolio

Portfolio.

PositionChangeMessage message

Portfolio change message.

IExchangeInfoProvider exchangeInfoProvider

Exchanges and trading boards provider.

ApplyChanges(Position, PositionChangeMessage)

Apply changes to the position object.

Declaration
public static void ApplyChanges(this Position position, PositionChangeMessage message)
Parameters
Type Name Description
Position position

Position.

PositionChangeMessage message

Position change message.

ApplyChanges(Security, Level1ChangeMessage)

Apply change to the security object.

Declaration
public static void ApplyChanges(this Security security, Level1ChangeMessage message)
Parameters
Type Name Description
Security security

Security.

Level1ChangeMessage message

Changes.

ApplyChanges(Security, SecurityMessage, IExchangeInfoProvider, Boolean)

Apply change to the security object.

Declaration
public static void ApplyChanges(this Security security, SecurityMessage message, IExchangeInfoProvider exchangeInfoProvider, bool isOverride = true)
Parameters
Type Name Description
Security security

Security.

SecurityMessage message

Meta info.

IExchangeInfoProvider exchangeInfoProvider

Exchanges and trading boards provider.

Boolean isOverride

Override previous security data by new values.

ApplyChanges(Security, IEnumerable<KeyValuePair<Level1Fields, Object>>, DateTimeOffset, DateTimeOffset, Action<Security, Level1Fields, Object>)

Apply change to the security object.

Declaration
public static void ApplyChanges(this Security security, IEnumerable<KeyValuePair<Level1Fields, object>> changes, DateTimeOffset serverTime, DateTimeOffset localTime, Action<Security, Level1Fields, object> defaultHandler = null)
Parameters
Type Name Description
Security security

Security.

IEnumerable<KeyValuePair<Level1Fields, Object>> changes

Changes.

DateTimeOffset serverTime

Change server time.

DateTimeOffset localTime

Local timestamp when a message was received/created.

Action<Security, Level1Fields, Object> defaultHandler

Default handler.

ApplyNewBalance(Nullable<Decimal>, Decimal, Int64, ILogReceiver)

Check the possibility Balance change.

Declaration
public static Decimal ApplyNewBalance(this Nullable<Decimal> currBal, Decimal newBal, long transactionId, ILogReceiver logs)
Parameters
Type Name Description
Nullable<Decimal> currBal

Current balance.

Decimal newBal

New balance.

Int64 transactionId

Transaction id.

ILogReceiver logs

Logs.

Returns
Type Description
Decimal

New balance.

ApplyNewState(Order, OrderStates, ILogReceiver)

Check the possibility order's state change.

Declaration
public static void ApplyNewState(this Order order, OrderStates state, ILogReceiver logs = null)
Parameters
Type Name Description
Order order

Order.

OrderStates state

Current order's state.

ILogReceiver logs

Logs.

ApplyOffset(Unit, Sides, Unit, Security)

To use shifting for price, depending on direction side.

Declaration
public static Decimal ApplyOffset(this Unit price, Sides side, Unit offset, Security security)
Parameters
Type Name Description
Unit price

Price.

Sides side

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

Unit offset

Price shift.

Security security

Security.

Returns
Type Description
Decimal

New price.

CancelOrders(IConnector, IEnumerable<Order>, Nullable<Boolean>, Portfolio, Nullable<Sides>, ExchangeBoard, Security, Nullable<SecurityTypes>)

Cancel orders by filter.

Declaration
public static void CancelOrders(this IConnector connector, IEnumerable<Order> orders, Nullable<bool> isStopOrder = null, Portfolio portfolio = null, Nullable<Sides> direction = null, ExchangeBoard board = null, Security security = null, Nullable<SecurityTypes> securityType = null)
Parameters
Type Name Description
IConnector connector

The connection of interaction with trade systems.

IEnumerable<Order> orders

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

Nullable<Boolean> isStopOrder

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.

Nullable<Sides> direction

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

ExchangeBoard board

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.

Nullable<SecurityTypes> securityType

Security type. If the value is null, the type does not use.

ChangeSubscriptionState(SubscriptionStates, SubscriptionStates, Int64, ILogReceiver, Boolean)

Change subscription state.

Declaration
public static SubscriptionStates ChangeSubscriptionState(this SubscriptionStates currState, SubscriptionStates newState, long subscriptionId, ILogReceiver receiver, bool isInfoLevel = true)
Parameters
Type Name Description
SubscriptionStates currState

Current state.

SubscriptionStates newState

New state.

Int64 subscriptionId

Subscription id.

ILogReceiver receiver

Logs.

Boolean isInfoLevel

Use Info for log message.

Returns
Type Description
SubscriptionStates

New state.

Compile(String, Boolean)

Compile mathematical formula.

Declaration
public static ExpressionFormula Compile(this string expression, bool useIds = true)
Parameters
Type Name Description
String expression

Text expression.

Boolean useIds

Use ids as variables.

Returns
Type Description
Ecng.ComponentModel.Expressions.ExpressionFormula

Compiled mathematical formula.

Contains(BasketSecurity, ISecurityProvider, Security)

To check whether specified instrument is used now.

Declaration
public static bool Contains(this BasketSecurity basketSecurity, ISecurityProvider securityProvider, Security security)
Parameters
Type Name Description
BasketSecurity basketSecurity

Instruments basket.

ISecurityProvider securityProvider

The provider of information about instruments.

Security security

The instrument that should be checked.

Returns
Type Description
Boolean

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

CreateProcessor(IBasketSecurityProcessorProvider, Security)

Create market data processor for basket securities.

Declaration
public static IBasketSecurityProcessor CreateProcessor(this IBasketSecurityProcessorProvider processorProvider, Security security)
Parameters
Type Name Description
IBasketSecurityProcessorProvider processorProvider

Basket security processors provider.

Security security

Basket security.

Returns
Type Description
IBasketSecurityProcessor

Market data processor for basket securities.

DeleteAll(ISecurityStorage)

To delete all instruments.

Declaration
public static void DeleteAll(this ISecurityStorage storage)
Parameters
Type Name Description
ISecurityStorage storage

Securities meta info storage.

Download<TResult>(IMessageAdapter, Message)

Download data.

Declaration
public static IEnumerable<TResult> Download<TResult>(this IMessageAdapter adapter, Message request)
    where TResult : Message
Parameters
Type Name Description
IMessageAdapter adapter

Adapter.

Message request

Request.

Returns
Type Description
IEnumerable<TResult>

Downloaded data.

Type Parameters
Name Description
TResult

Result message.

DownloadInfo(IDictionary<Tuple<String, SecurityTypes>, SecurityMessage>)

Download securities info.

Declaration
public static void DownloadInfo(this IDictionary<Tuple<string, SecurityTypes>, SecurityMessage> securities)
Parameters
Type Name Description
IDictionary<Tuple<String, SecurityTypes>, SecurityMessage> securities

Securities.

EmulateTrades(MarketDepth, IEnumerable<ExecutionMessage>)

To delete in order book levels, which shall disappear in case of trades occurrence trades.

Declaration
public static void EmulateTrades(this MarketDepth depth, IEnumerable<ExecutionMessage> trades)
Parameters
Type Name Description
MarketDepth depth

The order book to be cleared.

IEnumerable<ExecutionMessage> trades

Trades.

FillFortsJumps(ExpirationContinuousSecurity, ISecurityProvider, String, DateTime, DateTime)

To fill transitions ExpirationJumps.

Declaration
public static void FillFortsJumps(this ExpirationContinuousSecurity continuousSecurity, ISecurityProvider provider, string baseCode, DateTime from, DateTime to)
Parameters
Type Name Description
ExpirationContinuousSecurity continuousSecurity

Continuous security.

ISecurityProvider provider

The provider of information about instruments.

String baseCode

The base part of the instrument code.

DateTime from

The start of the expiration range.

DateTime to

The end of the expiration range.

Filter(IEnumerable<ExchangeBoard>, BoardLookupMessage)

Filter boards by code criteria.

Declaration
public static IEnumerable<ExchangeBoard> Filter(this IEnumerable<ExchangeBoard> boards, BoardLookupMessage criteria)
Parameters
Type Name Description
IEnumerable<ExchangeBoard> boards

All boards.

BoardLookupMessage criteria

Criteria.

Returns
Type Description
IEnumerable<ExchangeBoard>

Found boards.

Filter(IEnumerable<MyTrade>, Order)

To filter own trades for the given order.

Declaration
public static IEnumerable<MyTrade> Filter(this IEnumerable<MyTrade> myTrades, Order order)
Parameters
Type Name Description
IEnumerable<MyTrade> myTrades

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

Order order

The order, for which trades shall be filtered.

Returns
Type Description
IEnumerable<MyTrade>

Filtered orders.

Filter(IEnumerable<MyTrade>, Portfolio)

To filter own trades for the given portfolio.

Declaration
public static IEnumerable<MyTrade> Filter(this IEnumerable<MyTrade> myTrades, Portfolio portfolio)
Parameters
Type Name Description
IEnumerable<MyTrade> myTrades

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

Portfolio portfolio

The portfolio, for which the trades shall be filtered.

Returns
Type Description
IEnumerable<MyTrade>

Filtered trades.

Filter(IEnumerable<MyTrade>, Security)

To filter own trades for the given instrument.

Declaration
public static IEnumerable<MyTrade> Filter(this IEnumerable<MyTrade> myTrades, Security security)
Parameters
Type Name Description
IEnumerable<MyTrade> myTrades

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

Security security

The instrument, on which the trades shall be found.

Returns
Type Description
IEnumerable<MyTrade>

Filtered trades.

Filter(IEnumerable<Order>, Portfolio)

To filter orders for the given portfolio.

Declaration
public static IEnumerable<Order> Filter(this IEnumerable<Order> orders, Portfolio portfolio)
Parameters
Type Name Description
IEnumerable<Order> orders

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

Portfolio portfolio

The portfolio, for which the orders shall be filtered.

Returns
Type Description
IEnumerable<Order>

Filtered orders.

Filter(IEnumerable<Order>, Security)

To filter orders for the given instrument.

Declaration
public static IEnumerable<Order> Filter(this IEnumerable<Order> orders, Security security)
Parameters
Type Name Description
IEnumerable<Order> orders

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

Security security

The instrument, for which the orders shall be filtered.

Returns
Type Description
IEnumerable<Order>

Filtered orders.

Filter(IEnumerable<Order>, OrderStates)

To filter orders for the given condition.

Declaration
public static IEnumerable<Order> Filter(this IEnumerable<Order> orders, OrderStates state)
Parameters
Type Name Description
IEnumerable<Order> orders

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

OrderStates state

Order state.

Returns
Type Description
IEnumerable<Order>

Filtered orders.

Filter(IEnumerable<Order>, Sides)

To filter orders for the given direction.

Declaration
public static IEnumerable<Order> Filter(this IEnumerable<Order> orders, Sides direction)
Parameters
Type Name Description
IEnumerable<Order> orders

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

Sides direction

Order side.

Returns
Type Description
IEnumerable<Order>

Filtered orders.

Filter(IEnumerable<Portfolio>, PortfolioLookupMessage)

Filter portfolios by the specified criteria.

Declaration
public static IEnumerable<Portfolio> Filter(this IEnumerable<Portfolio> portfolios, PortfolioLookupMessage criteria)
Parameters
Type Name Description
IEnumerable<Portfolio> portfolios

All portfolios.

PortfolioLookupMessage criteria

Criteria.

Returns
Type Description
IEnumerable<Portfolio>

Found portfolios.

Filter(IEnumerable<Position>, Portfolio)

To filter positions for the given portfolio.

Declaration
public static IEnumerable<Position> Filter(this IEnumerable<Position> positions, Portfolio portfolio)
Parameters
Type Name Description
IEnumerable<Position> positions

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

Portfolio portfolio

The portfolio, for which positions shall be filtered.

Returns
Type Description
IEnumerable<Position>

Filtered positions.

Filter(IEnumerable<Position>, Security)

To filter positions for the given instrument.

Declaration
public static IEnumerable<Position> Filter(this IEnumerable<Position> positions, Security security)
Parameters
Type Name Description
IEnumerable<Position> positions

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

Security security

The instrument, for which positions shall be filtered.

Returns
Type Description
IEnumerable<Position>

Filtered positions.

Filter(IEnumerable<Position>, PortfolioLookupMessage)

Filter positions the specified criteria.

Declaration
public static IEnumerable<Position> Filter(this IEnumerable<Position> positions, PortfolioLookupMessage criteria)
Parameters
Type Name Description
IEnumerable<Position> positions

All positions.

PortfolioLookupMessage criteria

Criteria.

Returns
Type Description
IEnumerable<Position>

Found positions.

Filter(IEnumerable<Security>, ExchangeBoard)

To filter instruments by the trading board.

Declaration
public static IEnumerable<Security> Filter(this IEnumerable<Security> securities, ExchangeBoard board)
Parameters
Type Name Description
IEnumerable<Security> securities

Securities.

ExchangeBoard board

Trading board.

Returns
Type Description
IEnumerable<Security>

Instruments filtered.

Filter(IEnumerable<Security>, Security)

To filter instruments by the given criteria.

Declaration
public static IEnumerable<Security> Filter(this IEnumerable<Security> securities, Security criteria)
Parameters
Type Name Description
IEnumerable<Security> securities

Securities.

Security criteria

The instrument whose fields will be used as a filter.

Returns
Type Description
IEnumerable<Security>

Instruments filtered.

Filter(IEnumerable<Security>, SecurityLookupMessage)

To filter instruments by the given criteria.

Declaration
public static IEnumerable<Security> Filter(this IEnumerable<Security> securities, SecurityLookupMessage criteria)
Parameters
Type Name Description
IEnumerable<Security> securities

Securities.

SecurityLookupMessage criteria

Message security lookup for specified criteria.

Returns
Type Description
IEnumerable<Security>

Instruments filtered.

Filter(IEnumerable<Trade>, Security)

To filter orders for the given instrument.

Declaration
public static IEnumerable<Trade> Filter(this IEnumerable<Trade> trades, Security security)
Parameters
Type Name Description
IEnumerable<Trade> trades

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

Security security

The instrument, for which the trades shall be filtered.

Returns
Type Description
IEnumerable<Trade>

Filtered trades.

Filter(IEnumerable<Trade>, DateTimeOffset, DateTimeOffset)

To filter trades for the given time period.

Declaration
public static IEnumerable<Trade> Filter(this IEnumerable<Trade> trades, DateTimeOffset from, DateTimeOffset to)
Parameters
Type Name Description
IEnumerable<Trade> trades

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

DateTimeOffset from

The start date for trades searching.

DateTimeOffset to

The end date for trades searching.

Returns
Type Description
IEnumerable<Trade>

Filtered trades.

GenerateId(SecurityIdGenerator, String, ExchangeBoard)

Declaration
public static string GenerateId(this SecurityIdGenerator generator, string secCode, ExchangeBoard board)
Parameters
Type Name Description
SecurityIdGenerator generator
String secCode
ExchangeBoard board
Returns
Type Description
String

GetAllSecurity(ISecurityProvider)

Find AllSecurity instance in the specified provider.

Declaration
public static Security GetAllSecurity(this ISecurityProvider provider)
Parameters
Type Name Description
ISecurityProvider provider

The provider of information about instruments.

Returns
Type Description
Security

Found instance.

GetAveragePrice(Order, IConnector)

To get weighted mean price of order matching.

Declaration
public static Decimal GetAveragePrice(this Order order, IConnector connector)
Parameters
Type Name Description
Order order

The order, for which the weighted mean matching price shall be got.

IConnector connector

The connection of interaction with trade systems.

Returns
Type Description
Decimal

The weighted mean price. If no order exists no trades, 0 is returned.

GetAveragePrice(IEnumerable<MyTrade>)

To get the weighted mean price of matching by own trades.

Declaration
public static Decimal GetAveragePrice(this IEnumerable<MyTrade> trades)
Parameters
Type Name Description
IEnumerable<MyTrade> trades

Trades, for which the weighted mean price of matching shall be got.

Returns
Type Description
Decimal

The weighted mean price. If no trades, 0 is returned.

GetCandles(IMessageAdapter, SecurityId, TimeSpan, DateTimeOffset, DateTimeOffset, Nullable<Int64>, Nullable<Level1Fields>)

To download candles.

Declaration
public static IEnumerable<TimeFrameCandleMessage> GetCandles(this IMessageAdapter adapter, SecurityId securityId, TimeSpan timeFrame, DateTimeOffset from, DateTimeOffset to, Nullable<long> count = null, Nullable<Level1Fields> buildField = null)
Parameters
Type Name Description
IMessageAdapter adapter

Adapter.

SecurityId securityId

Security ID.

TimeSpan timeFrame

Time-frame.

DateTimeOffset from

Begin period.

DateTimeOffset to

End period.

Nullable<Int64> count

Candles count.

Nullable<Level1Fields> buildField

Extra info for the BuildFrom.

Returns
Type Description
IEnumerable<TimeFrameCandleMessage>

Downloaded candles.

GetCurrentPrice(MarketDepth, Sides, MarketPriceTypes, IEnumerable<Order>)

To calculate the current price by the order book depending on the order direction.

Declaration
public static Unit GetCurrentPrice(this MarketDepth depth, Sides side, MarketPriceTypes priceType, IEnumerable<Order> orders = null)
Parameters
Type Name Description
MarketDepth depth

The order book for the current price calculation.

Sides side

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

MarketPriceTypes priceType

The type of current price.

IEnumerable<Order> orders

Orders to be ignored.

Returns
Type Description
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(MarketDepthPair, Sides, MarketPriceTypes)

To calculate the current price based on the best pair of quotes, depending on the order direction.

Declaration
public static Unit GetCurrentPrice(this MarketDepthPair bestPair, Sides side, MarketPriceTypes priceType)
Parameters
Type Name Description
MarketDepthPair bestPair

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

Sides side

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

MarketPriceTypes priceType

The type of current price.

Returns
Type Description
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, Nullable<Sides>, MarketPriceTypes, IEnumerable<Order>)

To calculate the current price by the instrument depending on the order direction.

Declaration
public static Unit GetCurrentPrice(this Security security, IMarketDataProvider provider, Nullable<Sides> direction = null, MarketPriceTypes priceType, IEnumerable<Order> orders = null)
Parameters
Type Name Description
Security security

The instrument used for the current price calculation.

IMarketDataProvider provider

The market data provider.

Nullable<Sides> direction

Order side.

MarketPriceTypes priceType

The type of market price.

IEnumerable<Order> orders

Orders to be ignored.

Returns
Type Description
Unit

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

GetDirection(Position)

To get the order direction for the position.

Declaration
public static Nullable<Sides> GetDirection(this Position position)
Parameters
Type Name Description
Position position

The position value.

Returns
Type Description
Nullable<Sides>

Order side.

Remarks

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

GetDirection(Decimal)

To get the order direction for the position.

Declaration
public static Nullable<Sides> GetDirection(this Decimal position)
Parameters
Type Name Description
Decimal position

The position value.

Returns
Type Description
Nullable<Sides>

Order side.

Remarks

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

GetExpiryDates(DateTime, DateTime)

To get the expiration date for Forts.

Declaration
public static IEnumerable<DateTimeOffset> GetExpiryDates(this DateTime from, DateTime to)
Parameters
Type Name Description
DateTime from

The start of the expiration range.

DateTime to

The end of the expiration range.

Returns
Type Description
IEnumerable<DateTimeOffset>

Expiration dates.

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.

Declaration
public static IEnumerable<Level1ChangeMessage> GetFortsEndOfDay(this string securityName, DateTime fromDate, DateTime toDate)
Parameters
Type Name Description
String securityName

Security name.

DateTime fromDate

Begin period.

DateTime toDate

End period.

Returns
Type Description
IEnumerable<Level1ChangeMessage>

Historical market-data.

GetFortsJumps(ExpirationContinuousSecurity, ISecurityProvider, String, DateTime, DateTime, Boolean)

To get real expiration instruments for the continuous instrument.

Declaration
public static IEnumerable<Security> GetFortsJumps(this ExpirationContinuousSecurity continuousSecurity, ISecurityProvider provider, string baseCode, DateTime from, DateTime to, bool throwIfNotExists = true)
Parameters
Type Name Description
ExpirationContinuousSecurity continuousSecurity

Continuous security.

ISecurityProvider provider

The provider of information about instruments.

String baseCode

The base part of the instrument code.

DateTime from

The start of the expiration range.

DateTime to

The end of the expiration range.

Boolean throwIfNotExists

To generate exception, if some of instruments for passed continuousSecurity are not available.

Returns
Type Description
IEnumerable<Security>

Expiration instruments.

GetFortsJumps(String, DateTime, DateTime, Func<String, Security>, Boolean)

To get real expiration instruments for base part of the code.

Declaration
public static IEnumerable<Security> GetFortsJumps(this string baseCode, DateTime from, DateTime to, Func<string, Security> getSecurity, bool throwIfNotExists = true)
Parameters
Type Name Description
String baseCode

The base part of the instrument code.

DateTime from

The start of the expiration range.

DateTime to

The end of the expiration range.

Func<String, Security> getSecurity

The function to get instrument by the code.

Boolean throwIfNotExists

To generate exception, if some of instruments are not available.

Returns
Type Description
IEnumerable<Security>

Expiration instruments.

GetFortsRate(SecurityId, DateTime, DateTime)

To get an indicative exchange rate of a currency pair.

Declaration
public static IDictionary<DateTimeOffset, Decimal> GetFortsRate(this SecurityId securityId, DateTime fromDate, DateTime toDate)
Parameters
Type Name Description
SecurityId securityId

Security ID.

DateTime fromDate

Begin period.

DateTime toDate

End period.

Returns
Type Description
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.

Declaration
public static Level1ChangeMessage GetFortsYesterdayEndOfDay(this string securityName)
Parameters
Type Name Description
String securityName

Security name.

Returns
Type Description
Level1ChangeMessage

Yesterday's market-data.

Remarks

Date is determined by the system time.

GetInnerSecurities(BasketSecurity, ISecurityProvider)

Find inner security instances.

Declaration
public static IEnumerable<Security> GetInnerSecurities(this BasketSecurity security, ISecurityProvider securityProvider)
Parameters
Type Name Description
BasketSecurity security

Instruments basket.

ISecurityProvider securityProvider

The provider of information about instruments.

Returns
Type Description
IEnumerable<Security>

Instruments, from which this basket is created.

GetLevel1(IMessageAdapter, SecurityId, DateTime, DateTime, IEnumerable<Level1Fields>)

To get level1 market data.

Declaration
public static IEnumerable<Level1ChangeMessage> GetLevel1(this IMessageAdapter adapter, SecurityId securityId, DateTime beginDate, DateTime endDate, IEnumerable<Level1Fields> fields = null)
Parameters
Type Name Description
IMessageAdapter adapter

Adapter.

SecurityId securityId

Security ID.

DateTime beginDate

Start date.

DateTime endDate

End date.

IEnumerable<Level1Fields> fields

Market data fields.

Returns
Type Description
IEnumerable<Level1ChangeMessage>

Level1 market data.

GetMatchedVolume(Order)

To calculate the implemented part of volume for order.

Declaration
public static Decimal GetMatchedVolume(this Order order)
Parameters
Type Name Description
Order order

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

Returns
Type Description
Decimal

The implemented part of volume.

GetMatchedVolume(Order, IConnector)

To calculate the implemented part of volume for order.

Declaration
public static Decimal GetMatchedVolume(this Order order, IConnector connector)
Parameters
Type Name Description
Order order

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

IConnector connector

The connection of interaction with trade systems.

Returns
Type Description
Decimal

The implemented part of volume.

GetOrCreate(ISecurityStorage, SecurityId, Func<String, Security>, out Boolean)

Get or create (if not exist).

Declaration
public static Security GetOrCreate(this ISecurityStorage storage, SecurityId id, Func<string, Security> creator, out bool isNew)
Parameters
Type Name Description
ISecurityStorage storage

Securities meta info storage.

SecurityId id

Security ID.

Func<String, Security> creator

Creator.

Boolean isNew

Is newly created.

Returns
Type Description
Security

Security.

GetOrCreateBoard(IExchangeInfoProvider, String, out Boolean, Func<String, ExchangeBoard>)

To get a board by its code. If board with the passed name does not exist, then it will be created.

Declaration
public static ExchangeBoard GetOrCreateBoard(this IExchangeInfoProvider exchangeInfoProvider, string code, out bool isNew, Func<string, ExchangeBoard> createBoard = null)
Parameters
Type Name Description
IExchangeInfoProvider exchangeInfoProvider

Exchanges and trading boards provider.

String code

Board code.

Boolean isNew

Is newly created.

Func<String, ExchangeBoard> createBoard

The handler creating a board, if it is not found. If the value is null, then the board is created by default initialization.

Returns
Type Description
ExchangeBoard

Exchange board.

GetOrCreateBoard(IExchangeInfoProvider, String, Func<String, ExchangeBoard>)

To get a board by its code. If board with the passed name does not exist, then it will be created.

Declaration
public static ExchangeBoard GetOrCreateBoard(this IExchangeInfoProvider exchangeInfoProvider, string code, Func<string, ExchangeBoard> createBoard = null)
Parameters
Type Name Description
IExchangeInfoProvider exchangeInfoProvider

Exchanges and trading boards provider.

String code

Board code.

Func<String, ExchangeBoard> createBoard

The handler creating a board, if it is not found. If the value is null, then the board is created by default initialization.

Returns
Type Description
ExchangeBoard

Exchange board.

GetOrCreatePortfolio(IPositionStorage, String, Func<String, Portfolio>, out Boolean)

Get or create (if not exist).

Declaration
public static Portfolio GetOrCreatePortfolio(this IPositionStorage storage, string portfolioName, Func<string, Portfolio> creator, out bool isNew)
Parameters
Type Name Description
IPositionStorage storage

Storage.

String portfolioName

Portfolio code name.

Func<String, Portfolio> creator

Creator.

Boolean isNew

Is newly created.

Returns
Type Description
Portfolio

Portfolio.

GetOrCreatePosition(IPositionStorage, Portfolio, Security, String, Nullable<Sides>, String, String, Nullable<TPlusLimits>, Func<Portfolio, Security, String, Nullable<Sides>, String, String, Nullable<TPlusLimits>, Position>, out Boolean)

Get or create (if not exist).

Declaration
public static Position GetOrCreatePosition(this IPositionStorage storage, Portfolio portfolio, Security security, string strategyId, Nullable<Sides> side, string clientCode, string depoName, Nullable<TPlusLimits> limitType, Func<Portfolio, Security, string, Nullable<Sides>, string, string, Nullable<TPlusLimits>, Position> creator, out bool isNew)
Parameters
Type Name Description
IPositionStorage storage

Storage.

Portfolio portfolio

Portfolio.

Security security

Security.

String strategyId

Strategy ID.

Nullable<Sides> side

Side.

String clientCode

Client code.

String depoName

Depo name.

Nullable<TPlusLimits> limitType

Limit type.

Func<Portfolio, Security, String, Nullable<Sides>, String, String, Nullable<TPlusLimits>, Position> creator

Creator.

Boolean isNew

Is newly created.

Returns
Type Description
Position

Position.

GetOrderLog(IMessageAdapter, SecurityId, DateTime, DateTime)

To get order log.

Declaration
public static IEnumerable<ExecutionMessage> GetOrderLog(this IMessageAdapter adapter, SecurityId securityId, DateTime beginDate, DateTime endDate)
Parameters
Type Name Description
IMessageAdapter adapter

Adapter.

SecurityId securityId

Security ID.

DateTime beginDate

Start date.

DateTime endDate

End date.

Returns
Type Description
IEnumerable<ExecutionMessage>

Order log.

GetPlazaTimeInForce(Int64)

Extract TimeInForce from bits flag.

Declaration
public static Nullable<TimeInForce> GetPlazaTimeInForce(this long status)
Parameters
Type Name Description
Int64 status

Bits flag.

Returns
Type Description
Nullable<TimeInForce>

TimeInForce.

GetPnL(Portfolio)

To calculate profit-loss based on the portfolio.

Declaration
public static Nullable<Decimal> GetPnL(this Portfolio portfolio)
Parameters
Type Name Description
Portfolio portfolio

The portfolio, for which the profit-loss shall be calculated.

Returns
Type Description
Nullable<Decimal>

Profit-loss.

GetPosition(MyTrade)

To get the position on own trade.

Declaration
public static Nullable<Decimal> GetPosition(this MyTrade trade)
Parameters
Type Name Description
MyTrade trade

Own trade, used for position calculation. At buy the trade volume Volume is taken with positive sign, at sell - with negative.

Returns
Type Description
Nullable<Decimal>

Position.

GetPosition(ExecutionMessage, Boolean)

To get the position on own trade.

Declaration
public static Nullable<Decimal> GetPosition(this ExecutionMessage message, bool byOrder)
Parameters
Type Name Description
ExecutionMessage message

Own trade, used for position calculation. At buy the trade volume TradeVolume is taken with positive sign, at sell - with negative.

Boolean byOrder

To check implemented volume by order balance (Balance) or by received trades. The default is checked by the order.

Returns
Type Description
Nullable<Decimal>

Position.

GetSecurities(IMessageAdapter, SecurityLookupMessage)

Download all securities.

Declaration
public static IEnumerable<SecurityMessage> GetSecurities(this IMessageAdapter adapter, SecurityLookupMessage lookupMsg)
Parameters
Type Name Description
IMessageAdapter adapter

Adapter.

SecurityLookupMessage lookupMsg

Message security lookup for specified criteria.

Returns
Type Description
IEnumerable<SecurityMessage>

All securities.

GetSecurityCriteria(Connector, SecurityLookupMessage, IExchangeInfoProvider)

To create the search criteria Security from SecurityLookupMessage.

Declaration
public static Security GetSecurityCriteria(this Connector connector, SecurityLookupMessage criteria, IExchangeInfoProvider exchangeInfoProvider)
Parameters
Type Name Description
Connector connector

Connection to the trading system.

SecurityLookupMessage criteria

The criterion which fields will be used as a filter.

IExchangeInfoProvider exchangeInfoProvider

Exchanges and trading boards provider.

Returns
Type Description
Security

Search criterion.

GetSecurityValue<T>(IMarketDataProvider, Security, Level1Fields)

To get the value of market data for the instrument.

Declaration
public static T GetSecurityValue<T>(this IMarketDataProvider provider, Security security, Level1Fields field)
Parameters
Type Name Description
IMarketDataProvider provider

The market data provider.

Security security

Security.

Level1Fields field

Market-data field.

Returns
Type Description
T

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

Type Parameters
Name Description
T

The type of the market data field value.

GetSecurityValues(IMarketDataProvider, Security)

To get all market data values for the instrument.

Declaration
public static IDictionary<Level1Fields, object> GetSecurityValues(this IMarketDataProvider provider, Security security)
Parameters
Type Name Description
IMarketDataProvider provider

The market data provider.

Security security

Security.

Returns
Type Description
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.

Declaration
public static IEnumerable<MyTrade> GetTheoreticalTrades(this MarketDepth depth, Order order)
Parameters
Type Name Description
MarketDepth depth

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
Type Description
IEnumerable<MyTrade>

Probable trades.

GetTheoreticalTrades(MarketDepth, Sides, Decimal)

To get probable trades by the order book for the market price and given volume.

Declaration
public static IEnumerable<MyTrade> GetTheoreticalTrades(this MarketDepth depth, Sides orderDirection, Decimal volume)
Parameters
Type Name Description
MarketDepth depth

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

Sides orderDirection

Order side.

Decimal volume

The volume, supposed to be implemented.

Returns
Type Description
IEnumerable<MyTrade>

Probable trades.

GetTheoreticalTrades(MarketDepth, Sides, Decimal, Decimal)

To get probable trades by order book for given price and volume.

Declaration
public static IEnumerable<MyTrade> GetTheoreticalTrades(this MarketDepth depth, Sides orderDirection, Decimal volume, Decimal price)
Parameters
Type Name Description
MarketDepth depth

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

Sides orderDirection

Order side.

Decimal volume

The volume, supposed to be implemented.

Decimal price

The price, based on which the order is supposed to be forwarded. If it equals 0, option of market order will be considered.

Returns
Type Description
IEnumerable<MyTrade>

Probable trades.

GetTicks(IMessageAdapter, SecurityId, DateTime, DateTime)

To get tick data.

Declaration
public static IEnumerable<ExecutionMessage> GetTicks(this IMessageAdapter adapter, SecurityId securityId, DateTime beginDate, DateTime endDate)
Parameters
Type Name Description
IMessageAdapter adapter

Adapter.

SecurityId securityId

Security ID.

DateTime beginDate

Start date.

DateTime endDate

End date.

Returns
Type Description
IEnumerable<ExecutionMessage>

Tick data.

GetTrades(Order, IConnector)

To get order trades.

Declaration
public static IEnumerable<MyTrade> GetTrades(this Order order, IConnector connector)
Parameters
Type Name Description
Order order

Orders.

IConnector connector

The connection of interaction with trade systems.

Returns
Type Description
IEnumerable<MyTrade>

Trades.

GetUniqueId(Portfolio)

Get portfolio identifier.

Declaration
public static string GetUniqueId(this Portfolio portfolio)
Parameters
Type Name Description
Portfolio portfolio

Portfolio.

Returns
Type Description
String

Portfolio identifier.

Group(MarketDepth, Unit)

To group the order book by the price range.

Declaration
public static MarketDepth Group(this MarketDepth depth, Unit priceRange)
Parameters
Type Name Description
MarketDepth depth

The order book to be grouped.

Unit priceRange

The price range, for which grouping shall be performed.

Returns
Type Description
MarketDepth

The grouped order book.

IsActive(SubscriptionStates)

Determines the specified state equals Active or Online.

Declaration
public static bool IsActive(this SubscriptionStates state)
Parameters
Type Name Description
SubscriptionStates state

State.

Returns
Type Description
Boolean

Check result.

IsAllSecurity(Security)

Check if the specified security is AllSecurity.

Declaration
public static bool IsAllSecurity(this Security security)
Parameters
Type Name Description
Security security

Security.

Returns
Type Description
Boolean

true, if the specified security is AllSecurity, otherwise, false.

IsAssociated(SecurityId, ExchangeBoard)

Is specified security id associated with the board.

Declaration
public static bool IsAssociated(this SecurityId securityId, ExchangeBoard board)
Parameters
Type Name Description
SecurityId securityId

Security ID.

ExchangeBoard board

Board info.

Returns
Type Description
Boolean

true, if associated, otherwise, false.

IsBasket(Security)

Is specified security is basket.

Declaration
public static bool IsBasket(this Security security)
Parameters
Type Name Description
Security security

Security.

Returns
Type Description
Boolean

Check result.

IsCanceled(Order)

To check, whether the order was cancelled.

Declaration
public static bool IsCanceled(this Order order)
Parameters
Type Name Description
Order order

The order to be checked.

Returns
Type Description
Boolean

true, if the order is cancelled, otherwise, false.

IsContinuous(Security)

Is specified security is continuous.

Declaration
public static bool IsContinuous(this Security security)
Parameters
Type Name Description
Security security

Security.

Returns
Type Description
Boolean

Check result.

IsContinuous(SecurityMessage)

Is specified security is continuous.

Declaration
public static bool IsContinuous(this SecurityMessage security)
Parameters
Type Name Description
SecurityMessage security

Security.

Returns
Type Description
Boolean

Check result.

IsFinal(OrderStates)

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

Declaration
public static bool IsFinal(this OrderStates state)
Parameters
Type Name Description
OrderStates state

Order state.

Returns
Type Description
Boolean

Check result.

IsFullEmpty(MarketDepth)

To determine, is the order book empty.

Declaration
public static bool IsFullEmpty(this MarketDepth depth)
Parameters
Type Name Description
MarketDepth depth

Market depth.

Returns
Type Description
Boolean

true, if order book is empty, otherwise, false.

IsHalfEmpty(MarketDepth)

To determine, is the order book half-empty.

Declaration
public static bool IsHalfEmpty(this MarketDepth depth)
Parameters
Type Name Description
MarketDepth depth

Market depth.

Returns
Type Description
Boolean

true, if the order book is half-empty, otherwise, false.

IsIndex(Security)

Is specified security is index.

Declaration
public static bool IsIndex(this Security security)
Parameters
Type Name Description
Security security

Security.

Returns
Type Description
Boolean

Check result.

IsLookupAll(Security)

Determine the criteria contains lookup all filter.

Declaration
public static bool IsLookupAll(this Security criteria)
Parameters
Type Name Description
Security criteria

The instrument whose fields will be used as a filter.

Returns
Type Description
Boolean

Check result.

IsMatched(Order)

To check, is the order matched completely.

Declaration
public static bool IsMatched(this Order order)
Parameters
Type Name Description
Order order

The order to be checked.

Returns
Type Description
Boolean

true, if the order is matched completely, otherwise, false.

IsMatchedEmpty(Order)

To check, if no contract in order is implemented.

Declaration
public static bool IsMatchedEmpty(this Order order)
Parameters
Type Name Description
Order order

The order to be checked.

Returns
Type Description
Boolean

true, if no contract is implemented, otherwise, false.

IsMatchedPartially(Order)

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

Declaration
public static bool IsMatchedPartially(this Order order)
Parameters
Type Name Description
Order order

The order to be checked.

Returns
Type Description
Boolean

true, if part of volume is implemented, otherwise, false.

IsMicex(ExchangeBoard)

Is MICEX board.

Declaration
public static bool IsMicex(this ExchangeBoard board)
Parameters
Type Name Description
ExchangeBoard board

Board to check.

Returns
Type Description
Boolean

Check result.

IsPlazaSystem(Int64)

Extract system attribute from the bits flag.

Declaration
public static bool IsPlazaSystem(this long status)
Parameters
Type Name Description
Int64 status

Bits flag.

Returns
Type Description
Boolean

true if an order is system, otherwise, false.

IsSame(Portfolio, String)

Determines the specified portfolio is required.

Declaration
public static bool IsSame(this Portfolio portfolio, string uniqueId)
Parameters
Type Name Description
Portfolio portfolio

Portfolio.

String uniqueId

Portfolio identifier.

Returns
Type Description
Boolean

Check result.

IsStockSharp(News)

Determines whether the specified news related with StockSharp.

Declaration
public static bool IsStockSharp(this News news)
Parameters
Type Name Description
News news

News.

Returns
Type Description
Boolean

Check result.

IsTradeDate(ExchangeBoard, DateTimeOffset, Boolean)

To check, whether date is traded.

Declaration
public static bool IsTradeDate(this ExchangeBoard board, DateTimeOffset date, bool checkHolidays = false)
Parameters
Type Name Description
ExchangeBoard board

Board info.

DateTimeOffset date

The passed date to be checked.

Boolean checkHolidays

Whether to check the passed date for a weekday (Saturday and Sunday are days off, returned value for them is false).

Returns
Type Description
Boolean

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

IsTradeDate(BoardMessage, DateTimeOffset, Boolean)

To check, whether date is traded.

Declaration
public static bool IsTradeDate(this BoardMessage board, DateTimeOffset date, bool checkHolidays = false)
Parameters
Type Name Description
BoardMessage board

Board info.

DateTimeOffset date

The passed date to be checked.

Boolean checkHolidays

Whether to check the passed date for a weekday (Saturday and Sunday are days off, returned value for them is false).

Returns
Type Description
Boolean

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

IsTradeDate(WorkingTime, DateTime, Boolean)

To check, whether date is traded.

Declaration
public static bool IsTradeDate(this WorkingTime workingTime, DateTime date, bool checkHolidays = false)
Parameters
Type Name Description
WorkingTime workingTime

Board working hours.

DateTime date

The passed date to be checked.

Boolean checkHolidays

Whether to check the passed date for a weekday (Saturday and Sunday are days off, returned value for them is false).

Returns
Type Description
Boolean

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

IsTradeTime(ExchangeBoard, DateTimeOffset)

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

Declaration
public static bool IsTradeTime(this ExchangeBoard board, DateTimeOffset time)
Parameters
Type Name Description
ExchangeBoard board

Board info.

DateTimeOffset time

The passed time to be checked.

Returns
Type Description
Boolean

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

IsTradeTime(ExchangeBoard, DateTimeOffset, out Nullable<Boolean>, out WorkingTimePeriod)

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

Declaration
public static bool IsTradeTime(this ExchangeBoard board, DateTimeOffset time, out Nullable<bool> isWorkingDay, out WorkingTimePeriod period)
Parameters
Type Name Description
ExchangeBoard board

Board info.

DateTimeOffset time

The passed time to be checked.

Nullable<Boolean> isWorkingDay

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

WorkingTimePeriod period

Current working time period.

Returns
Type Description
Boolean

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

IsTradeTime(BoardMessage, DateTimeOffset)

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

Declaration
public static bool IsTradeTime(this BoardMessage board, DateTimeOffset time)
Parameters
Type Name Description
BoardMessage board

Board info.

DateTimeOffset time

The passed time to be checked.

Returns
Type Description
Boolean

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

IsTradeTime(BoardMessage, DateTimeOffset, out Nullable<Boolean>, out WorkingTimePeriod)

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

Declaration
public static bool IsTradeTime(this BoardMessage board, DateTimeOffset time, out Nullable<bool> isWorkingDay, out WorkingTimePeriod period)
Parameters
Type Name Description
BoardMessage board

Board info.

DateTimeOffset time

The passed time to be checked.

Nullable<Boolean> isWorkingDay

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

WorkingTimePeriod period

Current working time period.

Returns
Type Description
Boolean

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

IsTradeTime(WorkingTime, DateTime, out Nullable<Boolean>, out WorkingTimePeriod)

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

Declaration
public static bool IsTradeTime(this WorkingTime workingTime, DateTime time, out Nullable<bool> isWorkingDay, out WorkingTimePeriod period)
Parameters
Type Name Description
WorkingTime workingTime

Board working hours.

DateTime time

The passed time to be checked.

Nullable<Boolean> isWorkingDay

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

WorkingTimePeriod period

Current working time period.

Returns
Type Description
Boolean

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

IsUxStock(ExchangeBoard)

Is the UX exchange stock market board.

Declaration
public static bool IsUxStock(this ExchangeBoard board)
Parameters
Type Name Description
ExchangeBoard board

Board to check.

Returns
Type Description
Boolean

Check result.

Join(MarketDepth, MarketDepth)

To merge the initial order book and its sparse representation.

Declaration
public static MarketDepth Join(this MarketDepth original, MarketDepth rare)
Parameters
Type Name Description
MarketDepth original

The initial order book.

MarketDepth rare

The sparse order book.

Returns
Type Description
MarketDepth

The merged order book.

LastTradeDay(BoardMessage, DateTimeOffset, Boolean)

Get last trade date.

Declaration
public static DateTimeOffset LastTradeDay(this BoardMessage board, DateTimeOffset date, bool checkHolidays = true)
Parameters
Type Name Description
BoardMessage board

Board info.

DateTimeOffset date

The date from which to start checking.

Boolean checkHolidays

Whether to check the passed date for a weekday (Saturday and Sunday are days off, returned value for them is false).

Returns
Type Description
DateTimeOffset

Last trade date.

Lookup(ISecurityProvider, Security)

Lookup securities by criteria criteria.

Declaration
public static IEnumerable<Security> Lookup(this ISecurityProvider provider, Security criteria)
Parameters
Type Name Description
ISecurityProvider provider

The provider of information about instruments.

Security criteria

The instrument whose fields will be used as a filter.

Returns
Type Description
IEnumerable<Security>

Found instruments.

LookupAll(Connector)

Lookup securities, portfolios and orders.

Declaration
public static void LookupAll(this Connector connector)
Parameters
Type Name Description
Connector connector

The connection of interaction with trade systems.

LookupAll(ISecurityProvider)

Get all available instruments.

Declaration
public static IEnumerable<Security> LookupAll(this ISecurityProvider provider)
Parameters
Type Name Description
ISecurityProvider provider

The provider of information about instruments.

Returns
Type Description
IEnumerable<Security>

All available instruments.

LookupBoards(ISubscriptionProvider, ExchangeBoard, IMessageAdapter, MessageOfflineModes)

To find boards that match the filter criteria. Found boards will be passed through the event LookupBoardsResult.

Declaration
public static Subscription LookupBoards(this ISubscriptionProvider provider, ExchangeBoard criteria, IMessageAdapter adapter = null, MessageOfflineModes offlineMode)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

ExchangeBoard criteria

The criterion which fields will be used as a filter.

IMessageAdapter adapter

Target adapter. Can be null.

MessageOfflineModes offlineMode

Offline mode handling message.

Returns
Type Description
Subscription

Subscription.

LookupBoards(ISubscriptionProvider, BoardLookupMessage)

To find boards that match the filter criteria. Found boards will be passed through the event LookupBoardsResult.

Declaration
public static Subscription LookupBoards(this ISubscriptionProvider provider, BoardLookupMessage criteria)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

BoardLookupMessage criteria

The criterion which fields will be used as a filter.

Returns
Type Description
Subscription

Subscription.

LookupBoards(IExchangeInfoProvider, BoardLookupMessage)

Filter boards by code criteria.

Declaration
public static IEnumerable<ExchangeBoard> LookupBoards(this IExchangeInfoProvider provider, BoardLookupMessage criteria)
Parameters
Type Name Description
IExchangeInfoProvider provider

The exchange boards provider.

BoardLookupMessage criteria

Criteria.

Returns
Type Description
IEnumerable<ExchangeBoard>

Found boards.

LookupBoards2(IExchangeInfoProvider, BoardLookupMessage)

Filter boards by code criteria.

Declaration
public static IEnumerable<BoardMessage> LookupBoards2(this IExchangeInfoProvider provider, BoardLookupMessage criteria)
Parameters
Type Name Description
IExchangeInfoProvider provider

The exchange boards provider.

BoardLookupMessage criteria

Criteria.

Returns
Type Description
IEnumerable<BoardMessage>

Found boards.

LookupByCode(ISecurityProvider, String, Nullable<SecurityTypes>)

To get the instrument by the instrument code.

Declaration
public static IEnumerable<Security> LookupByCode(this ISecurityProvider provider, string code, Nullable<SecurityTypes> type = null)
Parameters
Type Name Description
ISecurityProvider provider

The provider of information about instruments.

String code

Security code.

Nullable<SecurityTypes> type

Security type.

Returns
Type Description
IEnumerable<Security>

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

LookupById(ISecurityProvider, String)

To get the instrument by the identifier.

Declaration
public static Security LookupById(this ISecurityProvider provider, string id)
Parameters
Type Name Description
ISecurityProvider provider

The provider of information about instruments.

String id

Security ID.

Returns
Type Description
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.

Declaration
public static Security LookupByNativeId(this ISecurityProvider provider, INativeIdStorage nativeIdStorage, string storageName, object nativeId)
Parameters
Type Name Description
ISecurityProvider provider

The provider of information about instruments.

INativeIdStorage nativeIdStorage

Security native identifier storage.

String storageName

Storage name.

Object nativeId

Native (internal) trading system security id.

Returns
Type Description
Security

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

LookupOrders(ISubscriptionProvider, Order, IMessageAdapter, MessageOfflineModes)

To find orders that match the filter criteria. Found orders will be passed through the event NewOrder.

Declaration
public static Subscription LookupOrders(this ISubscriptionProvider provider, Order criteria, IMessageAdapter adapter = null, MessageOfflineModes offlineMode)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Order criteria

The order which fields will be used as a filter.

IMessageAdapter adapter

Target adapter. Can be null.

MessageOfflineModes offlineMode

Offline mode handling message.

Returns
Type Description
Subscription

Subscription.

LookupOrders(ISubscriptionProvider, OrderStatusMessage)

To find orders that match the filter criteria. Found orders will be passed through the event NewOrder.

Declaration
public static Subscription LookupOrders(this ISubscriptionProvider provider, OrderStatusMessage criteria)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

OrderStatusMessage criteria

The order which fields will be used as a filter.

Returns
Type Description
Subscription

Subscription.

LookupPortfolios(ISubscriptionProvider, Portfolio, IMessageAdapter, MessageOfflineModes)

To find portfolios that match the filter criteria. Found portfolios will be passed through the event LookupPortfoliosResult.

Declaration
public static Subscription LookupPortfolios(this ISubscriptionProvider provider, Portfolio criteria, IMessageAdapter adapter = null, MessageOfflineModes offlineMode)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Portfolio criteria

The criterion which fields will be used as a filter.

IMessageAdapter adapter

Target adapter. Can be null.

MessageOfflineModes offlineMode

Offline mode handling message.

Returns
Type Description
Subscription

Subscription.

LookupPortfolios(ISubscriptionProvider, PortfolioLookupMessage)

To find portfolios that match the filter criteria. Found portfolios will be passed through the event LookupPortfoliosResult.

Declaration
public static Subscription LookupPortfolios(this ISubscriptionProvider provider, PortfolioLookupMessage criteria)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

PortfolioLookupMessage criteria

The criterion which fields will be used as a filter.

Returns
Type Description
Subscription

Subscription.

LookupSecurities(ISubscriptionProvider, Security, IMessageAdapter, MessageOfflineModes)

To find instruments that match the filter criteria. Found instruments will be passed through the event LookupSecuritiesResult.

Declaration
public static Subscription LookupSecurities(this ISubscriptionProvider provider, Security criteria, IMessageAdapter adapter = null, MessageOfflineModes offlineMode)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security criteria

The criterion which fields will be used as a filter.

IMessageAdapter adapter

Target adapter. Can be null.

MessageOfflineModes offlineMode

Offline mode handling message.

Returns
Type Description
Subscription

Subscription.

LookupSecurities(ISubscriptionProvider, SecurityLookupMessage)

To find instruments that match the filter criteria. Found instruments will be passed through the event LookupSecuritiesResult.

Declaration
public static Subscription LookupSecurities(this ISubscriptionProvider provider, SecurityLookupMessage criteria)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

SecurityLookupMessage criteria

The criterion which fields will be used as a filter.

Returns
Type Description
Subscription

Subscription.

LookupTimeFrames(ISubscriptionProvider, TimeFrameLookupMessage)

To find time-frames that match the filter criteria. Found time-frames will be passed through the event LookupTimeFramesResult.

Declaration
public static Subscription LookupTimeFrames(this ISubscriptionProvider provider, TimeFrameLookupMessage criteria)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

TimeFrameLookupMessage criteria

The criterion which fields will be used as a filter.

Returns
Type Description
Subscription

Subscription.

SafeGetOrderId(ExecutionMessage)

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

Declaration
public static long SafeGetOrderId(this ExecutionMessage message)
Parameters
Type Name Description
ExecutionMessage message

Operations.

Returns
Type Description
Int64

Order ID.

SafeGetVolume(ExecutionMessage)

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

Declaration
public static Decimal SafeGetVolume(this ExecutionMessage message)
Parameters
Type Name Description
ExecutionMessage message

Operations.

Returns
Type Description
Decimal

Quantity.

ShrinkPrice(Order, ShrinkRules)

Declaration
public static void ShrinkPrice(this Order order, ShrinkRules rule)
Parameters
Type Name Description
Order order
ShrinkRules rule

ShrinkPrice(Security, Decimal, ShrinkRules)

Declaration
public static Decimal ShrinkPrice(this Security security, Decimal price, ShrinkRules rule)
Parameters
Type Name Description
Security security
Decimal price
ShrinkRules rule
Returns
Type Description
Decimal

Sparse(MarketDepth)

To create from regular order book a sparse on, with minimal price step of PriceStep.

Declaration
public static MarketDepth Sparse(this MarketDepth depth)
Parameters
Type Name Description
MarketDepth depth

The regular order book.

Returns
Type Description
MarketDepth

The sparse order book.

Remarks

In sparsed book shown quotes with no active orders. The volume of these quotes is 0.

Sparse(MarketDepth, Unit)

To create from regular order book a sparse one.

Declaration
public static MarketDepth Sparse(this MarketDepth depth, Unit priceStep)
Parameters
Type Name Description
MarketDepth depth

The regular order book.

Unit priceStep

Minimum price step.

Returns
Type Description
MarketDepth

The sparse order book.

Remarks

In sparsed book shown quotes with no active orders. The volume of these quotes is 0.

SubscribeBoard(ISubscriptionProvider, ExchangeBoard, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, Nullable<Int64>, IMessageAdapter, Nullable<Int64>)

Subscribe on the board changes.

Declaration
public static Subscription SubscribeBoard(this ISubscriptionProvider provider, ExchangeBoard board, Nullable<DateTimeOffset> from = null, Nullable<DateTimeOffset> to = null, Nullable<long> count = null, IMessageAdapter adapter = null, Nullable<long> skip = null)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

ExchangeBoard board

Board for subscription.

Nullable<DateTimeOffset> from

The initial date from which you need to get data.

Nullable<DateTimeOffset> to

The final date by which you need to get data.

Nullable<Int64> count

Max count.

IMessageAdapter adapter

Target adapter. Can be null.

Nullable<Int64> skip

Skip count.

Returns
Type Description
Subscription

Subscription.

SubscribeCandles(ISubscriptionProvider, CandleSeries, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, Nullable<Int64>, Nullable<Int64>, IMessageAdapter, Nullable<Int64>)

Subscribe to receive new candles.

Declaration
public static Subscription SubscribeCandles(this ISubscriptionProvider provider, CandleSeries series, Nullable<DateTimeOffset> from = null, Nullable<DateTimeOffset> to = null, Nullable<long> count = null, Nullable<long> transactionId = null, IMessageAdapter adapter = null, Nullable<long> skip = null)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

CandleSeries series

Candles series.

Nullable<DateTimeOffset> from

The initial date from which you need to get data.

Nullable<DateTimeOffset> to

The final date by which you need to get data.

Nullable<Int64> count

Candles count.

Nullable<Int64> transactionId

Transaction ID.

IMessageAdapter adapter

Target adapter. Can be null.

Nullable<Int64> skip

Skip count.

Returns
Type Description
Subscription

Subscription.

SubscribeFilteredMarketDepth(ISubscriptionProvider, Security)

To start getting filtered quotes (order book) by the instrument. Quotes values are available through the event FilteredMarketDepthChanged.

Declaration
public static Subscription SubscribeFilteredMarketDepth(this ISubscriptionProvider provider, Security security)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security security

The instrument by which quotes getting should be started.

Returns
Type Description
Subscription

Subscription.

SubscribeLevel1(ISubscriptionProvider, Security, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, Nullable<Int64>, MarketDataBuildModes, DataType, IMessageAdapter, Nullable<Int64>)

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

Declaration
public static Subscription SubscribeLevel1(this ISubscriptionProvider provider, Security security, Nullable<DateTimeOffset> from = null, Nullable<DateTimeOffset> to = null, Nullable<long> count = null, MarketDataBuildModes buildMode, DataType buildFrom = null, IMessageAdapter adapter = null, Nullable<long> skip = null)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security security

The instrument by which new information getting should be started.

Nullable<DateTimeOffset> from

The initial date from which you need to get data.

Nullable<DateTimeOffset> to

The final date by which you need to get data.

Nullable<Int64> count

Max count.

MarketDataBuildModes buildMode

Build mode.

DataType buildFrom

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

IMessageAdapter adapter

Target adapter. Can be null.

Nullable<Int64> skip

Skip count.

Returns
Type Description
Subscription

Subscription.

SubscribeMarketData(ISubscriptionProvider, Security, MarketDataMessage)

To subscribe to get market data by the instrument.

Declaration
public static Subscription SubscribeMarketData(this ISubscriptionProvider provider, Security security, MarketDataMessage message)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security security

The instrument by which new information getting should be started.

MarketDataMessage message

The message that contain subscribe info.

Returns
Type Description
Subscription

Subscription.

SubscribeMarketData(ISubscriptionProvider, MarketDataMessage)

To subscribe to get market data.

Declaration
public static Subscription SubscribeMarketData(this ISubscriptionProvider provider, MarketDataMessage message)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

MarketDataMessage message

The message that contain subscribe info.

Returns
Type Description
Subscription

Subscription.

SubscribeMarketDepth(ISubscriptionProvider, Security, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, Nullable<Int64>, MarketDataBuildModes, DataType, Nullable<Int32>, Nullable<TimeSpan>, IOrderLogMarketDepthBuilder, Boolean, IMessageAdapter, Nullable<Int64>)

To start getting quotes (order book) by the instrument. Quotes values are available through the event MarketDepthChanged.

Declaration
public static Subscription SubscribeMarketDepth(this ISubscriptionProvider provider, Security security, Nullable<DateTimeOffset> from = null, Nullable<DateTimeOffset> to = null, Nullable<long> count = null, MarketDataBuildModes buildMode, DataType buildFrom = null, Nullable<int> maxDepth = null, Nullable<TimeSpan> refreshSpeed = null, IOrderLogMarketDepthBuilder depthBuilder = null, bool passThroughOrderBookInrement = false, IMessageAdapter adapter = null, Nullable<long> skip = null)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security security

The instrument by which quotes getting should be started.

Nullable<DateTimeOffset> from

The initial date from which you need to get data.

Nullable<DateTimeOffset> to

The final date by which you need to get data.

Nullable<Int64> count

Max count.

MarketDataBuildModes buildMode

Build mode.

DataType buildFrom

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

Nullable<Int32> maxDepth

Max depth of requested order book.

Nullable<TimeSpan> refreshSpeed

Interval for data refresh.

IOrderLogMarketDepthBuilder depthBuilder

Order log to market depth builder.

Boolean passThroughOrderBookInrement

Pass through incremental QuoteChangeMessage.

IMessageAdapter adapter

Target adapter. Can be null.

Nullable<Int64> skip

Skip count.

Returns
Type Description
Subscription

Subscription.

SubscribeNews(ISubscriptionProvider, Security, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, Nullable<Int64>, IMessageAdapter, Nullable<Int64>)

Subscribe on news.

Declaration
public static Subscription SubscribeNews(this ISubscriptionProvider provider, Security security = null, Nullable<DateTimeOffset> from = null, Nullable<DateTimeOffset> to = null, Nullable<long> count = null, IMessageAdapter adapter = null, Nullable<long> skip = null)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security security

Security for subscription.

Nullable<DateTimeOffset> from

The initial date from which you need to get data.

Nullable<DateTimeOffset> to

The final date by which you need to get data.

Nullable<Int64> count

Max count.

IMessageAdapter adapter

Target adapter. Can be null.

Nullable<Int64> skip

Skip count.

Returns
Type Description
Subscription

Subscription.

SubscribeOrderLog(ISubscriptionProvider, Security, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, Nullable<Int64>, IMessageAdapter, Nullable<Int64>)

Subscribe on order log for the security.

Declaration
public static Subscription SubscribeOrderLog(this ISubscriptionProvider provider, Security security, Nullable<DateTimeOffset> from = null, Nullable<DateTimeOffset> to = null, Nullable<long> count = null, IMessageAdapter adapter = null, Nullable<long> skip = null)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security security

Security for subscription.

Nullable<DateTimeOffset> from

The initial date from which you need to get data.

Nullable<DateTimeOffset> to

The final date by which you need to get data.

Nullable<Int64> count

Max count.

IMessageAdapter adapter

Target adapter. Can be null.

Nullable<Int64> skip

Skip count.

Returns
Type Description
Subscription

Subscription.

SubscribeOrders(ISubscriptionProvider, Security, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, Nullable<Int64>, IEnumerable<OrderStates>, IMessageAdapter, Nullable<Int64>)

Subscribe on orders changes.

Declaration
public static Subscription SubscribeOrders(this ISubscriptionProvider provider, Security security = null, Nullable<DateTimeOffset> from = null, Nullable<DateTimeOffset> to = null, Nullable<long> count = null, IEnumerable<OrderStates> states = null, IMessageAdapter adapter = null, Nullable<long> skip = null)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security security

Security for subscription.

Nullable<DateTimeOffset> from

The initial date from which you need to get data.

Nullable<DateTimeOffset> to

The final date by which you need to get data.

Nullable<Int64> count

Max count.

IEnumerable<OrderStates> states

Filter order by the specified states.

IMessageAdapter adapter

Target adapter. Can be null.

Nullable<Int64> skip

Skip count.

Returns
Type Description
Subscription

Subscription.

SubscribeOrders(ISubscriptionProvider, OrderStatusMessage)

To find orders that match the filter criteria. Found orders will be passed through the event NewOrder.

Declaration
public static Subscription SubscribeOrders(this ISubscriptionProvider provider, OrderStatusMessage criteria)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

OrderStatusMessage criteria

The order which fields will be used as a filter.

Returns
Type Description
Subscription

Subscription.

SubscribePositions(ISubscriptionProvider, Security, Portfolio, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, Nullable<Int64>, IMessageAdapter, Nullable<Int64>)

Subscribe on positions changes.

Declaration
public static Subscription SubscribePositions(this ISubscriptionProvider provider, Security security = null, Portfolio portfolio = null, Nullable<DateTimeOffset> from = null, Nullable<DateTimeOffset> to = null, Nullable<long> count = null, IMessageAdapter adapter = null, Nullable<long> skip = null)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security security

The instrument on which the position should be found.

Portfolio portfolio

The portfolio on which the position should be found.

Nullable<DateTimeOffset> from

The initial date from which you need to get data.

Nullable<DateTimeOffset> to

The final date by which you need to get data.

Nullable<Int64> count

Max count.

IMessageAdapter adapter

Target adapter. Can be null.

Nullable<Int64> skip

Skip count.

Returns
Type Description
Subscription

Subscription.

SubscribePositions(ISubscriptionProvider, PortfolioLookupMessage)

To find portfolios that match the filter criteria. Found portfolios will be passed through the event LookupPortfoliosResult.

Declaration
public static Subscription SubscribePositions(this ISubscriptionProvider provider, PortfolioLookupMessage criteria)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

PortfolioLookupMessage criteria

The criterion which fields will be used as a filter.

Returns
Type Description
Subscription

Subscription.

SubscribeTrades(ISubscriptionProvider, Security, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, Nullable<Int64>, MarketDataBuildModes, DataType, IMessageAdapter, Nullable<Int64>)

To start getting trades (tick data) by the instrument. New trades will come through the event NewTrade.

Declaration
public static Subscription SubscribeTrades(this ISubscriptionProvider provider, Security security, Nullable<DateTimeOffset> from = null, Nullable<DateTimeOffset> to = null, Nullable<long> count = null, MarketDataBuildModes buildMode, DataType buildFrom = null, IMessageAdapter adapter = null, Nullable<long> skip = null)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security security

The instrument by which trades getting should be started.

Nullable<DateTimeOffset> from

The initial date from which you need to get data.

Nullable<DateTimeOffset> to

The final date by which you need to get data.

Nullable<Int64> count

Max count.

MarketDataBuildModes buildMode

Build mode.

DataType buildFrom

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

IMessageAdapter adapter

Target adapter. Can be null.

Nullable<Int64> skip

Skip count.

Returns
Type Description
Subscription

Subscription.

ToBasket(Security, IBasketSecurityProcessorProvider)

Convert Security to BasketSecurity value.

Declaration
public static BasketSecurity ToBasket(this Security security, IBasketSecurityProcessorProvider processorProvider)
Parameters
Type Name Description
Security security

Security.

IBasketSecurityProcessorProvider processorProvider

Basket security processors provider.

Returns
Type Description
BasketSecurity

Instruments basket.

ToBasket<TBasketSecurity>(Security)

Convert Security to BasketSecurity value.

Declaration
public static TBasketSecurity ToBasket<TBasketSecurity>(this Security security)
    where TBasketSecurity : BasketSecurity, new()
Parameters
Type Name Description
Security security

Security.

Returns
Type Description
TBasketSecurity

Instruments basket.

Type Parameters
Name Description
TBasketSecurity

Basket security type.

ToBasket<TMessage>(IEnumerable<TMessage>, Security, IBasketSecurityProcessorProvider)

Convert inner securities messages to basket.

Declaration
public static IEnumerable<TMessage> ToBasket<TMessage>(this IEnumerable<TMessage> innerSecMessages, Security security, IBasketSecurityProcessorProvider processorProvider)
    where TMessage : Message
Parameters
Type Name Description
IEnumerable<TMessage> innerSecMessages

Inner securities messages.

Security security

Basket security.

IBasketSecurityProcessorProvider processorProvider

Basket security processors provider.

Returns
Type Description
IEnumerable<TMessage>

Messages of basket securities.

Type Parameters
Name Description
TMessage

Message type.

ToOrderSnapshot(IEnumerable<ExecutionMessage>, Int64, ILogReceiver)

Convert order changes to final snapshot.

Declaration
public static ExecutionMessage ToOrderSnapshot(this IEnumerable<ExecutionMessage> diffs, long transactionId, ILogReceiver logs)
Parameters
Type Name Description
IEnumerable<ExecutionMessage> diffs

Changes.

Int64 transactionId

Transaction ID.

ILogReceiver logs

Logs.

Returns
Type Description
ExecutionMessage

Snapshot.

ToPositionManager(Position)

Convert the position object to the type IPositionManager.

Declaration
public static IPositionManager ToPositionManager(this Position position)
Parameters
Type Name Description
Position position

Position.

Returns
Type Description
IPositionManager

Position calc manager.

ToTimeQuotes(QuoteChangeMessage)

Convert depth to quotes.

Declaration
public static IEnumerable<TimeQuoteChange> ToTimeQuotes(this QuoteChangeMessage message)
Parameters
Type Name Description
QuoteChangeMessage message

Depth.

Returns
Type Description
IEnumerable<TimeQuoteChange>

Quotes.

ToTimeQuotes(IEnumerable<QuoteChangeMessage>)

Convert depths to quotes.

Declaration
public static IEnumerable<TimeQuoteChange> ToTimeQuotes(this IEnumerable<QuoteChangeMessage> messages)
Parameters
Type Name Description
IEnumerable<QuoteChangeMessage> messages

Depths.

Returns
Type Description
IEnumerable<TimeQuoteChange>

Quotes.

Truncate(MarketDepth, Int32)

Truncate the specified order book by max depth value.

Declaration
public static MarketDepth Truncate(this MarketDepth depth, int maxDepth)
Parameters
Type Name Description
MarketDepth depth

Order book.

Int32 maxDepth

The maximum depth of order book.

Returns
Type Description
MarketDepth

Truncated order book.

TryFindLocal(IDictionary<Tuple<String, SecurityTypes>, SecurityMessage>, String, SecurityTypes, String, SecurityMessage, Boolean)

Declaration
public static void TryFindLocal(this IDictionary<Tuple<string, SecurityTypes>, SecurityMessage> securities, string code, SecurityTypes type, string board, SecurityMessage secMsg, bool onlyLocal = false)
Parameters
Type Name Description
IDictionary<Tuple<String, SecurityTypes>, SecurityMessage> securities
String code
SecurityTypes type
String board
SecurityMessage secMsg
Boolean onlyLocal

TryGetAdapter(IPortfolioMessageAdapterProvider, IMessageAdapterProvider, Portfolio)

Get adapter by portfolio.

Declaration
public static IMessageAdapter TryGetAdapter(this IPortfolioMessageAdapterProvider portfolioProvider, IMessageAdapterProvider adapterProvider, Portfolio portfolio)
Parameters
Type Name Description
IPortfolioMessageAdapterProvider portfolioProvider

The portfolio based message adapter's provider.

IMessageAdapterProvider adapterProvider

The message adapter's provider.

Portfolio portfolio

Portfolio.

Returns
Type Description
IMessageAdapter

Found adapter or null.

TryGetAdapter(IPortfolioMessageAdapterProvider, IEnumerable<IMessageAdapter>, Portfolio)

Get adapter by portfolio.

Declaration
public static IMessageAdapter TryGetAdapter(this IPortfolioMessageAdapterProvider portfolioProvider, IEnumerable<IMessageAdapter> adapters, Portfolio portfolio)
Parameters
Type Name Description
IPortfolioMessageAdapterProvider portfolioProvider

The portfolio based message adapter's provider.

IEnumerable<IMessageAdapter> adapters

All available adapters.

Portfolio portfolio

Portfolio.

Returns
Type Description
IMessageAdapter

Found adapter or null.

UnGroup(MarketDepth)

To de-group the order book, grouped using the method StockSharp.Algo.TraderHelper.Group(StockSharp.BusinessEntities.MarketDepth, System.Decimal).

Declaration
public static MarketDepth UnGroup(this MarketDepth depth)
Parameters
Type Name Description
MarketDepth depth

The grouped order book.

Returns
Type Description
MarketDepth

The de-grouped order book.

UnSubscribe(ISubscriptionProvider, Int64)

Unsubscribe.

Declaration
public static void UnSubscribe(this ISubscriptionProvider provider, long subscriptionId)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Int64 subscriptionId

Subscription id.

UnSubscribeBoard(ISubscriptionProvider, ExchangeBoard)

Unsubscribe from the board changes.

Declaration
public static void UnSubscribeBoard(this ISubscriptionProvider provider, ExchangeBoard board)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

ExchangeBoard board

Board for unsubscription.

UnSubscribeCandles(ISubscriptionProvider, CandleSeries)

To stop the candles receiving subscription, previously created by SubscribeCandles(ISubscriptionProvider, CandleSeries, Nullable<DateTimeOffset>, Nullable<DateTimeOffset>, Nullable<Int64>, Nullable<Int64>, IMessageAdapter, Nullable<Int64>).

Declaration
public static void UnSubscribeCandles(this ISubscriptionProvider provider, CandleSeries series)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

CandleSeries series

Candles series.

UnSubscribeLevel1(ISubscriptionProvider, Security)

To stop getting new information.

Declaration
public static void UnSubscribeLevel1(this ISubscriptionProvider provider, Security security)
Parameters
Type Name Description
ISubscriptionProvider provider

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.

Declaration
public static void UnSubscribeMarketData(this ISubscriptionProvider provider, Security security, MarketDataMessage message)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security security

The instrument by which new information getting should be started.

MarketDataMessage message

The message that contain unsubscribe info.

UnSubscribeMarketData(ISubscriptionProvider, MarketDataMessage)

To unsubscribe from getting market data.

Declaration
public static void UnSubscribeMarketData(this ISubscriptionProvider provider, MarketDataMessage message)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

MarketDataMessage message

The message that contain unsubscribe info.

UnSubscribeMarketDepth(ISubscriptionProvider, Security)

To stop getting quotes by the instrument.

Declaration
public static void UnSubscribeMarketDepth(this ISubscriptionProvider provider, Security security)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security security

The instrument by which quotes getting should be stopped.

UnSubscribeNews(ISubscriptionProvider, Security)

Unsubscribe from news.

Declaration
public static void UnSubscribeNews(this ISubscriptionProvider provider, Security security = null)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security security

Security for subscription.

UnSubscribeOrderLog(ISubscriptionProvider, Security)

Unsubscribe from order log for the security.

Declaration
public static void UnSubscribeOrderLog(this ISubscriptionProvider provider, Security security)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security security

Security for unsubscription.

UnSubscribeOrders(ISubscriptionProvider, Int64)

Unsubscribe from orders changes.

Declaration
public static void UnSubscribeOrders(this ISubscriptionProvider provider, long originalTransactionId = 0L)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Int64 originalTransactionId

ID of the original message SubscribeOrders(ISubscriptionProvider, OrderStatusMessage) for which this message is a response.

UnSubscribePositions(ISubscriptionProvider, Int64)

Unsubscribe from positions changes.

Declaration
public static void UnSubscribePositions(this ISubscriptionProvider provider, long originalTransactionId = 0L)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Int64 originalTransactionId

ID of the original message SubscribePositions(ISubscriptionProvider, PortfolioLookupMessage) for which this message is a response.

UnSubscribeTrades(ISubscriptionProvider, Security)

To stop getting trades (tick data) by the instrument.

Declaration
public static void UnSubscribeTrades(this ISubscriptionProvider provider, Security security)
Parameters
Type Name Description
ISubscriptionProvider provider

Subscription provider.

Security security

The instrument by which trades getting should be stopped.

Upload<TMessage>(IMessageAdapter, IEnumerable<TMessage>)

Upload data.

Declaration
public static void Upload<TMessage>(this IMessageAdapter adapter, IEnumerable<TMessage> messages)
    where TMessage : Message
Parameters
Type Name Description
IMessageAdapter adapter

Adapter.

IEnumerable<TMessage> messages

Messages.

Type Parameters
Name Description
TMessage

Request type.

ValidateId(ref String)

To check the correctness of the entered identifier.

Declaration
public static string ValidateId(ref string id)
Parameters
Type Name Description
String id

Security ID.

Returns
Type Description
String

An error message text, or null if no error.

Verify(MarketDepth)

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

Declaration
public static bool Verify(this MarketDepth depth)
Parameters
Type Name Description
MarketDepth depth

Order book.

Returns
Type Description
Boolean

true, if the order book contains correct data, otherwise false.

Remarks

It is used in cases when the trading system by mistake sends the wrong quotes.

VerifyOrderState(Nullable<OrderStates>, OrderStates, Int64, ILogReceiver)

Check the possibility State change.

Declaration
public static bool VerifyOrderState(this Nullable<OrderStates> currState, OrderStates newState, long transactionId, ILogReceiver logs)
Parameters
Type Name Description
Nullable<OrderStates> currState

Current order's state.

OrderStates newState

New state.

Int64 transactionId

Transaction id.

ILogReceiver logs

Logs.

Returns
Type Description
Boolean

Check result.

☀
☾
In This Article
Back to top
Copyright © StockSharp.
☀
☾