Class MessageAdapter
- Namespace
- StockSharp.Messages
- Assembly
- StockSharp.Messages.dll
The base adapter converts messages Message to the command of the trading system and back.
public abstract class MessageAdapter : BaseLogReceiver, IMessageAdapter, IMessageChannel, ICloneable<IMessageChannel>, ICloneable, IPersistable, ILogReceiver, ILogSource, IDisposable, INotifyPropertyChanged
- Inheritance
-
MessageAdapter
- Implements
-
ICloneable<IMessageChannel>IPersistable
- Derived
- Inherited Members
- Extension Methods
Constructors
MessageAdapter(IdGenerator)
Initialize MessageAdapter.
protected MessageAdapter(IdGenerator transactionIdGenerator)
Parameters
transactionIdGenerator
IdGeneratorTransaction id generator.
Properties
AssociatedBoards
The adapter can process subscription only with instruments associated with the specified board.
[Browsable(false)]
public virtual string[] AssociatedBoards { get; }
Property Value
- string[]
CandlesBuildFrom
Possible options for candles building.
[Browsable(false)]
public virtual IEnumerable<Level1Fields> CandlesBuildFrom { get; }
Property Value
Categories
Message adapter categories.
[Browsable(false)]
public virtual MessageAdapterCategories Categories { get; }
Property Value
CheckTimeFrameByRequest
Check possible time-frame by request.
[Browsable(false)]
public virtual bool CheckTimeFrameByRequest { get; set; }
Property Value
EnqueueSubscriptions
Enqueue subscriptions.
[Display(ResourceType = typeof(LocalizedStrings), Name = "EnqueueSubscriptions", Description = "EnqueueSubscriptionsDesc", GroupName = "Adapters", Order = 301)]
public virtual bool EnqueueSubscriptions { get; set; }
Property Value
Remarks
Do not send new request before received confirmation for previous.
ExtraSetup
The adapter requires extra setup.
[Browsable(false)]
public virtual bool ExtraSetup { get; }
Property Value
FeatureName
Feature name.
[Browsable(false)]
public virtual string FeatureName { get; }
Property Value
GenerateOrderBookFromLevel1
Generate QuoteChangeMessage from Level1ChangeMessage.
[Display(ResourceType = typeof(LocalizedStrings), Name = "Level1", Description = "Level1ToOrderBooks", GroupName = "Adapters", Order = 302)]
public virtual bool GenerateOrderBookFromLevel1 { get; set; }
Property Value
HeartbeatBeforConnect
Start sending TimeMessage before connection established.
[Browsable(false)]
public virtual bool HeartbeatBeforConnect { get; }
Property Value
HeartbeatInterval
Server check interval for track the connection alive. The value is Zero turned off tracking.
[Display(ResourceType = typeof(LocalizedStrings), Name = "HeartBeat", Description = "HeartBeatDesc", GroupName = "Adapters", Order = 300)]
public TimeSpan HeartbeatInterval { get; set; }
Property Value
Icon
Icon.
[Browsable(false)]
public virtual Uri Icon { get; }
Property Value
IsAutoReplyOnTransactonalUnsubscription
Send auto response for OrderStatusMessage and PortfolioLookupMessage unsubscribes.
[Browsable(false)]
public virtual bool IsAutoReplyOnTransactonalUnsubscription { get; }
Property Value
IsFullCandlesOnly
Translates CandleMessage as only fully filled.
[Browsable(false)]
public virtual bool IsFullCandlesOnly { get; }
Property Value
IsNativeIdentifiers
Identify security in messages by native identifier Native.
[Browsable(false)]
public virtual bool IsNativeIdentifiers { get; }
Property Value
IsNativeIdentifiersPersistable
Native identifier can be stored.
[Browsable(false)]
public virtual bool IsNativeIdentifiersPersistable { get; }
Property Value
IsPositionsEmulationRequired
Adapter required emulation PositionChangeMessage.
[Browsable(false)]
public virtual bool? IsPositionsEmulationRequired { get; }
Property Value
- bool?
Remarks
IsReplaceCommandEditCurrent
Is the OrderReplaceMessage command edit a current order.
[Browsable(false)]
public virtual bool IsReplaceCommandEditCurrent { get; }
Property Value
IsSecurityNewsOnly
Adapter provides news related with specified security.
[Browsable(false)]
public virtual bool IsSecurityNewsOnly { get; }
Property Value
IsSupportExecutionsPnL
Adapter fills PnL.
[Browsable(false)]
public virtual bool IsSupportExecutionsPnL { get; }
Property Value
IsSupportOrderBookIncrements
Adapter translates incremental order books.
[Browsable(false)]
public virtual bool IsSupportOrderBookIncrements { get; }
Property Value
IsSupportPartialDownloading
Support partial downloading.
[Browsable(false)]
public virtual bool IsSupportPartialDownloading { get; }
Property Value
IsSupportSubscriptions
Support any subscriptions (ticks, order books etc.).
[Browsable(false)]
public virtual bool IsSupportSubscriptions { get; }
Property Value
IsSupportTransactionLog
Adapter translates orders changes on reply of OrderStatusMessage.
[Browsable(false)]
public virtual bool IsSupportTransactionLog { get; }
Property Value
IterationInterval
Interval between iterations.
[Display(ResourceType = typeof(LocalizedStrings), Name = "Iterations", Description = "IterationInterval", GroupName = "Adapters", Order = 304)]
public virtual TimeSpan IterationInterval { get; set; }
Property Value
LookupTimeout
Lookup timeout.
[Browsable(false)]
public virtual TimeSpan? LookupTimeout { get; }
Property Value
Name
The source name.
public override string Name { get; set; }
Property Value
OrderConditionType
Type of OrderCondition.
[Browsable(false)]
public virtual Type OrderConditionType { get; }
Property Value
Remarks
If the connection does not support the order type Conditional, it will be returned null.
Platform
Bit process, which can run the adapter.
[Browsable(false)]
public Platforms Platform { get; protected set; }
Property Value
- Platforms
PossibleSupportedMessages
Possible supported by adapter message types.
[Browsable(false)]
public virtual IEnumerable<MessageTypeInfo> PossibleSupportedMessages { get; set; }
Property Value
ReConnectionSettings
Connection tracking settings IMessageAdapter with a server.
[Display(ResourceType = typeof(LocalizedStrings), Name = "ReConnectionSettings", Description = "ReConnectionDesc", GroupName = "Connection")]
public ReConnectionSettings ReConnectionSettings { get; }
Property Value
SecurityExtendedFields
Names of extended security fields in SecurityMessage.
[Browsable(false)]
public virtual IEnumerable<Tuple<string, Type>> SecurityExtendedFields { get; }
Property Value
StorageName
The storage name, associated with the adapter.
[Browsable(false)]
public virtual string StorageName { get; }
Property Value
SupportedInMessages
Supported by adapter message types.
[Browsable(false)]
public virtual IEnumerable<MessageTypes> SupportedInMessages { get; set; }
Property Value
SupportedMarketDataTypes
Supported by adapter market data types.
[Browsable(false)]
public virtual IEnumerable<DataType> SupportedMarketDataTypes { get; set; }
Property Value
SupportedOrderBookDepths
Available options for MaxDepth.
[Browsable(false)]
public virtual IEnumerable<int> SupportedOrderBookDepths { get; }
Property Value
SupportedResultMessages
Supported by adapter result message types.
[Browsable(false)]
public virtual IEnumerable<MessageTypes> SupportedResultMessages { get; set; }
Property Value
TimeFrames
Get possible time-frames for the specified instrument.
protected virtual IEnumerable<TimeSpan> TimeFrames { get; }
Property Value
TransactionIdGenerator
Transaction id generator.
[Browsable(false)]
public IdGenerator TransactionIdGenerator { get; set; }
Property Value
- IdGenerator
UseChannels
Use channels for in and out messages.
[Display(ResourceType = typeof(LocalizedStrings), Name = "Channels", Description = "UseChannels", GroupName = "Adapters", Order = 303)]
public virtual bool UseChannels { get; set; }
Property Value
Methods
Clone()
Create a copy of MessageAdapter.
public virtual IMessageChannel Clone()
Returns
- IMessageChannel
Copy.
CreateOrderLogMarketDepthBuilder(SecurityId)
Create market depth builder.
public virtual IOrderLogMarketDepthBuilder CreateOrderLogMarketDepthBuilder(SecurityId securityId)
Parameters
securityId
SecurityIdSecurity ID.
Returns
- IOrderLogMarketDepthBuilder
Order log to market depth builder.
GetCandleArgs(Type, SecurityId, DateTimeOffset?, DateTimeOffset?)
Get possible args for the specified candle type and instrument.
public virtual IEnumerable<object> GetCandleArgs(Type candleType, SecurityId securityId, DateTimeOffset? from, DateTimeOffset? to)
Parameters
candleType
TypeThe type of the message CandleMessage.
securityId
SecurityIdSecurity ID.
from
DateTimeOffset?The initial date from which you need to get data.
to
DateTimeOffset?The final date by which you need to get data.
Returns
- IEnumerable<object>
Possible args.
GetHistoryStepSize(SecurityId, DataType, out TimeSpan)
Get maximum size step allowed for historical download.
public virtual TimeSpan GetHistoryStepSize(SecurityId securityId, DataType dataType, out TimeSpan iterationInterval)
Parameters
securityId
SecurityIddataType
DataTypeData type info.
iterationInterval
TimeSpanInterval between iterations.
Returns
- TimeSpan
Step.
GetMaxCount(DataType)
Get maximum possible items count per single subscription request.
public virtual int? GetMaxCount(DataType dataType)
Parameters
dataType
DataTypeData type info.
Returns
- int?
Max items count.
GetSupportedDataTypes(SecurityId)
Get supported data types for the specified SecurityId.
public virtual IEnumerable<DataType> GetSupportedDataTypes(SecurityId securityId)
Parameters
securityId
SecurityId
Returns
- IEnumerable<DataType>
Supported data types.
GetTimeFrames(SecurityId, DateTimeOffset?, DateTimeOffset?)
Get possible time-frames for the specified instrument.
[Obsolete("Use GetCandleArgs method.")]
protected virtual IEnumerable<TimeSpan> GetTimeFrames(SecurityId securityId, DateTimeOffset? from, DateTimeOffset? to)
Parameters
securityId
SecurityIdSecurity ID.
from
DateTimeOffset?The initial date from which you need to get data.
to
DateTimeOffset?The final date by which you need to get data.
Returns
- IEnumerable<TimeSpan>
Possible time-frames.
IsAllDownloadingSupported(DataType)
Is for the specified dataType
all securities downloading enabled.
public virtual bool IsAllDownloadingSupported(DataType dataType)
Parameters
dataType
DataTypeData type info.
Returns
- bool
Check result.
IsSecurityRequired(DataType)
Support filtering subscriptions (subscribe/unsubscribe for specified security).
public virtual bool IsSecurityRequired(DataType dataType)
Parameters
dataType
DataTypeData type info.
Returns
- bool
Check result.
IsSupportCandlesPriceLevels(MarketDataMessage)
Support candles PriceLevels.
public virtual bool IsSupportCandlesPriceLevels(MarketDataMessage subscription)
Parameters
subscription
MarketDataMessage
Returns
- bool
Check result.
IsSupportCandlesUpdates(MarketDataMessage)
Support candles subscription and live updates.
public virtual bool IsSupportCandlesUpdates(MarketDataMessage subscription)
Parameters
subscription
MarketDataMessage
Returns
- bool
Check result.
Load(SettingsStorage)
Load settings.
public override void Load(SettingsStorage storage)
Parameters
storage
SettingsStorageSettings storage.
OnPropertyChanged(string)
Raise PropertyChanged event.
protected void OnPropertyChanged(string propertyName = null)
Parameters
propertyName
stringThe name of the property that changed.
OnSendInMessage(Message)
Send message.
protected abstract bool OnSendInMessage(Message message)
Parameters
message
MessageMessage.
Returns
Save(SettingsStorage)
Save settings.
public override void Save(SettingsStorage storage)
Parameters
storage
SettingsStorageSettings storage.
SendInMessage(Message)
Send message.
public bool SendInMessage(Message message)
Parameters
message
MessageMessage.
Returns
SendOutDisconnectMessage(bool)
Send to SendOutMessage(Message) disconnect message.
protected void SendOutDisconnectMessage(bool expected)
Parameters
expected
boolIs disconnect expected.
SendOutDisconnectMessage(Exception)
Send to SendOutMessage(Message) disconnect message.
protected void SendOutDisconnectMessage(Exception error)
Parameters
SendOutError(Exception)
Initialize a new message ErrorMessage and pass it to the method SendOutMessage(Message).
protected void SendOutError(Exception error)
Parameters
error
ExceptionError details.
SendOutError(string)
Initialize a new message ErrorMessage and pass it to the method SendOutMessage(Message).
protected void SendOutError(string description)
Parameters
description
stringError details.
SendOutMessage(Message)
Send outgoing message and raise NewOutMessage event.
protected virtual void SendOutMessage(Message message)
Parameters
message
MessageMessage.
SendSubscriptionFinished(long, DateTimeOffset?)
Initialize a new message SubscriptionFinishedMessage and pass it to the method SendOutMessage(Message).
protected void SendSubscriptionFinished(long originalTransactionId, DateTimeOffset? nextFrom = null)
Parameters
originalTransactionId
longID of the original message for which this message is a response.
nextFrom
DateTimeOffset?
SendSubscriptionNotSupported(long)
Initialize a new message SubscriptionResponseMessage and pass it to the method SendOutMessage(Message).
protected void SendSubscriptionNotSupported(long originalTransactionId)
Parameters
originalTransactionId
longID of the original message for which this message is a response.
SendSubscriptionOnline(long)
Initialize a new message SubscriptionOnlineMessage and pass it to the method SendOutMessage(Message).
protected void SendSubscriptionOnline(long originalTransactionId)
Parameters
originalTransactionId
longID of the original message for which this message is a response.
SendSubscriptionReply(long, Exception)
Initialize a new message SubscriptionResponseMessage and pass it to the method SendOutMessage(Message).
protected void SendSubscriptionReply(long originalTransactionId, Exception error = null)
Parameters
originalTransactionId
longID of the original message for which this message is a response.
error
ExceptionSubscribe or unsubscribe error info. To be set if the answer.
SendSubscriptionResult(ISubscriptionMessage)
Initialize a new message SubscriptionOnlineMessage or SubscriptionFinishedMessage and pass it to the method SendOutMessage(Message).
protected void SendSubscriptionResult(ISubscriptionMessage message)
Parameters
message
ISubscriptionMessageSubscription.
ValidateSecurityId(SecurityId)
Validate the specified security id is supported by the adapter and subscription can be done.
protected virtual bool ValidateSecurityId(SecurityId secId)
Parameters
secId
SecurityId
Returns
- bool
Check result.
Events
NewOutMessage
New message event.
public event Action<Message> NewOutMessage