Class BaseFixDialect
- Namespace
- StockSharp.Fix.Dialects
- Assembly
- StockSharp.Fix.Core.dll
Base class describing the dialect of the FIX protocol.
public abstract class BaseFixDialect : BaseLogReceiver, IFixDialect, IMessageAdapter, IMessageChannel, ICloneable<IMessageChannel>, ICloneable, IPersistable, ILogReceiver, ILogSource, IDisposable, IDemoAdapter
- Inheritance
-
BaseFixDialect
- Implements
-
ICloneable<IMessageChannel>IPersistable
- Derived
- Inherited Members
- Extension Methods
Constructors
BaseFixDialect(IdGenerator, Encoding, string, FixFormats)
Initialize BaseFixDialect.
protected BaseFixDialect(IdGenerator transactionIdGenerator, Encoding encoding, string version = "FIX.4.4", FixFormats format = FixFormats.Text)
Parameters
transactionIdGenerator
IdGeneratorTransaction id generator.
encoding
EncodingEncoding.
version
stringFIX version.
format
FixFormatsFIX protocol format.
Properties
Accounts
Accounts associated with FIX login.
public string Accounts { get; set; }
Property Value
Address
Server address.
protected EndPoint Address { get; }
Property Value
AssociatedBoards
The adapter can process subscription only with instruments associated with the specified board.
public string[] AssociatedBoards { get; }
Property Value
- string[]
CancelOnDisconnect
Cancel On Disconnect.
public virtual bool CancelOnDisconnect { get; set; }
Property Value
CandlesBuildFrom
Possible options for candles building.
public virtual IEnumerable<Level1Fields> CandlesBuildFrom { get; }
Property Value
Categories
Message adapter categories.
public virtual MessageAdapterCategories Categories { get; }
Property Value
CheckTimeFrameByRequest
Check possible time-frame by request.
public virtual bool CheckTimeFrameByRequest { get; }
Property Value
ClientCode
Client code assigned by the broker.
public string ClientCode { get; set; }
Property Value
ClientVersion
Client app version.
public string ClientVersion { get; set; }
Property Value
CurrentCounter
Counter.
public virtual long CurrentCounter { get; set; }
Property Value
DateParser
Date parser.
public FastDateTimeParser DateParser { get; set; }
Property Value
- FastDateTimeParser
DoNotSendAccount
Do not send Account.
public bool DoNotSendAccount { get; set; }
Property Value
Encoding
Encoding.
public Encoding Encoding { get; set; }
Property Value
EnqueueSubscriptions
Enqueue subscriptions.
public virtual bool EnqueueSubscriptions { get; set; }
Property Value
Remarks
Do not send new request before received confirmation for previous.
ExchangeBoard
Board, where securities are traded.
public string ExchangeBoard { get; set; }
Property Value
ExtraSetup
The adapter requires extra setup.
public virtual bool ExtraSetup { get; }
Property Value
FeatureName
Feature name.
public virtual string FeatureName { get; }
Property Value
Format
FIX protocol format.
public FixFormats Format { get; }
Property Value
GenerateOrderBookFromLevel1
Generate QuoteChangeMessage from Level1ChangeMessage.
public virtual bool GenerateOrderBookFromLevel1 { get; set; }
Property Value
HeartbeatBeforConnect
Start sending TimeMessage before connection established.
public virtual bool HeartbeatBeforConnect { get; }
Property Value
HeartbeatInterval
Server check interval for track the connection alive. The value is Zero turned off tracking.
public TimeSpan HeartbeatInterval { get; set; }
Property Value
Icon
Icon.
public virtual Uri Icon { get; }
Property Value
IsAutoReplyOnTransactonalUnsubscription
Send auto response for OrderStatusMessage and PortfolioLookupMessage unsubscribes.
public virtual bool IsAutoReplyOnTransactonalUnsubscription { get; }
Property Value
IsDemo
Connect to demo trading instead of real trading server.
public bool IsDemo { get; set; }
Property Value
IsFullCandlesOnly
Translates CandleMessage as only fully filled.
public virtual bool IsFullCandlesOnly { get; }
Property Value
IsNativeIdentifiers
Identify security in messages by native identifier Native.
public virtual bool IsNativeIdentifiers { get; }
Property Value
IsNativeIdentifiersPersistable
Native identifier can be stored.
public virtual bool IsNativeIdentifiersPersistable { get; }
Property Value
IsPositionsEmulationRequired
Adapter required emulation PositionChangeMessage.
public virtual bool? IsPositionsEmulationRequired { get; }
Property Value
- bool?
Remarks
IsReplaceCommandEditCurrent
Is the OrderReplaceMessage command edit a current order.
public virtual bool IsReplaceCommandEditCurrent { get; }
Property Value
IsResetCounter
Should the sequence counter be reset.
public bool IsResetCounter { get; set; }
Property Value
IsSecurityNewsOnly
Adapter provides news related with specified security.
public virtual bool IsSecurityNewsOnly { get; }
Property Value
IsSupportExecutionsPnL
Adapter fills PnL.
public virtual bool IsSupportExecutionsPnL { get; }
Property Value
IsSupportMarketDataResponse
Support market-data response.
protected virtual bool IsSupportMarketDataResponse { get; }
Property Value
IsSupportOrderBookIncrements
Adapter translates incremental order books.
public virtual bool IsSupportOrderBookIncrements { get; }
Property Value
IsSupportPartialDownloading
Support partial downloading.
public virtual bool IsSupportPartialDownloading { get; }
Property Value
IsSupportSubscriptions
Support any subscriptions (ticks, order books etc.).
public virtual bool IsSupportSubscriptions { get; }
Property Value
IsSupportTransactionLog
Adapter translates orders changes on reply of OrderStatusMessage.
public virtual bool IsSupportTransactionLog { get; }
Property Value
IterationInterval
Interval between iterations.
public virtual TimeSpan IterationInterval { get; }
Property Value
LastResendRequest
protected long LastResendRequest { get; }
Property Value
Login
Login.
public string Login { get; set; }
Property Value
LoginAsPortfolioName
Use Login as portfolio name.
protected virtual bool LoginAsPortfolioName { get; }
Property Value
LookupTimeout
Lookup timeout.
public virtual TimeSpan? LookupTimeout { get; }
Property Value
NewOrderSingleErrorsAsReject
Reply errors for messages of type NewOrderSingle transfers via Reject.
protected virtual bool NewOrderSingleErrorsAsReject { get; }
Property Value
OrderConditionType
Type of OrderCondition.
public virtual Type OrderConditionType { get; }
Property Value
Remarks
If the connection does not support the order type Conditional, it will be returned null.
OverrideExecIdByNative
Override ExecId by native identifier (if present in FIX message).
public bool OverrideExecIdByNative { get; set; }
Property Value
Password
Password.
public SecureString Password { get; set; }
Property Value
PossibleSupportedMessages
Possible supported by adapter message types.
public virtual IEnumerable<MessageTypeInfo> PossibleSupportedMessages { get; }
Property Value
QuotesAsLevel1
Translate quote data as Level1ChangeMessage or QuoteChangeMessage.
public bool QuotesAsLevel1 { get; set; }
Property Value
ReConnectionSettings
Connection tracking settings IMessageAdapter with a server.
public ReConnectionSettings ReConnectionSettings { get; }
Property Value
SecurityExtendedFields
Names of extended security fields in SecurityMessage.
public virtual IEnumerable<Tuple<string, Type>> SecurityExtendedFields { get; }
Property Value
SenderCompId
Sender ID.
public string SenderCompId { get; set; }
Property Value
State
State.
public virtual ChannelStates State { get; }
Property Value
StorageName
The storage name, associated with the adapter.
public virtual string StorageName { get; }
Property Value
SupportLicensing
Support of licensing features.
public virtual bool SupportLicensing { get; }
Property Value
SupportUnknownExecutions
Support executions processing, generated by third-party software.
public virtual bool SupportUnknownExecutions { get; set; }
Property Value
SupportedInMessages
Supported by adapter message types.
public virtual IEnumerable<MessageTypes> SupportedInMessages { get; set; }
Property Value
SupportedMarketDataTypes
Supported by adapter market data types.
public virtual IEnumerable<DataType> SupportedMarketDataTypes { get; set; }
Property Value
SupportedOrderBookDepths
Available options for MaxDepth.
public virtual IEnumerable<int> SupportedOrderBookDepths { get; }
Property Value
SupportedResultMessages
Supported by adapter result message types.
public virtual IEnumerable<MessageTypes> SupportedResultMessages { get; set; }
Property Value
TargetCompId
Target ID.
public string TargetCompId { get; set; }
Property Value
TickAsLevel1
Translate tick data as Level1ChangeMessage or ExecutionMessage.
public bool TickAsLevel1 { get; set; }
Property Value
TimeFrames
Possible time-frames.
protected virtual IEnumerable<TimeSpan> TimeFrames { get; }
Property Value
TimeParser
Time parser.
public FastTimeSpanParser TimeParser { get; set; }
Property Value
- FastTimeSpanParser
TimeStampParser
Time stamp parser.
public FastDateTimeParser TimeStampParser { get; set; }
Property Value
- FastDateTimeParser
TimeZone
Information about the time zone where the exchange is located.
public TimeZoneInfo TimeZone { get; set; }
Property Value
TransactionIdGenerator
Transaction id generator.
public virtual IdGenerator TransactionIdGenerator { get; }
Property Value
- IdGenerator
UseChannels
Use channels for in and out messages.
public virtual bool UseChannels { get; }
Property Value
Version
FIX version.
public string Version { get; }
Property Value
YearMonthParser
Year and month parser.
public FastDateTimeParser YearMonthParser { get; set; }
Property Value
- FastDateTimeParser
Methods
ApplyTimeInForce(ExecutionReport, ExecutionMessage, bool)
Apply time in force.
protected virtual bool ApplyTimeInForce(ExecutionReport report, ExecutionMessage msg, bool throwInvalid = true)
Parameters
report
ExecutionReportmsg
ExecutionMessagethrowInvalid
bool
Returns
CheckState()
Check state before connect.
protected virtual void CheckState()
Clone()
public virtual IMessageChannel Clone()
Returns
Close()
Close channel.
public virtual void Close()
CreateOrderLogMarketDepthBuilder(SecurityId)
Create market depth builder.
public virtual IOrderLogMarketDepthBuilder CreateOrderLogMarketDepthBuilder(SecurityId securityId)
Parameters
securityId
SecurityIdSecurity ID.
Returns
- IOrderLogMarketDepthBuilder
Order log to market depth builder.
FromSecurityTradingStatus(int?)
Convert SecurityTradingStatus to SecurityStates value.
protected virtual SecurityStates? FromSecurityTradingStatus(int? status)
Parameters
status
int?SecurityTradingStatus value.
Returns
- SecurityStates?
SecurityStates value.
GetBoardCode(string, string, string)
Get board code.
protected virtual string GetBoardCode(string destination, string exchange, string tradingSession)
Parameters
Returns
- string
Board code.
GetCandleArgs(Type, SecurityId, DateTimeOffset?, DateTimeOffset?)
Get possible args for the specified candle type and instrument.
public 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.
GetExecutionTime(ExecutionReport)
Get execution time.
protected virtual DateTimeOffset GetExecutionTime(ExecutionReport report)
Parameters
report
ExecutionReport
Returns
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.
GetOrderState(ExecutionReport)
Convert OrdStatus to OrderStates value.
protected virtual OrderStates? GetOrderState(ExecutionReport report)
Parameters
report
ExecutionReportExecutionReport value.
Returns
- OrderStates?
OrderStates value.
GetOrderStringId(string)
Get OrderStringId.
protected virtual string GetOrderStringId(string orderId)
Parameters
orderId
stringOrderStringId value.
Returns
- string
OrderStringId value.
GetOrderType(ExecutionReport, out OrderCondition)
Get order type.
protected virtual OrderTypes GetOrderType(ExecutionReport report, out OrderCondition condition)
Parameters
report
ExecutionReportExecution report.
condition
OrderConditionBase order condition (for example, for stop order algo orders).
Returns
- OrderTypes
Order type.
GetSecurityType(string)
Convert string to SecurityTypes value.
protected virtual SecurityTypes? GetSecurityType(string type)
Parameters
Returns
- SecurityTypes?
SecurityTypes value.
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.
GetSyntheticPortfolioName()
Get synthetic portfolio name for LoginAsPortfolioName mode.
protected string GetSyntheticPortfolioName()
Returns
- string
Portfolio code name.
InitSecId(SecurityMessage, string, string, string, string)
Init security id information.
protected virtual void InitSecId(SecurityMessage message, string symbol, string securityExchange, string idSource, string idValue)
Parameters
message
SecurityMessageA message containing info about the security.
symbol
stringSymbol.
securityExchange
stringSecurity exchange.
idSource
stringId source.
idValue
stringId value.
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.
IsLogoutError(string)
Check Logout contains error message.
protected virtual bool IsLogoutError(string text)
Parameters
text
stringText message.
Returns
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.
IsSyntheticPortfolioName(string)
Is the specified portfolio name generated by GetSyntheticPortfolioName().
protected bool IsSyntheticPortfolioName(string portfolioName)
Parameters
portfolioName
stringPortfolio code name.
Returns
- bool
Check result.
OnRead(IFixReader, string, Action<Message>)
Read next message from FIX protocol.
protected virtual bool? OnRead(IFixReader reader, string msgType, Action<Message> messageHandler)
Parameters
reader
IFixReaderThe reader of data recorded in the FIX protocol format.
msgType
stringMessage type.
messageHandler
Action<Message>Message handler.
Returns
- bool?
true, if the messages was read successfully, false to skip unknown message, null to break connection.
OnReset()
Reset state.
protected virtual void OnReset()
OnWrite(IFixWriter, Message)
Write the specified message into FIX protocol.
protected virtual string OnWrite(IFixWriter writer, Message message)
Parameters
writer
IFixWriterThe recorder of data in the FIX protocol format.
message
MessageThe message.
Returns
- string
FixMessages value.
Open()
Open channel.
public virtual void Open()
ProcessExecutionReport(ExecutionReport, Action<Message>, ExecutionMessage)
Process ExecutionReport instance.
protected virtual void ProcessExecutionReport(ExecutionReport report, Action<Message> messageHandler, ExecutionMessage message)
Parameters
report
ExecutionReportExecutionReport instance.
messageHandler
Action<Message>Message handler.
message
ExecutionMessageThe message contains information about the execution.
ProcessExecutionReport(ExecutionReport, Action<Message>, Action<ExecutionReport, Action<Message>, ExecutionMessage>)
Process ExecutionReport instance.
protected virtual void ProcessExecutionReport(ExecutionReport report, Action<Message> messageHandler, Action<ExecutionReport, Action<Message>, ExecutionMessage> processExecMsg)
Parameters
report
ExecutionReportExecutionReport instance.
messageHandler
Action<Message>Message handler.
processExecMsg
Action<ExecutionReport, Action<Message>, ExecutionMessage>Post handle an ExecutionMessage instance.
ProcessExecutionReportExtraTag(FixTags, IFixReader, ExecutionReport)
Process extra tags for ExecutionReport.
protected virtual bool ProcessExecutionReportExtraTag(FixTags tag, IFixReader reader, ExecutionReport report)
Parameters
tag
FixTagsTag.
reader
IFixReaderThe reader of data recorded in the FIX protocol format.
report
ExecutionReportExecution report.
Returns
- bool
Result.
ProcessParties(ExecutionReport)
Process Parties.
protected virtual void ProcessParties(ExecutionReport report)
Parameters
report
ExecutionReportExecution report.
ProcessSecurityDefinition(FixTags, IFixReader, SecurityMessage)
Process SecurityDefinition message.
protected virtual bool ProcessSecurityDefinition(FixTags tag, IFixReader reader, SecurityMessage message)
Parameters
tag
FixTagsTag.
reader
IFixReaderThe reader of data recorded in the FIX protocol format.
message
SecurityMessageA message containing info about the security.
Returns
- bool
Processing result.
ProcessSequenceResetExtraTag(FixTags, IFixReader, FixSeqResetMessage)
Process extra tags for FixSeqResetMessage.
protected virtual bool ProcessSequenceResetExtraTag(FixTags tag, IFixReader reader, FixSeqResetMessage message)
Parameters
tag
FixTagsTag.
reader
IFixReaderThe reader of data recorded in the FIX protocol format.
message
FixSeqResetMessageSequence reset message.
Returns
- bool
Result.
RaiseNewOutMessage(Message)
Raise NewOutMessage
protected void RaiseNewOutMessage(Message message)
Parameters
message
MessageMessage.
ReadExecutionReport(IFixReader, ExecutionReport, FastDateTimeParser, Func<FixTags, IFixReader, ExecutionReport, bool>)
Read the ExecutionReport message.
protected virtual bool? ReadExecutionReport(IFixReader reader, ExecutionReport report, FastDateTimeParser transactTimeParser, Func<FixTags, IFixReader, ExecutionReport, bool> extraTagProcess)
Parameters
reader
IFixReaderThe reader of data recorded in the FIX protocol format.
report
ExecutionReportExecutionReport instance.
transactTimeParser
FastDateTimeParserParser for TransactTime field.
extraTagProcess
Func<FixTags, IFixReader, ExecutionReport, bool>
Returns
- bool?
true, if the messages was read successfully, false to skip unknown message, null to break connection.
SendInMessage(Message)
Send message.
public virtual bool SendInMessage(Message message)
Parameters
message
MessageMessage.
Returns
ToString()
public override string ToString()
Returns
TryParseNextMsqSeqNum(string)
Try extract expected MsgSeqNum from the specified error message.
public virtual long? TryParseNextMsqSeqNum(string errorMessage)
Parameters
errorMessage
stringError message.
Returns
WriteAccount(IFixWriter, IPortfolioNameMessage)
Write Account value.
protected void WriteAccount(IFixWriter writer, IPortfolioNameMessage message)
Parameters
writer
IFixWriterWriter.
message
IPortfolioNameMessageMessage.
WriteClOrdId(IFixWriter, long)
Write ClOrdID.
protected void WriteClOrdId(IFixWriter writer, long transactionId)
Parameters
writer
IFixWriterWriter.
transactionId
longTransaction ID.
WriteLogonRequest(IFixWriter, ConnectMessage, Action<IFixWriter>)
To record the Logon message (request).
protected string WriteLogonRequest(IFixWriter writer, ConnectMessage message, Action<IFixWriter> extra = null)
Parameters
writer
IFixWriterThe recorder of data in the FIX protocol format.
message
ConnectMessageextra
Action<IFixWriter>Write extra parameters for Logon message.
Returns
- string
FixMessages value.
WriteLogoutRequest(IFixWriter, string)
To record the Logout message (request).
protected static string WriteLogoutRequest(IFixWriter writer, string text = null)
Parameters
writer
IFixWriterThe recorder of data in the FIX protocol format.
text
stringThe text of reason.
Returns
- string
FixMessages value.
WriteResendRequest(IFixWriter, long, long)
To record the ResendRequest message.
protected static string WriteResendRequest(IFixWriter writer, long beginSeqNo, long endSeqNo)
Parameters
writer
IFixWriterThe recorder of data in the FIX protocol format.
beginSeqNo
longThe original message identifier.
endSeqNo
longThe last message identifier.
Returns
- string
FixMessages value.
WriteSequenceReset(IFixWriter, bool, long)
To record the SequenceReset message (request).
protected string WriteSequenceReset(IFixWriter writer, bool gapFill, long newSeqNo)
Parameters
writer
IFixWriterThe recorder of data in the FIX protocol format.
gapFill
boolGap fill.
newSeqNo
longNew sequence number.
Returns
- string
FixMessages value.
WriteTimeMessage(IFixWriter, TimeMessage)
To record the Heartbeat or TestRequest message.
protected static string WriteTimeMessage(IFixWriter writer, TimeMessage timeMsg)
Parameters
writer
IFixWriterThe recorder of data in the FIX protocol format.
timeMsg
TimeMessageHeartbeat message.
Returns
- string
FixMessages value.
WriteUserRequestChangePassword(IFixWriter, ChangePasswordMessage, string, string)
To record the UserRequest message.
protected string WriteUserRequestChangePassword(IFixWriter writer, ChangePasswordMessage message, string userName = null, string password = null)
Parameters
writer
IFixWriterThe recorder of data in the FIX protocol format.
message
ChangePasswordMessagePassword change message.
userName
stringCurrent user name.
password
stringCurrent password.
Returns
- string
FixMessages value.