Connector
The class to create connections to trading systems.
継承元: BaseLogReceiver
実装: IConnector, IMessageTransport, IPersistable, ILogReceiver, ILogSource, IDisposable, IMarketDataProvider, ITransactionProvider, ISecurityProvider, ISecurityMessageProvider, ISubscriptionProvider, ITimeProvider, IPortfolioProvider, IPositionProvider
コンストラクター
Connector()
Initializes a new instance of the Connector.
Connector(ISecurityStorage, IPositionStorage, IExchangeInfoProvider, IStorageRegistry, ISnapshotRegistry, IStorageBuffer, bool, bool)
Initializes a new instance of the Connector.
- securityStorage
- Securities meta info storage.
- positionStorage
- Position storage.
- exchangeInfoProvider
- Exchanges and trading boards provider.
- storageRegistry
- The storage of market data.
- snapshotRegistry
- Snapshot storage registry.
- buffer
- Storage buffer.
- initAdapter
- Initialize basket adapter.
- initChannels
- Initialize channels.
プロパティ
Adapter : BasketMessageAdapter
Message adapter.
BasketSecurityProcessorProvider : IBasketSecurityProcessorProvider
Basket security processors provider.
BoardLookup : Subscription
Get global subscription on ExchangeBoard lookup. Can be .
Buffer : IStorageBuffer
Storage buffer.
CanConnect : bool
Determines this connector is ready for establish connection.
CheckSteps : bool
Check Price and Volume are they multiply to step.
CommissionManager : ICommissionManager
The commission calculating manager.
ConnectionState : ConnectionStates
Connection state.
DataTypeLookup : Subscription
Get global subscription on DataTypeInfoMessage lookup. Can be .
ErrorCount : int
The number of errors passed through the Error event.
ExchangeBoards : IEnumerable<ExchangeBoard>
The list of stock boards.
ExchangeInfoProvider : IExchangeInfoProvider
Exchanges and trading boards provider.
InMessageChannel : IMessageChannel
Input message channel.
InnerAdapter : IMessageAdapterWrapper
Inner message adapter.
IsAutoUnSubscribeOnDisconnect : bool
Send unsubscribe on disconnect command.
IsRestoreSubscriptionOnNormalReconnect : bool
Restore subscription on reconnect.
LatencyManager : ILatencyManager
Orders registration delay calculation manager.
MarketDataAdapter : IMessageAdapter
Market-data adapter.
MarketTimeChangedInterval : TimeSpan
The TimeMessage message generating Interval. The default is 10 milliseconds.
OrderLookup : Subscription
Get global subscription on Order lookup. Can be .
OrdersKeepCount : int
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.
OutMessageChannel : IMessageChannel
Outgoing message channel.
OverrideSecurityData : bool
Override previous security data by new values.
PnLManager : IPnLManager
The profit-loss manager.
PortfolioLookup : Subscription
Get global subscription on Portfolio lookup. Can be .
Portfolios : IEnumerable<Portfolio>
The list of portfolios.
Positions : IEnumerable<Position>
The list of positions.
PositionStorage : IPositionStorage
Position storage.
RiskManager : IRiskManager
Risk control manager.
Securities : IEnumerable<Security>
The list of instruments.
SecurityIdGenerator : SecurityIdGenerator
The instrument identifiers generator Id.
SecurityLookup : Subscription
Get global subscription on Security lookup. Can be .
SecurityStorage : ISecurityStorage
Securities meta info storage.
SlippageManager : ISlippageManager
Slippage manager.
SnapshotRegistry : ISnapshotRegistry
Snapshot storage registry.
StorageAdapter : StorageMetaInfoMessageAdapter
Storage adapter.
StorageRegistry : IStorageRegistry
The storage of market data.
Subscriptions : IEnumerable<Subscription>
The list of subscriptions.
SubscriptionsOnConnect : ISet<Subscription>
Send subscriptions on connect.
SupportAssociatedSecurity : bool
Use AssociatedSecurityAdapter.
SupportBasketSecurities : bool
Use BasketSecurityMessageAdapter.
SupportFilteredMarketDepth : bool
Use FilteredMarketDepthAdapter.
SupportLevel1DepthBuilder : bool
Use Level1DepthBuilderAdapter.
SupportSnapshots : bool
Use SnapshotHolderMessageAdapter.
TimeChange : bool
Increment periodically MarketTimeChangedInterval value of CurrentTime.
TransactionAdapter : IMessageAdapter
Transactional adapter.
TransactionIdGenerator : IdGenerator
Transaction id generator used for internal child subscription routing. Must be kept in sync with the parent adapter's generator.
UnsubscribeOnDisconnect : bool
Send unsubscribe on disconnect.
UpdatePortfolioByChange : bool
To update Portfolio fields when the PositionChangeMessage message appears. By default is enabled.
UpdateSecurityByDefinition : bool
To update Security fields when the SecurityMessage message appears. By default is enabled.
UpdateSecurityByLevel1 : bool
To update Security fields when the Level1ChangeMessage message appears. By default is enabled.
UpdateSecurityLastQuotes : bool
To update LastTick, BestBid, BestAsk at each update of order book and/or trades. By default is enabled.
メソッド
CancelOrderAsync(Order, CancellationToken) : ValueTask
Cancel the order asynchronously.
- order
- Order to cancel.
- cancellationToken
- CancellationToken
CancelOrders(bool?, Portfolio, Sides?, ExchangeBoard, Security, SecurityTypes?, long?)
Cancel orders by filter.
- isStopOrder
- , if cancel only a stop orders, - if regular orders, - both.
- portfolio
- Portfolio. If the value is equal to , then the portfolio does not match the orders cancel filter.
- direction
- Order side. If the value is , the direction does not use.
- board
- Trading board. If the value is equal to , then the board does not match the orders cancel filter.
- security
- Instrument. If the value is equal to , then the instrument does not match the orders cancel filter.
- securityType
- Security type. If the value is , the type does not use.
- transactionId
- Order cancellation transaction id.
CancelOrdersAsync(bool?, Portfolio, Sides?, ExchangeBoard, Security, SecurityTypes?, long?, CancellationToken) : ValueTask
Cancel orders by filter asynchronously.
- isStopOrder
- , if cancel only a stop orders, - if regular orders, - both.
- portfolio
- Portfolio. If the value is equal to , then the portfolio does not match the orders cancel filter.
- direction
- Order side. If the value is , the direction does not use.
- board
- Trading board. If the value is equal to , then the board does not match the orders cancel filter.
- security
- Instrument. If the value is equal to , then the instrument does not match the orders cancel filter.
- securityType
- Security type. If the value is , the type does not use.
- transactionId
- Order cancellation transaction id.
- cancellationToken
- CancellationToken
ChangePasswordAsync(SecureString, CancellationToken) : ValueTask
Change password.
- newPassword
- New password.
- cancellationToken
- CancellationToken
ClearCacheAsync(CancellationToken) : ValueTask
Clear cache.
Connect()
Connect to trading system.
CreateSecurityId(string, string) : string
Generate Id security.
- secCode
- SecurityCode.
- boardCode
- BoardCode.
戻り値: Id security.
Disconnect()
Disconnect from trading system.
DisposeManaged()
To release allocated resources. In particular, to disconnect from the trading system via Disconnect.
EditOrderAsync(Order, Order, CancellationToken) : ValueTask
Edit the order asynchronously.
- order
- Order to edit.
- changes
- Order to change with new values.
- cancellationToken
- CancellationToken
GetLevel1Fields(Security) : IEnumerable<Level1Fields>
To get a set of available fields Level1Fields, for which there is a market data for the instrument.
- security
- Security.
戻り値: Possible fields.
GetPortfolio(string) : Portfolio
To get the portfolio by the code name.
- name
- Portfolio code name.
戻り値: The got portfolio. If there is no portfolio by given criteria, is returned.
GetPosition(Portfolio, Security, string, Sides?, string, string, TPlusLimits?) : Position
To get the position by portfolio and instrument.
- portfolio
- The portfolio on which the position should be found.
- security
- The instrument on which the position should be found.
- strategyId
- Strategy ID.
- side
- Side.
- clientCode
- The client code.
- depoName
- The depository name where the stock is located physically. By default, an empty string is passed, which means the total position by all depositories.
- limit
- Limit type for Т+ market.
戻り値: Position.
GetSecurity(SecurityId) : Security
Get security by identifier.
- securityId
- Security ID.
戻り値: Security.
GetSecurityAsync(SecurityId, Func<Security, bool>, CancellationToken) : ValueTask<Security>
To get the instrument by the code.
- id
- Security ID.
- changeSecurity
- The handler changing the instrument. It returns if the instrument has been changed and the SecurityReceived should be called.
- cancellationToken
- CancellationToken
戻り値: Security.
GetSecurityAsync(SecurityId, CancellationToken) : ValueTask<Security>
Get security by identifier.
- securityId
- Security ID.
- cancellationToken
- CancellationToken
戻り値: Security.
GetSecurityValue(Security, Level1Fields) : object
To get the value of market data for the instrument.
- security
- Security.
- field
- Market-data field.
戻り値: The field value. If no data, the will be returned.
InitNewOrderAsync(Order, CancellationToken) : ValueTask
Initialize registering order (transaction id etc.).
- order
- New order.
- cancellationToken
- CancellationToken
IsOrderEditable(Order) : bool?
Determines the specified order can be edited by Order).
- order
- Order.
戻り値: if the order is editable, order cannot be changed, means no information.
IsOrderReplaceable(Order) : bool?
Determines the specified order can be replaced by Order).
- order
- Order.
戻り値: if the order is replaceable, order cannot be replaced, means no information.
LookupByIdAsync(SecurityId, CancellationToken) : ValueTask<Security>
To get the instrument by the identifier.
- id
- Security ID.
- cancellationToken
- CancellationToken
戻り値: The got instrument. If there is no instrument by given criteria, is returned.
LookupByPortfolioName(string) : Portfolio
To get the portfolio by the code name.
- name
- Portfolio code name.
戻り値: The got portfolio. If there is no portfolio by given criteria, is returned.
OnCancelOrderAsync(Order, long, CancellationToken) : ValueTask
Cancel the order.
- order
- Order to cancel.
- transactionId
- Order cancellation transaction id.
- cancellationToken
- CancellationToken
OnCancelOrdersAsync(long, CancellationToken, bool?, Portfolio, Sides?, ExchangeBoard, Security, SecurityTypes?) : ValueTask
Cancel orders by filter.
- transactionId
- Order cancellation transaction id.
- cancellationToken
- Cancellation token.
- isStopOrder
- , if cancel only a stop orders, - if regular orders, - both.
- portfolio
- Portfolio. If the value is equal to , then the portfolio does not match the orders cancel filter.
- direction
- Order side. If the value is , the direction does not use.
- board
- Trading board. If the value is equal to , then the board does not match the orders cancel filter.
- security
- Instrument. If the value is equal to , then the instrument does not match the orders cancel filter.
- securityType
- Security type. If the value is , the type does not use.
OnConnectAsync(CancellationToken) : ValueTask
Connect to trading system.
OnDisconnectAsync(CancellationToken) : ValueTask
Disconnect from trading system.
OnEditOrderAsync(Order, Order, CancellationToken) : ValueTask
Edit the order.
- order
- Order.
- changes
- Order changes.
- cancellationToken
- CancellationToken
OnProcessMessage(Message, CancellationToken) : ValueTask
Process message.
- message
- Message.
- cancellationToken
- CancellationToken
OnRegisterOrderAsync(Order, CancellationToken) : ValueTask
Register new order.
- order
- Registration details.
- cancellationToken
- CancellationToken
OnReRegisterOrderAsync(Order, Order, CancellationToken) : ValueTask
Reregister the order.
- oldOrder
- Cancelling order.
- newOrder
- New order to register.
- cancellationToken
- CancellationToken
RaiseConnected()
To call the event Connected.
RaiseConnectionErrorEx(IMessageAdapter, Exception)
To call the event ConnectionErrorEx.
- adapter
- Adapter, initiated event.
- exception
- Error connection.
RaiseCurrentTimeChanged(TimeSpan)
To call the event CurrentTimeChanged.
- diff
- The difference in the time since the last call of the event. The first time the event passes the Zero value.
RaiseDisconnected()
To call the event Disconnected.
RaiseDisconnectedEx(IMessageAdapter)
To call the event DisconnectedEx.
- adapter
- Adapter, initiated event.
RaiseLookupPortfoliosResult(PortfolioLookupMessage, Exception, Portfolio[])
To call the event LookupPortfoliosResult.
- message
- Message.
- error
- An error of lookup operation. The value will be if operation complete successfully.
- newPortfolios
- Found portfolios.
RaiseLookupSecuritiesResult(SecurityLookupMessage, Exception, Security[])
To call the event LookupSecuritiesResult.
- message
- Message.
- error
- An error of lookup operation. The value will be if operation complete successfully.
- newSecurities
- Found instruments.
RegisterOrderAsync(Order, CancellationToken) : ValueTask
Register new order asynchronously.
- order
- Registration details.
- cancellationToken
- CancellationToken
ReRegisterOrder(Order, Order)
Reregister the order.
- oldOrder
- Cancelling order.
- newOrder
- New order to register.
ReRegisterOrderAsync(Order, Order, CancellationToken) : ValueTask
Reregister the order asynchronously.
- oldOrder
- Cancelling order.
- newOrder
- New order to register.
- cancellationToken
- CancellationToken
SendInMessage(Message)
Send a message from the server module to connected clients.
SendInMessageAsync(Message, CancellationToken) : ValueTask
Processes a generic message asynchronously.
- message
- The message to process.
- cancellationToken
- CancellationToken
SendOutErrorAsync(Exception, CancellationToken) : ValueTask
Send error message.
- error
- Error details.
- cancellationToken
- CancellationToken
SendOutMessageAsync(Message, CancellationToken) : ValueTask
Send outgoing message (state change, order, etc.).
- message
- Message.
- cancellationToken
- CancellationToken
イベント
BoardReceived : Action<Subscription, ExchangeBoard>
ExchangeBoard received.
CandleReceived : Action<Subscription, ICandleMessage>
ICandleMessage received.
ChangePasswordResult : Action<long, Exception>
Change password result.
ConnectedEx : Action<IMessageAdapter>
Connected.
ConnectionError : Action<Exception>
Connection error (for example, the connection was aborted by server).
ConnectionErrorEx : Action<IMessageAdapter, Exception>
Connection error (for example, the connection was aborted by server).
ConnectionLost : Action<IMessageAdapter>
Connection lost.
ConnectionRestored : Action<IMessageAdapter>
Connection restored.
CurrentTimeChanged : Action<TimeSpan>
Server time changed CurrentTime. It passed the time difference since the last call of the event. The first time the event passes the value Zero.
DataTypeReceived : Action<Subscription, DataType>
DataType received.
Disconnected : Action
Disconnected.
DisconnectedEx : Action<IMessageAdapter>
Disconnected.
Level1Received : Action<Subscription, Level1ChangeMessage>
Level1ChangeMessage received.
LookupPortfoliosResult : Action<PortfolioLookupMessage, IEnumerable<Portfolio>, Exception>
Lookup result PortfolioLookupMessage received.
LookupPortfoliosResult2 : Action<PortfolioLookupMessage, IEnumerable<Portfolio>, IEnumerable<Portfolio>, Exception>
Lookup result PortfolioLookupMessage received.
LookupSecuritiesResult : Action<SecurityLookupMessage, IEnumerable<Security>, Exception>
Lookup result SecurityLookupMessage received.
LookupSecuritiesResult2 : Action<SecurityLookupMessage, IEnumerable<Security>, IEnumerable<Security>, Exception>
Lookup result SecurityLookupMessage received.
MassOrderCanceled : Action<long>
Mass order cancellation event.
MassOrderCanceled2 : Action<long, DateTime>
Mass order cancellation event.
MassOrderCancelFailed : Action<long, Exception>
Mass order cancellation errors event.
MassOrderCancelFailed2 : Action<long, Exception, DateTime>
Mass order cancellation errors event.
NewMyTrade : Action<MyTrade>
Own trade received.
NewOutMessageAsync : Func<Message, CancellationToken, ValueTask>
New message event.
NewPortfolio : Action<Portfolio>
New portfolio received.
NewPosition : Action<Position>
New position received.
NewsReceived : Action<Subscription, News>
News received.
OrderBookReceived : Action<Subscription, IOrderBookMessage>
IOrderBookMessage received.
OrderCancelFailed : Action<OrderFail>
Order cancellation error event.
OrderCancelFailReceived : Action<Subscription, OrderFail>
OrderFail cancellation event.
OrderChanged : Action<Order>
Order changed (cancelled, matched).
OrderEdited : Action<long, Order>
Order) success result event.
OrderEditFailed : Action<long, OrderFail>
Order) error result event.
OrderEditFailReceived : Action<Subscription, OrderFail>
OrderFail edition event.
OrderLogReceived : Action<Subscription, IOrderLogMessage>
IOrderLogMessage received.
OrderReceived : Action<Subscription, Order>
Order received.
OrderRegisterFailed : Action<OrderFail>
Order registration error event.
OrderRegisterFailReceived : Action<Subscription, OrderFail>
OrderFail registration event.
OwnTradeReceived : Action<Subscription, MyTrade>
MyTrade received.
PortfolioChanged : Action<Portfolio>
Portfolio changed.
PortfolioReceived : Action<Subscription, Portfolio>
Portfolio received.
PositionChanged : Action<Position>
Position changed.
PositionReceived : Action<Subscription, Position>
Position received.
SecurityReceived : Action<Subscription, Security>
Security received.
SubscriptionFailed : Action<Subscription, Exception, bool>
Subscription is failed.
SubscriptionOnline : Action<Subscription>
Subscription is online.
SubscriptionReceived : Action<Subscription, object>
Value received.
SubscriptionStarted : Action<Subscription>
Subscription is started.
SubscriptionStopped : Action<Subscription, Exception>
Subscription is stopped.
TickTradeReceived : Action<Subscription, ITickTradeMessage>
ITickTradeMessage received.
ValuesChanged : Action<Security, IEnumerable<KeyValuePair<Level1Fields, object>>, DateTime, DateTime>
Security changed.