FixServer
FIX server.
Inherits: BaseProtocolServer<ClientFixSession, FixServerSubscription, FixServerSettings>
Constructors
public FixServer(IAuthorization authorization, ITransactionIdStorage transactionIdStorage, string licenseFeatureId, Type componentType)
fixServer = FixServer(authorization, transactionIdStorage, licenseFeatureId, componentType)
Initializes a new instance of the FixServer.
- authorization
- The customer authentication.
- transactionIdStorage
- Transaction and request identifiers storage.
- licenseFeatureId
- LicenseFeatureId
- componentType
- ComponentTimestamp
public FixServer(IAuthorization authorization, ITransactionIdStorage transactionIdStorage, string licenseFeatureId, DateTime componentTimestamp, IMessageConverter converter)
fixServer = FixServer(authorization, transactionIdStorage, licenseFeatureId, componentTimestamp, converter)
Initializes a new instance of the FixServer.
- authorization
- The customer authentication.
- transactionIdStorage
- Transaction and request identifiers storage.
- licenseFeatureId
- LicenseFeatureId
- componentTimestamp
- ComponentTimestamp
- converter
- Message converter.
Properties
public IAuthorization Authorization { get; }
value = fixServer.Authorization
The customer authentication.
public DateTime ComponentTimestamp { get; }
value = fixServer.ComponentTimestamp
Component timestamp.
public IMessageConverter Converter { get; }
value = fixServer.Converter
Message converter for FIX ↔ StockSharp message conversion.
public string LicenseFeatureId { get; }
value = fixServer.LicenseFeatureId
License feature id to be sent as Logon response.
public bool SendOutHeartbeats { get; set; }
value = fixServer.SendOutHeartbeats
fixServer.SendOutHeartbeats = value
Send heartbeat via outgoing messages channel.
public ITransactionIdStorage TransactionIdStorage { get; }
value = fixServer.TransactionIdStorage
Methods
protected virtual OrderCondition CreateCondition()
result = fixServer.CreateCondition()
To create the order condition.
Returns: The order condition.
protected override FixServerSubscription CreateSubscription(ClientFixSession session, string requestId, ServerSubscription subscription, MessageTypes type)
result = fixServer.CreateSubscription(session, requestId, subscription, type)
private long CreateTransactionId(ClientFixSession session, string requestId)
result = fixServer.CreateTransactionId(session, requestId)
Generate a new request identifier.
- session
- Session.
- requestId
- Request identifier.
Returns: Transaction ID.
protected override string GetSessionKey(ClientFixSession session)
result = fixServer.GetSessionKey(session)
protected override bool IsStubSubscription(FixServerSubscription subscription)
result = fixServer.IsStubSubscription(subscription)
public override void Load(SettingsStorage storage)
fixServer.Load(storage)
Loads the state of the object from the specified SettingsStorage.
- storage
- The SettingsStorage instance from which to load the data.
protected override void OnClearListenerState()
fixServer.OnClearListenerState()
Clear protocol-specific listener state (stop listeners, etc.).
protected virtual IAsyncEnumerable<Message> OnProcess(FixSession session, string msgType, IFixReader reader, CancellationToken cancellationToken)
result = fixServer.OnProcess(session, msgType, reader, cancellationToken)
The method is called when the received message is processing.
protected override void OnStartListeners(CancellationToken cancellationToken)
fixServer.OnStartListeners(cancellationToken)
Start protocol-specific listeners (TCP, etc.). Add tasks to _backgroundTasks.
protected virtual void PostInitCondition(char ordType, OrderCondition condition)
fixServer.PostInitCondition(ordType, condition)
The final initialization of the order condition.
- ordType
- Order type.
- condition
- The order condition.
protected override void ProcessInMessage(Message message, CancellationToken cancellationToken)
fixServer.ProcessInMessage(message, cancellationToken)
Process an incoming message and route to subscribed clients.
protected override void ProcessLogout(ClientFixSession session)
fixServer.ProcessLogout(session)
protected virtual ValueTask<bool> ReadOrderConditionAsync(IFixServerSerializer serializer, FixTags tag, Func<OrderCondition> getCondition, CancellationToken cancellationToken)
result = fixServer.ReadOrderConditionAsync(serializer, tag, getCondition, cancellationToken)
To read the order condition OrderCondition.
- serializer
- IFixServerSerializer
- tag
- Tag.
- getCondition
- The function returning the order condition.
- cancellationToken
- CancellationToken
Returns: Whether the data was successfully processed.
public override void Save(SettingsStorage storage)
fixServer.Save(storage)
Saves the entity's state to the specified settings storage.
protected override void ScheduleSessionWork(ClientFixSession session, ServerSubscription subscription, string requestId, Func<ClientFixSession, string, CancellationToken, ValueTask<bool>> handler)
fixServer.ScheduleSessionWork(session, subscription, requestId, handler)
private static string TryGetRequestId(ClientFixSession session, long transactionId)
result = FixServer.TryGetRequestId(session, transactionId)
Get the request identifier.
- session
- The session.
- transactionId
- Transaction ID.
Returns: Request identifier.
internal static bool TryResolveTransactionId(ISessionTransactionIdStorage storage, string requestId, long transactionId)
result = FixServer.TryResolveTransactionId(storage, requestId, transactionId)
Resolve a client request id to a server transaction id.
- storage
- The session transaction id storage.
- requestId
- The request identifier.
- transactionId
- The resolved transaction ID.
Returns: if the transaction ID was resolved; otherwise, .
protected virtual ValueTask WriterFixOrderConditionAsync(IFixServerSerializer serializer, OrderCondition condition, CancellationToken cancellationToken)
result = fixServer.WriterFixOrderConditionAsync(serializer, condition, cancellationToken)
To record data by the order condition (async version).
- serializer
- IFixServerSerializer
- condition
- Order condition (e.g., stop- and algo- orders parameters).
- cancellationToken
- Cancellation token.