Table of Contents

Class Connector

Namespace
StockSharp.Algo
Assembly
StockSharp.Algo.dll

The class to create connections to trading systems.

public class Connector : BaseLogReceiver, IConnector, IPersistable, ILogReceiver, ILogSource, IMarketDataProvider, ITransactionProvider, IPositionProvider, IPortfolioProvider, ISecurityProvider, ISecurityMessageProvider, INewsProvider, IMessageChannel, IDisposable, ICloneable<IMessageChannel>, ICloneable, ISubscriptionProvider
Inheritance
Connector
Implements
IPersistable
ICloneable<IMessageChannel>
Derived
Inherited Members
Extension Methods

Constructors

Connector()

Initializes a new instance of the Connector.

public Connector()

Connector(IEntityRegistry, IStorageRegistry, SnapshotRegistry, StorageBuffer)

Initializes a new instance of the Connector.

[Obsolete]
public Connector(IEntityRegistry entityRegistry, IStorageRegistry storageRegistry, SnapshotRegistry snapshotRegistry, StorageBuffer buffer = null)

Parameters

entityRegistry IEntityRegistry

The storage of trade objects.

storageRegistry IStorageRegistry

The storage of market data.

snapshotRegistry SnapshotRegistry

Snapshot storage registry.

buffer StorageBuffer

Storage buffer.

Connector(ISecurityStorage, IPositionStorage, IExchangeInfoProvider, IStorageRegistry, SnapshotRegistry, StorageBuffer, bool, bool)

Initializes a new instance of the Connector.

public Connector(ISecurityStorage securityStorage, IPositionStorage positionStorage, IExchangeInfoProvider exchangeInfoProvider, IStorageRegistry storageRegistry = null, SnapshotRegistry snapshotRegistry = null, StorageBuffer buffer = null, bool initAdapter = true, bool initChannels = true)

Parameters

securityStorage ISecurityStorage

Securities meta info storage.

positionStorage IPositionStorage

Position storage.

exchangeInfoProvider IExchangeInfoProvider

Exchanges and trading boards provider.

storageRegistry IStorageRegistry

The storage of market data.

snapshotRegistry SnapshotRegistry

Snapshot storage registry.

buffer StorageBuffer

Storage buffer.

initAdapter bool

Initialize basket adapter.

initChannels bool

Initialize channels.

Properties

Adapter

Message adapter.

public BasketMessageAdapter Adapter { get; protected set; }

Property Value

BasketMessageAdapter

BasketSecurityProcessorProvider

Basket security processors provider.

public IBasketSecurityProcessorProvider BasketSecurityProcessorProvider { get; set; }

Property Value

IBasketSecurityProcessorProvider

Buffer

Storage buffer.

public StorageBuffer Buffer { get; }

Property Value

StorageBuffer

CanConnect

Determines this connector is ready for establish connection.

public bool CanConnect { get; }

Property Value

bool

CheckSteps

Check Price and Volume are they multiply to step.

public bool CheckSteps { get; set; }

Property Value

bool

CommissionManager

The commission calculating manager.

public ICommissionManager CommissionManager { get; set; }

Property Value

ICommissionManager

ConnectionState

Connection state.

public ConnectionStates ConnectionState { get; }

Property Value

ConnectionStates

CreateAssociatedSecurity

Create a combined security for securities from different boards.

[Obsolete("Use SupportAssociatedSecurity property.")]
public bool CreateAssociatedSecurity { get; set; }

Property Value

bool

CreateDepthFromLevel1

To update the order book for the instrument when the Level1ChangeMessage message appears. By default is enabled.

[Obsolete("Use SupportLevel1DepthBuilder property.")]
public bool CreateDepthFromLevel1 { get; set; }

Property Value

bool

CreateDepthFromOrdersLog

Use orders log to create market depths. Disabled by default.

[Obsolete("Use MarketDataMessage.BuildFrom=OrderLog instead.")]
public bool CreateDepthFromOrdersLog { get; set; }

Property Value

bool

CreateTradesFromOrdersLog

Use orders log to create ticks. Disabled by default.

[Obsolete("Use MarketDataMessage.BuildFrom=OrderLog instead.")]
public bool CreateTradesFromOrdersLog { get; set; }

Property Value

bool

ErrorCount

The number of errors passed through the Error event.

public int ErrorCount { get; }

Property Value

int

ExchangeBoards

List of all exchange boards, for which instruments are loaded Securities.

public IEnumerable<ExchangeBoard> ExchangeBoards { get; }

Property Value

IEnumerable<ExchangeBoard>

ExchangeInfoProvider

Exchanges and trading boards provider.

public IExchangeInfoProvider ExchangeInfoProvider { get; }

Property Value

IExchangeInfoProvider

InMessageChannel

Input message channel.

public IMessageChannel InMessageChannel { get; protected set; }

Property Value

IMessageChannel

InnerAdapter

Inner message adapter.

public IMessageAdapter InnerAdapter { get; set; }

Property Value

IMessageAdapter

IsAutoPortfoliosSubscribe

Subscribe for new portfolios.

public bool IsAutoPortfoliosSubscribe { get; set; }

Property Value

bool

Remarks

By default is true.

IsAutoUnSubscribeOnDisconnect

Send unsubscribe on disconnect command.

public bool IsAutoUnSubscribeOnDisconnect { get; set; }

Property Value

bool

Remarks

By default is true.

IsRestoreSubscriptionOnNormalReconnect

Restore subscription on reconnect.

public bool IsRestoreSubscriptionOnNormalReconnect { get; set; }

Property Value

bool

Remarks

Normal case connect/disconnect.

KeepStrategiesPositions

Process strategies positions and store it into Positions.

public bool KeepStrategiesPositions { get; set; }

Property Value

bool

LatencyManager

Orders registration delay calculation manager.

public ILatencyManager LatencyManager { get; set; }

Property Value

ILatencyManager

LookupMessagesOnConnect

Send lookup messages on connect. By default is SecurityLookup, PortfolioLookup, OrderStatus, TimeFrameLookup.

public ISet<MessageTypes> LookupMessagesOnConnect { get; }

Property Value

ISet<MessageTypes>

MarketDataAdapter

Market-data adapter.

public IMessageAdapter MarketDataAdapter { get; }

Property Value

IMessageAdapter

MarketTimeChangedInterval

The TimeMessage message generating Interval. The default is 10 milliseconds.

public virtual TimeSpan MarketTimeChangedInterval { get; set; }

Property Value

TimeSpan

MyTrades

Get all own trades.

[Obsolete("Use NewMyTrade event to collect data.")]
public IEnumerable<MyTrade> MyTrades { get; }

Property Value

IEnumerable<MyTrade>

News

All news.

[Obsolete("Use NewNews event to collect data.")]
public IEnumerable<News> News { get; }

Property Value

IEnumerable<News>

OrderCancelFails

Get all cancellation errors.

[Obsolete("Use OrderCancelFailed event to collect data.")]
public IEnumerable<OrderFail> OrderCancelFails { get; }

Property Value

IEnumerable<OrderFail>

OrderRegisterFails

Get all registration errors.

[Obsolete("Use OrderRegisterFailed event to collect data.")]
public IEnumerable<OrderFail> OrderRegisterFails { get; }

Property Value

IEnumerable<OrderFail>

Orders

Get all orders.

[Obsolete("Use NewOrder event to collect data.")]
public IEnumerable<Order> Orders { get; }

Property Value

IEnumerable<Order>

OrdersKeepCount

The number of orders for storage. The default is 1000. If the value is set to MaxValue, then the orders will not be deleted. If the value is set to 0, then the orders will not be stored.

public int OrdersKeepCount { get; set; }

Property Value

int

OutMessageChannel

Outgoing message channel.

public IMessageChannel OutMessageChannel { get; protected set; }

Property Value

IMessageChannel

OverrideSecurityData

Override previous security data by new values.

public bool OverrideSecurityData { get; set; }

Property Value

bool

PnLManager

The profit-loss manager.

public IPnLManager PnLManager { get; set; }

Property Value

IPnLManager

Portfolios

Get all portfolios.

public virtual IEnumerable<Portfolio> Portfolios { get; }

Property Value

IEnumerable<Portfolio>

PositionStorage

Position storage.

public IPositionStorage PositionStorage { get; }

Property Value

IPositionStorage

Positions

Get all positions.

public IEnumerable<Position> Positions { get; }

Property Value

IEnumerable<Position>

ReConnectionSettings

Settings of the connection control IConnector to the trading system.

[Obsolete("Use exact IMessageAdapter to set reconnecting settings.")]
public ReConnectionSettings ReConnectionSettings { get; }

Property Value

ReConnectionSettings

RegisteredMarketDepths

List of all securities, subscribed via RegisteredMarketDepths.

public IEnumerable<Security> RegisteredMarketDepths { get; }

Property Value

IEnumerable<Security>

RegisteredOrderLogs

public IEnumerable<Security> RegisteredOrderLogs { get; }

Property Value

IEnumerable<Security>

RegisteredPortfolios

List of all portfolios, subscribed via RegisterPortfolio(Portfolio).

public IEnumerable<Portfolio> RegisteredPortfolios { get; }

Property Value

IEnumerable<Portfolio>

RegisteredSecurities

public IEnumerable<Security> RegisteredSecurities { get; }

Property Value

IEnumerable<Security>

RegisteredTrades

public IEnumerable<Security> RegisteredTrades { get; }

Property Value

IEnumerable<Security>

RiskManager

Risk control manager.

public virtual IRiskManager RiskManager { get; set; }

Property Value

IRiskManager

Securities

List of all loaded instruments. It should be called after event NewSecurities arisen. Otherwise the empty set will be returned.

public IEnumerable<Security> Securities { get; }

Property Value

IEnumerable<Security>

SecurityIdGenerator

The instrument identifiers generator Id.

public SecurityIdGenerator SecurityIdGenerator { get; set; }

Property Value

SecurityIdGenerator

SecurityStorage

Securities meta info storage.

public ISecurityStorage SecurityStorage { get; }

Property Value

ISecurityStorage

SlippageManager

Slippage manager.

public ISlippageManager SlippageManager { get; set; }

Property Value

ISlippageManager

SnapshotRegistry

Snapshot storage registry.

public SnapshotRegistry SnapshotRegistry { get; }

Property Value

SnapshotRegistry

StopOrders

Get all stop-orders.

[Obsolete("Use NewStopOrder event to collect data.")]
public IEnumerable<Order> StopOrders { get; }

Property Value

IEnumerable<Order>

StorageAdapter

Storage adapter.

public StorageMetaInfoMessageAdapter StorageAdapter { get; }

Property Value

StorageMetaInfoMessageAdapter

StorageRegistry

The storage of market data.

public IStorageRegistry StorageRegistry { get; }

Property Value

IStorageRegistry

SubscribedCandleSeries

List of all candles series, subscribed via Subscribe(Subscription).

public IEnumerable<CandleSeries> SubscribedCandleSeries { get; }

Property Value

IEnumerable<CandleSeries>

Subscriptions

Subscriptions.

public IEnumerable<Subscription> Subscriptions { get; }

Property Value

IEnumerable<Subscription>

SupportAssociatedSecurity

public bool SupportAssociatedSecurity { get; set; }

Property Value

bool

SupportBasketSecurities

public bool SupportBasketSecurities { get; set; }

Property Value

bool

SupportFilteredMarketDepth

public bool SupportFilteredMarketDepth { get; set; }

Property Value

bool

SupportLevel1DepthBuilder

[Obsolete("Use IMessageAdapter.GenerateOrderBookFromLevel1 property.")]
public bool SupportLevel1DepthBuilder { get; set; }

Property Value

bool

SupportSnapshots

public virtual bool SupportSnapshots { get; set; }

Property Value

bool

TimeChange

Increment periodically MarketTimeChangedInterval value of CurrentTime.

public bool TimeChange { get; set; }

Property Value

bool

Trades

Get all tick trades.

[Obsolete("Use NewTrade event to collect data.")]
public IEnumerable<Trade> Trades { get; }

Property Value

IEnumerable<Trade>

TradesKeepCount

Number of tick trades for storage. The default is 100000. If the value is set to MaxValue, the trades will not be deleted. If the value is set to 0, then the trades will not be stored.

[Obsolete("Do nothing.")]
public int TradesKeepCount { get; set; }

Property Value

int

TransactionAdapter

Transactional adapter.

public IMessageAdapter TransactionAdapter { get; }

Property Value

IMessageAdapter

TransactionIdGenerator

Transaction id generator.

public IdGenerator TransactionIdGenerator { get; set; }

Property Value

IdGenerator

UpdateSecurityByDefinition

To update Security fields when the SecurityMessage message appears. By default is enabled.

public bool UpdateSecurityByDefinition { get; set; }

Property Value

bool

UpdateSecurityByLevel1

To update Security fields when the Level1ChangeMessage message appears. By default is enabled.

public bool UpdateSecurityByLevel1 { get; set; }

Property Value

bool

UpdateSecurityLastQuotes

To update LastTick, BestBid, BestAsk at each update of order book and/or trades. By default is enabled.

public bool UpdateSecurityLastQuotes { get; set; }

Property Value

bool

Methods

CancelOrder(Order)

Cancel the order.

public void CancelOrder(Order order)

Parameters

order Order

The order which should be canceled.

CancelOrders(bool?, Portfolio, Sides?, ExchangeBoard, Security, SecurityTypes?, long?)

Cancel orders by filter.

public void CancelOrders(bool? isStopOrder = null, Portfolio portfolio = null, Sides? direction = null, ExchangeBoard board = null, Security security = null, SecurityTypes? securityType = null, long? transactionId = null)

Parameters

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.

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

transactionId long?

Order cancellation transaction id.

ChangePassword(SecureString)

Change password.

public void ChangePassword(SecureString newPassword)

Parameters

newPassword SecureString

New password.

ClearCache()

Clear cache.

public virtual void ClearCache()

Connect()

Connect to trading system.

public void Connect()

CreateSecurityId(string, string)

Generate Id security.

protected string CreateSecurityId(string secCode, string boardCode)

Parameters

secCode string

SecurityCode.

boardCode string

BoardCode.

Returns

string

Id security.

Disconnect()

Disconnect from trading system.

public void Disconnect()

DisposeManaged()

To release allocated resources. In particular, to disconnect from the trading system via Disconnect().

protected override void DisposeManaged()

EditOrder(Order, Order)

Edit the order.

public void EditOrder(Order order, Order changes)

Parameters

order Order

Order.

changes Order

Order changes.

FindSubscriptions(Security, DataType)

Find subscriptions for the specified security and data type.

public IEnumerable<Subscription> FindSubscriptions(Security security, DataType dataType)

Parameters

security Security

Security.

dataType DataType

Data type info.

Returns

IEnumerable<Subscription>

Subscriptions.

GetLevel1Fields(Security)

To get a set of available fields Level1Fields, for which there is a market data for the instrument.

public IEnumerable<Level1Fields> GetLevel1Fields(Security security)

Parameters

security Security

Security.

Returns

IEnumerable<Level1Fields>

Possible fields.

GetPortfolio(string)

To get the portfolio by the code name.

public Portfolio GetPortfolio(string name)

Parameters

name string

Portfolio code name.

Returns

Portfolio

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

GetPosition(Portfolio, Security, string, Sides?, string, string, TPlusLimits?)

To get the position by portfolio and instrument.

public Position GetPosition(Portfolio portfolio, Security security, string strategyId = "", Sides? side = null, string clientCode = "", string depoName = "", TPlusLimits? limitType = null)

Parameters

portfolio Portfolio

The portfolio on which the position should be found.

security Security

The instrument on which the position should be found.

strategyId string

Strategy ID.

side Sides?

Side.

clientCode string

The client code.

depoName string

The depository name where the stock is located physically. By default, an empty string is passed, which means the total position by all depositories.

limitType TPlusLimits?

Limit type for Т+ market.

Returns

Position

Position.

GetSecurity(SecurityId)

Get security by identifier.

public Security GetSecurity(SecurityId securityId)

Parameters

securityId SecurityId

Security ID.

Returns

Security

Security.

GetSecurityId(Security)

public SecurityId GetSecurityId(Security security)

Parameters

security Security

Security.

Returns

SecurityId

Security ID.

GetSecurityValue(Security, Level1Fields)

To get the value of market data for the instrument.

public object GetSecurityValue(Security security, Level1Fields field)

Parameters

security Security

Security.

field Level1Fields

Market-data field.

Returns

object

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

GetSessionState(ExchangeBoard)

Get session state for required board.

public SessionStates? GetSessionState(ExchangeBoard board)

Parameters

board ExchangeBoard

Electronic board.

Returns

SessionStates?

Session state. If the information about session state does not exist, then null will be returned.

IsOrderEditable(Order)

Determines the specified order can be edited by EditOrder(Order, Order).

public bool? IsOrderEditable(Order order)

Parameters

order Order

Order.

Returns

bool?

true if the order is editable, false order cannot be changed, null means no information.

IsOrderReplaceable(Order)

Determines the specified order can be replaced by ReRegisterOrder(Order, Order).

public bool? IsOrderReplaceable(Order order)

Parameters

order Order

Order.

Returns

bool?

true if the order is replaceable, false order cannot be replaced, null means no information.

Load(SettingsStorage)

Load settings.

public override void Load(SettingsStorage storage)

Parameters

storage SettingsStorage

Settings storage.

LookupById(SecurityId)

To get the instrument by the identifier.

public Security LookupById(SecurityId id)

Parameters

id SecurityId

Security ID.

Returns

Security

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

LookupByPortfolioName(string)

To get the portfolio by the code name.

public Portfolio LookupByPortfolioName(string name)

Parameters

name string

Portfolio code name.

Returns

Portfolio

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

OnCancelOrder(Order, long)

Cancel the order.

protected void OnCancelOrder(Order order, long transactionId)

Parameters

order Order

Order to cancel.

transactionId long

Order cancellation transaction id.

OnCancelOrders(long, bool?, Portfolio, Sides?, ExchangeBoard, Security, SecurityTypes?)

Cancel orders by filter.

protected void OnCancelOrders(long transactionId, bool? isStopOrder = null, Portfolio portfolio = null, Sides? direction = null, ExchangeBoard board = null, Security security = null, SecurityTypes? securityType = null)

Parameters

transactionId long

Order cancellation transaction id.

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.

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

OnConnect()

Connect to trading system.

protected virtual void OnConnect()

OnDisconnect()

Disconnect from trading system.

protected virtual void OnDisconnect()

OnEditOrder(Order, Order)

Edit the order.

protected void OnEditOrder(Order order, Order changes)

Parameters

order Order

Order.

changes Order

Order changes.

OnProcessMessage(Message)

Process message.

protected virtual void OnProcessMessage(Message message)

Parameters

message Message

Message.

OnReRegisterOrder(Order, Order)

Reregister the order.

protected void OnReRegisterOrder(Order oldOrder, Order newOrder)

Parameters

oldOrder Order

Cancelling order.

newOrder Order

New order to register.

OnReRegisterOrderPair(Order, Order, Order, Order)

Reregister of pair orders.

protected void OnReRegisterOrderPair(Order oldOrder1, Order newOrder1, Order oldOrder2, Order newOrder2)

Parameters

oldOrder1 Order

First order to cancel.

newOrder1 Order

First new order to register.

oldOrder2 Order

Second order to cancel.

newOrder2 Order

Second new order to register.

OnRegisterOrder(Order)

Register new order.

protected void OnRegisterOrder(Order order)

Parameters

order Order

Registration details.

RaiseError(Exception)

To call the event Error.

protected void RaiseError(Exception exception)

Parameters

exception Exception

Data processing error.

RaiseSubscriptionFailed(Subscription, Exception, bool)

protected virtual void RaiseSubscriptionFailed(Subscription subscription, Exception error, bool isSubscribe)

Parameters

subscription Subscription
error Exception
isSubscribe bool

ReRegisterOrder(Order, Order)

Reregister the order.

public void ReRegisterOrder(Order oldOrder, Order newOrder)

Parameters

oldOrder Order

Cancelling order.

newOrder Order

New order to register.

ReRegisterOrderPair(Order, Order, Order, Order)

Replace orders.

public void ReRegisterOrderPair(Order oldOrder1, Order newOrder1, Order oldOrder2, Order newOrder2)

Parameters

oldOrder1 Order

Cancelling order.

newOrder1 Order

New order to register.

oldOrder2 Order

Cancelling order.

newOrder2 Order

New order to register.

RegisterMarketDepth(Security, DateTimeOffset?, DateTimeOffset?, long?, MarketDataBuildModes, DataType, int?, IMessageAdapter)

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

[Obsolete("Use Subscribe method instead.")]
public void RegisterMarketDepth(Security security, DateTimeOffset? from = null, DateTimeOffset? to = null, long? count = null, MarketDataBuildModes buildMode = MarketDataBuildModes.LoadAndBuild, DataType buildFrom = null, int? maxDepth = null, IMessageAdapter adapter = null)

Parameters

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.

adapter IMessageAdapter

Target adapter. Can be null.

RegisterNews(Security, IMessageAdapter)

Subscribe on news.

[Obsolete("Use SubscribeNews method instead.")]
public void RegisterNews(Security security = null, IMessageAdapter adapter = null)

Parameters

security Security

Security for subscription.

adapter IMessageAdapter

Target adapter. Can be null.

RegisterOrder(Order)

Register new order.

public void RegisterOrder(Order order)

Parameters

order Order

Registration details.

RegisterOrderLog(Security, DateTimeOffset?, DateTimeOffset?, long?, IMessageAdapter)

Subscribe on order log for the security.

[Obsolete("Use SubscribeOrderLog method instead.")]
public void RegisterOrderLog(Security security, DateTimeOffset? from = null, DateTimeOffset? to = null, long? count = null, IMessageAdapter adapter = null)

Parameters

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.

RegisterPortfolio(Portfolio)

Subscribe on the portfolio changes.

public void RegisterPortfolio(Portfolio portfolio)

Parameters

portfolio Portfolio

Portfolio for subscription.

RegisterSecurity(Security, DateTimeOffset?, DateTimeOffset?, long?, MarketDataBuildModes, DataType, IMessageAdapter)

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

[Obsolete("Use Subscribe method instead.")]
public void RegisterSecurity(Security security, DateTimeOffset? from = null, DateTimeOffset? to = null, long? count = null, MarketDataBuildModes buildMode = MarketDataBuildModes.LoadAndBuild, DataType buildFrom = null, IMessageAdapter adapter = null)

Parameters

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.

RegisterTrades(Security, DateTimeOffset?, DateTimeOffset?, long?, MarketDataBuildModes, DataType, IMessageAdapter)

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

[Obsolete("Use SubscribeTrades method instead.")]
public void RegisterTrades(Security security, DateTimeOffset? from = null, DateTimeOffset? to = null, long? count = null, MarketDataBuildModes buildMode = MarketDataBuildModes.LoadAndBuild, DataType buildFrom = null, IMessageAdapter adapter = null)

Parameters

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.

RequestNewsStory(News, IMessageAdapter)

Request news Story body. After receiving the event NewsChanged will be triggered.

public void RequestNewsStory(News news, IMessageAdapter adapter = null)

Parameters

news News

News.

adapter IMessageAdapter

Target adapter. Can be null.

Save(SettingsStorage)

Save settings.

public override void Save(SettingsStorage storage)

Parameters

storage SettingsStorage

Settings storage.

SendInMessage(Message)

Send message.

public bool SendInMessage(Message message)

Parameters

message Message

Message.

Returns

bool

true if the specified message was processed successfully, otherwise, false.

SendOutError(Exception)

Send error message.

public void SendOutError(Exception error)

Parameters

error Exception

Error details.

SendOutMessage(Message)

Send outgoing message.

public void SendOutMessage(Message message)

Parameters

message Message

Message.

Subscribe(Subscription)

Subscribe.

public void Subscribe(Subscription subscription)

Parameters

subscription Subscription

Subscription.

TryGetSubscriptionById(long)

Try get subscription by id.

public Subscription TryGetSubscriptionById(long subscriptionId)

Parameters

subscriptionId long

Subscription id.

Returns

Subscription

Subscription.

UnRegisterMarketDepth(Security)

To stop getting quotes by the instrument.

[Obsolete("Use UnSubscribeMarketDepth method instead.")]
public void UnRegisterMarketDepth(Security security)

Parameters

security Security

The instrument by which quotes getting should be stopped.

UnRegisterNews(Security)

Unsubscribe from news.

[Obsolete("Use UnSubscribeNews method instead.")]
public void UnRegisterNews(Security security = null)

Parameters

security Security

Security for subscription.

UnRegisterOrderLog(Security)

Unsubscribe from order log for the security.

[Obsolete("Use UnSubscribeOrderLog method instead.")]
public void UnRegisterOrderLog(Security security)

Parameters

security Security

Security for unsubscription.

UnRegisterPortfolio(Portfolio)

Unsubscribe from the portfolio changes.

public void UnRegisterPortfolio(Portfolio portfolio)

Parameters

portfolio Portfolio

Portfolio for unsubscription.

UnRegisterSecurity(Security)

To stop getting new information.

[Obsolete("Use UnSubscribe method instead.")]
public void UnRegisterSecurity(Security security)

Parameters

security Security

The instrument by which new information getting should be stopped.

UnRegisterTrades(Security)

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

[Obsolete("Use UnSubscribeTrades method instead.")]
public void UnRegisterTrades(Security security)

Parameters

security Security

The instrument by which trades getting should be stopped.

UnSubscribe(Subscription)

Unsubscribe.

public void UnSubscribe(Subscription subscription)

Parameters

subscription Subscription

Subscription.

Events

BoardReceived

Board received.

public event Action<Subscription, ExchangeBoard> BoardReceived

Event Type

Action<Subscription, ExchangeBoard>

CandleProcessing

A new value for processing occurrence event.

public event Action<CandleSeries, ICandleMessage> CandleProcessing

Event Type

Action<CandleSeries, ICandleMessage>

CandleReceived

Candle received.

public event Action<Subscription, ICandleMessage> CandleReceived

Event Type

Action<Subscription, ICandleMessage>

CandleSeriesError

The series error event.

public event Action<CandleSeries, SubscriptionResponseMessage> CandleSeriesError

Event Type

Action<CandleSeries, SubscriptionResponseMessage>

CandleSeriesProcessing

A new value for processing occurrence event.

[Obsolete("Use CandleProcessing event.")]
public event Action<CandleSeries, Candle> CandleSeriesProcessing

Event Type

Action<CandleSeries, Candle>

CandleSeriesStopped

The series processing end event.

public event Action<CandleSeries> CandleSeriesStopped

Event Type

Action<CandleSeries>

ChangePasswordResult

Change password result.

public event Action<long, Exception> ChangePasswordResult

Event Type

Action<long, Exception>

Connected

Connected.

public event Action Connected

Event Type

Action

ConnectedEx

Connected.

public event Action<IMessageAdapter> ConnectedEx

Event Type

Action<IMessageAdapter>

ConnectionError

Connection error (for example, the connection was aborted by server).

public event Action<Exception> ConnectionError

Event Type

Action<Exception>

ConnectionErrorEx

Connection error (for example, the connection was aborted by server).

public event Action<IMessageAdapter, Exception> ConnectionErrorEx

Event Type

Action<IMessageAdapter, Exception>

ConnectionLost

Connection lost.

public event Action<IMessageAdapter> ConnectionLost

Event Type

Action<IMessageAdapter>

ConnectionRestored

Connection restored.

public event Action<IMessageAdapter> ConnectionRestored

Event Type

Action<IMessageAdapter>

Disconnected

Disconnected.

public event Action Disconnected

Event Type

Action

DisconnectedEx

Disconnected.

public event Action<IMessageAdapter> DisconnectedEx

Event Type

Action<IMessageAdapter>

Error

The main interface providing the connection to the trading systems.

public event Action<Exception> Error

Event Type

Action<Exception>

Level1Received

Level1 received.

public event Action<Subscription, Level1ChangeMessage> Level1Received

Event Type

Action<Subscription, Level1ChangeMessage>

LookupBoardsResult

Lookup result BoardLookupMessage received.

public event Action<BoardLookupMessage, IEnumerable<ExchangeBoard>, Exception> LookupBoardsResult

Event Type

Action<BoardLookupMessage, IEnumerable<ExchangeBoard>, Exception>

LookupBoardsResult2

Lookup result BoardLookupMessage received.

public event Action<BoardLookupMessage, IEnumerable<ExchangeBoard>, IEnumerable<ExchangeBoard>, Exception> LookupBoardsResult2

Event Type

Action<BoardLookupMessage, IEnumerable<ExchangeBoard>, IEnumerable<ExchangeBoard>, Exception>

LookupPortfoliosResult

Lookup result PortfolioLookupMessage received.

public event Action<PortfolioLookupMessage, IEnumerable<Portfolio>, Exception> LookupPortfoliosResult

Event Type

Action<PortfolioLookupMessage, IEnumerable<Portfolio>, Exception>

LookupPortfoliosResult2

Lookup result PortfolioLookupMessage received.

public event Action<PortfolioLookupMessage, IEnumerable<Portfolio>, IEnumerable<Portfolio>, Exception> LookupPortfoliosResult2

Event Type

Action<PortfolioLookupMessage, IEnumerable<Portfolio>, IEnumerable<Portfolio>, Exception>

LookupSecuritiesResult

Lookup result SecurityLookupMessage received.

public event Action<SecurityLookupMessage, IEnumerable<Security>, Exception> LookupSecuritiesResult

Event Type

Action<SecurityLookupMessage, IEnumerable<Security>, Exception>

LookupSecuritiesResult2

Lookup result SecurityLookupMessage received.

public event Action<SecurityLookupMessage, IEnumerable<Security>, IEnumerable<Security>, Exception> LookupSecuritiesResult2

Event Type

Action<SecurityLookupMessage, IEnumerable<Security>, IEnumerable<Security>, Exception>

LookupTimeFramesResult

Lookup result TimeFrameLookupMessage received.

public event Action<TimeFrameLookupMessage, IEnumerable<TimeSpan>, Exception> LookupTimeFramesResult

Event Type

Action<TimeFrameLookupMessage, IEnumerable<TimeSpan>, Exception>

LookupTimeFramesResult2

Lookup result TimeFrameLookupMessage received.

public event Action<TimeFrameLookupMessage, IEnumerable<TimeSpan>, IEnumerable<TimeSpan>, Exception> LookupTimeFramesResult2

Event Type

Action<TimeFrameLookupMessage, IEnumerable<TimeSpan>, IEnumerable<TimeSpan>, Exception>

MarketDataSubscriptionFailed

Error subscription market-data.

[Obsolete("Use SubscriptionFailed event.")]
public event Action<Security, MarketDataMessage, Exception> MarketDataSubscriptionFailed

Event Type

Action<Security, MarketDataMessage, Exception>

MarketDataSubscriptionFailed2

Error subscription market-data.

[Obsolete("Use SubscriptionFailed event.")]
public event Action<Security, MarketDataMessage, SubscriptionResponseMessage> MarketDataSubscriptionFailed2

Event Type

Action<Security, MarketDataMessage, SubscriptionResponseMessage>

MarketDataSubscriptionFinished

Subscription market-data finished.

[Obsolete("Use SubscriptionStopped event.")]
public event Action<Security, SubscriptionFinishedMessage> MarketDataSubscriptionFinished

Event Type

Action<Security, SubscriptionFinishedMessage>

MarketDataSubscriptionOnline

Subscription is online.

[Obsolete("Use SubscriptionOnline event.")]
public event Action<Security, MarketDataMessage> MarketDataSubscriptionOnline

Event Type

Action<Security, MarketDataMessage>

MarketDataSubscriptionSucceeded

Successful subscription market-data.

[Obsolete("Use SubscriptionStarted event.")]
public event Action<Security, MarketDataMessage> MarketDataSubscriptionSucceeded

Event Type

Action<Security, MarketDataMessage>

MarketDataUnSubscriptionFailed

Error unsubscription market-data.

[Obsolete("Use SubscriptionFailed event.")]
public event Action<Security, MarketDataMessage, Exception> MarketDataUnSubscriptionFailed

Event Type

Action<Security, MarketDataMessage, Exception>

MarketDataUnSubscriptionFailed2

Error unsubscription market-data.

[Obsolete("Use SubscriptionFailed event.")]
public event Action<Security, MarketDataMessage, SubscriptionResponseMessage> MarketDataUnSubscriptionFailed2

Event Type

Action<Security, MarketDataMessage, SubscriptionResponseMessage>

MarketDataUnSubscriptionSucceeded

Successful unsubscription market-data.

[Obsolete("Use SubscriptionStopped event.")]
public event Action<Security, MarketDataMessage> MarketDataUnSubscriptionSucceeded

Event Type

Action<Security, MarketDataMessage>

MarketDataUnexpectedCancelled

Market-data subscription unexpected cancelled.

[Obsolete("Use SubscriptionFailed event.")]
public event Action<Security, MarketDataMessage, Exception> MarketDataUnexpectedCancelled

Event Type

Action<Security, MarketDataMessage, Exception>

MarketDepthChanged

Order book changed.

[Obsolete("Use OrderBookReceived event.")]
public event Action<MarketDepth> MarketDepthChanged

Event Type

Action<MarketDepth>

MarketDepthReceived

Order book received.

[Obsolete("Use OrderBookReceived event.")]
public event Action<Subscription, MarketDepth> MarketDepthReceived

Event Type

Action<Subscription, MarketDepth>

MarketDepthsChanged

Order books changed.

[Obsolete("Use OrderBookReceived event.")]
public event Action<IEnumerable<MarketDepth>> MarketDepthsChanged

Event Type

Action<IEnumerable<MarketDepth>>

MarketTimeChanged

Server time changed ExchangeBoards. It passed the time difference since the last call of the event. The first time the event passes the value Zero.

public event Action<TimeSpan> MarketTimeChanged

Event Type

Action<TimeSpan>

MassOrderCancelFailed

Mass order cancellation errors event.

public event Action<long, Exception> MassOrderCancelFailed

Event Type

Action<long, Exception>

MassOrderCancelFailed2

Mass order cancellation errors event.

public event Action<long, Exception, DateTimeOffset> MassOrderCancelFailed2

Event Type

Action<long, Exception, DateTimeOffset>

MassOrderCanceled

Mass order cancellation event.

public event Action<long> MassOrderCanceled

Event Type

Action<long>

MassOrderCanceled2

Mass order cancellation event.

public event Action<long, DateTimeOffset> MassOrderCanceled2

Event Type

Action<long, DateTimeOffset>

NewMarketDepth

Order book received.

[Obsolete("Use OrderBookReceived event.")]
public event Action<MarketDepth> NewMarketDepth

Event Type

Action<MarketDepth>

NewMarketDepths

Order books received.

[Obsolete("Use OrderBookReceived event.")]
public event Action<IEnumerable<MarketDepth>> NewMarketDepths

Event Type

Action<IEnumerable<MarketDepth>>

NewMessage

Message processed Message.

public event Action<Message> NewMessage

Event Type

Action<Message>

NewMyTrade

Own trade received.

public event Action<MyTrade> NewMyTrade

Event Type

Action<MyTrade>

NewMyTrades

Own trades received.

[Obsolete("Use NewMyTrade event.")]
public event Action<IEnumerable<MyTrade>> NewMyTrades

Event Type

Action<IEnumerable<MyTrade>>

NewNews

News received.

[Obsolete("Use NewsReceived event.")]
public event Action<News> NewNews

Event Type

Action<News>

NewOrder

Order received.

public event Action<Order> NewOrder

Event Type

Action<Order>

NewOrderLogItem

Order log received.

[Obsolete("Use OrderLogReceived event.")]
public event Action<OrderLogItem> NewOrderLogItem

Event Type

Action<OrderLogItem>

NewOrderLogItems

Order log received.

[Obsolete("Use OrderLogReceived event.")]
public event Action<IEnumerable<OrderLogItem>> NewOrderLogItems

Event Type

Action<IEnumerable<OrderLogItem>>

NewOrders

Orders received.

[Obsolete("Use single item event overload.")]
public event Action<IEnumerable<Order>> NewOrders

Event Type

Action<IEnumerable<Order>>

NewPortfolio

New portfolio received.

[Obsolete("Use PortfolioReceived event.")]
public event Action<Portfolio> NewPortfolio

Event Type

Action<Portfolio>

NewPortfolios

Portfolios received.

[Obsolete("Use PortfolioReceived event.")]
public event Action<IEnumerable<Portfolio>> NewPortfolios

Event Type

Action<IEnumerable<Portfolio>>

NewPosition

New position received.

[Obsolete("Use PositionReceived event.")]
public event Action<Position> NewPosition

Event Type

Action<Position>

NewPositions

Positions received.

[Obsolete("Use PositionReceived event.")]
public event Action<IEnumerable<Position>> NewPositions

Event Type

Action<IEnumerable<Position>>

NewSecurities

Securities received.

[Obsolete("Use SecurityReceived event.")]
public event Action<IEnumerable<Security>> NewSecurities

Event Type

Action<IEnumerable<Security>>

NewSecurity

Security received.

[Obsolete("Use SecurityReceived event.")]
public event Action<Security> NewSecurity

Event Type

Action<Security>

NewStopOrder

Stop-order received.

[Obsolete("Use NewOrder event.")]
public event Action<Order> NewStopOrder

Event Type

Action<Order>

NewStopOrders

Stop-orders received.

[Obsolete("Use NewOrders event.")]
public event Action<IEnumerable<Order>> NewStopOrders

Event Type

Action<IEnumerable<Order>>

NewTrade

Tick trade received.

[Obsolete("Use TickTradeReceived event.")]
public event Action<Trade> NewTrade

Event Type

Action<Trade>

NewTrades

Tick trades received.

[Obsolete("Use TickTradeReceived event.")]
public event Action<IEnumerable<Trade>> NewTrades

Event Type

Action<IEnumerable<Trade>>

NewsChanged

News updated (news body received Story).

[Obsolete("Use NewsReceived event.")]
public event Action<News> NewsChanged

Event Type

Action<News>

NewsReceived

News received.

public event Action<Subscription, News> NewsReceived

Event Type

Action<Subscription, News>

OrderBookReceived

Order book received.

public event Action<Subscription, IOrderBookMessage> OrderBookReceived

Event Type

Action<Subscription, IOrderBookMessage>

OrderCancelFailReceived

Order cancellation error event.

public event Action<Subscription, OrderFail> OrderCancelFailReceived

Event Type

Action<Subscription, OrderFail>

OrderCancelFailed

Order cancellation error event.

public event Action<OrderFail> OrderCancelFailed

Event Type

Action<OrderFail>

OrderChanged

Order changed (cancelled, matched).

public event Action<Order> OrderChanged

Event Type

Action<Order>

OrderEditFailReceived

Order edition error event.

public event Action<Subscription, OrderFail> OrderEditFailReceived

Event Type

Action<Subscription, OrderFail>

OrderEditFailed

EditOrder(Order, Order) error result event.

public event Action<long, OrderFail> OrderEditFailed

Event Type

Action<long, OrderFail>

OrderEdited

EditOrder(Order, Order) success result event.

public event Action<long, Order> OrderEdited

Event Type

Action<long, Order>

OrderLogItemReceived

Order log received.

[Obsolete("Use OrderLogReceived event.")]
public event Action<Subscription, OrderLogItem> OrderLogItemReceived

Event Type

Action<Subscription, OrderLogItem>

OrderLogReceived

Tick trade received.

public event Action<Subscription, IOrderLogMessage> OrderLogReceived

Event Type

Action<Subscription, IOrderLogMessage>

OrderReceived

Order received.

public event Action<Subscription, Order> OrderReceived

Event Type

Action<Subscription, Order>

OrderRegisterFailReceived

Order registration error event.

public event Action<Subscription, OrderFail> OrderRegisterFailReceived

Event Type

Action<Subscription, OrderFail>

OrderRegisterFailed

Order registration error event.

public event Action<OrderFail> OrderRegisterFailed

Event Type

Action<OrderFail>

OrderStatusFailed

Failed order status request event.

[Obsolete("Use SubscriptionFailed event.")]
public event Action<long, Exception> OrderStatusFailed

Event Type

Action<long, Exception>

OrderStatusFailed2

Failed order status request event.

public event Action<long, Exception, DateTimeOffset> OrderStatusFailed2

Event Type

Action<long, Exception, DateTimeOffset>

OrdersCancelFailed

Order cancellation errors event.

[Obsolete("Use single item event overload.")]
public event Action<IEnumerable<OrderFail>> OrdersCancelFailed

Event Type

Action<IEnumerable<OrderFail>>

OrdersChanged

Orders changed (cancelled, matched).

[Obsolete("Use single item event overload.")]
public event Action<IEnumerable<Order>> OrdersChanged

Event Type

Action<IEnumerable<Order>>

OrdersRegisterFailed

Order registration errors event.

[Obsolete("Use single item event overload.")]
public event Action<IEnumerable<OrderFail>> OrdersRegisterFailed

Event Type

Action<IEnumerable<OrderFail>>

OwnTradeReceived

Own trade received.

public event Action<Subscription, MyTrade> OwnTradeReceived

Event Type

Action<Subscription, MyTrade>

PortfolioChanged

Portfolio changed.

[Obsolete("Use PortfolioReceived event.")]
public event Action<Portfolio> PortfolioChanged

Event Type

Action<Portfolio>

PortfolioReceived

Portfolio received.

public event Action<Subscription, Portfolio> PortfolioReceived

Event Type

Action<Subscription, Portfolio>

PortfoliosChanged

Portfolios changed.

[Obsolete("Use PortfolioReceived event.")]
public event Action<IEnumerable<Portfolio>> PortfoliosChanged

Event Type

Action<IEnumerable<Portfolio>>

PositionChanged

Position changed.

[Obsolete("Use PositionReceived event.")]
public event Action<Position> PositionChanged

Event Type

Action<Position>

PositionReceived

Position received.

public event Action<Subscription, Position> PositionReceived

Event Type

Action<Subscription, Position>

PositionsChanged

Positions changed.

[Obsolete("Use PositionReceived event.")]
public event Action<IEnumerable<Position>> PositionsChanged

Event Type

Action<IEnumerable<Position>>

Restored

Connection restored.

[Obsolete("Use ConnectionRestored event.")]
public event Action Restored

Event Type

Action

SecuritiesChanged

Securities changed.

[Obsolete("Use SecurityReceived event.")]
public event Action<IEnumerable<Security>> SecuritiesChanged

Event Type

Action<IEnumerable<Security>>

SecurityChanged

Security changed.

[Obsolete("Use SecurityReceived event.")]
public event Action<Security> SecurityChanged

Event Type

Action<Security>

SecurityReceived

Security received.

public event Action<Subscription, Security> SecurityReceived

Event Type

Action<Subscription, Security>

SessionStateChanged

Session changed.

public event Action<ExchangeBoard, SessionStates> SessionStateChanged

Event Type

Action<ExchangeBoard, SessionStates>

StopOrderCancelFailed

Stop-order cancellation error event.

[Obsolete("Use OrderCancelFailed event.")]
public event Action<OrderFail> StopOrderCancelFailed

Event Type

Action<OrderFail>

StopOrderChanged

Stop order state change event.

[Obsolete("Use OrderChanged event.")]
public event Action<Order> StopOrderChanged

Event Type

Action<Order>

StopOrderRegisterFailed

Stop-order registration error event.

[Obsolete("Use OrderRegisterFailed event.")]
public event Action<OrderFail> StopOrderRegisterFailed

Event Type

Action<OrderFail>

StopOrdersCancelFailed

Stop-order cancellation errors event.

[Obsolete("Use OrdersCancelFailed event.")]
public event Action<IEnumerable<OrderFail>> StopOrdersCancelFailed

Event Type

Action<IEnumerable<OrderFail>>

StopOrdersChanged

Stop orders state change event.

[Obsolete("Use OrdersChanged event.")]
public event Action<IEnumerable<Order>> StopOrdersChanged

Event Type

Action<IEnumerable<Order>>

StopOrdersRegisterFailed

Stop-order registration errors event.

[Obsolete("Use OrdersRegisterFailed event.")]
public event Action<IEnumerable<OrderFail>> StopOrdersRegisterFailed

Event Type

Action<IEnumerable<OrderFail>>

SubscriptionFailed

Subscription is failed.

public event Action<Subscription, Exception, bool> SubscriptionFailed

Event Type

Action<Subscription, Exception, bool>

SubscriptionOnline

Subscription is online.

public event Action<Subscription> SubscriptionOnline

Event Type

Action<Subscription>

SubscriptionReceived

Message received.

public event Action<Subscription, object> SubscriptionReceived

Event Type

Action<Subscription, object>

SubscriptionStarted

Subscription is started.

public event Action<Subscription> SubscriptionStarted

Event Type

Action<Subscription>

SubscriptionStopped

Subscription is stopped.

public event Action<Subscription, Exception> SubscriptionStopped

Event Type

Action<Subscription, Exception>

TickTradeReceived

Tick trade received.

public event Action<Subscription, ITickTradeMessage> TickTradeReceived

Event Type

Action<Subscription, ITickTradeMessage>

TimeOut

Connection timed-out.

[Obsolete("Use ConnectionError event.")]
public event Action TimeOut

Event Type

Action

ValuesChanged

Security changed.

public event Action<Security, IEnumerable<KeyValuePair<Level1Fields, object>>, DateTimeOffset, DateTimeOffset> ValuesChanged

Event Type

Action<Security, IEnumerable<KeyValuePair<Level1Fields, object>>, DateTimeOffset, DateTimeOffset>