ClientOrderIdRegistry
Tracks live client order IDs within a session.
Properties
public int Count { get; }
value = clientOrderIdRegistry.Count
How many client order ids are claimed right now.
Methods
public static InvalidOperationException CreateRefusal(string clientOrderId)
result = ClientOrderIdRegistry.CreateRefusal(clientOrderId)
Builds the error used to refuse a re-used client order id.
- clientOrderId
- The id the client re-used.
Returns: The error to fail the offending command with.
public bool HoldsTransaction(string login, long transactionId)
result = clientOrderIdRegistry.HoldsTransaction(login, transactionId)
Whether a live order of the client travels under this transaction.
- login
- The client the transaction belongs to.
- transactionId
- The transaction.
Returns: when an id is claimed for it.
public bool IsClaimed(string login, string clientOrderId)
result = clientOrderIdRegistry.IsClaimed(login, clientOrderId)
Whether the client already has a live order under this id.
- login
- The client the id belongs to.
- clientOrderId
- The id the client gave the order.
Returns: when a live order holds it.
public void Release(string login, long transactionId)
clientOrderIdRegistry.Release(login, transactionId)
Frees the id an order held, once that order has ended.
- login
- The client the order belongs to.
- transactionId
- The transaction the order travelled under.
public bool TryClaim(string login, string clientOrderId, long transactionId, long? orderId)
result = clientOrderIdRegistry.TryClaim(login, clientOrderId, transactionId, orderId)
Claims a client order id for an order that is being opened.
- login
- The client the id belongs to.
- clientOrderId
- The id the client gave the order.
- transactionId
- The transaction the order travels under, which later frees the id.
- orderId
- The id the order is written down under, or when it names none.
Returns: when the id was free or is held by this very order; when another live order of the client holds it.
public bool TryGetTransaction(string login, string clientOrderId, long transactionId)
result = clientOrderIdRegistry.TryGetTransaction(login, clientOrderId, transactionId)
Reads the transaction of the live order the client holds under this id.
- login
- The client the id belongs to.
- clientOrderId
- The id the client gave the order.
- transactionId
- The transaction the order travels under.
Returns: when a live order of that client holds the id.
public bool TrySeed(string login, string clientOrderId, long transactionId)
result = clientOrderIdRegistry.TrySeed(login, clientOrderId, transactionId)
Claims a client order id for an order that was already live before this process knew of it, as replayed from the upstream order book.
- login
- The client the id belongs to.
- clientOrderId
- The id the client gave the order.
- transactionId
- The transaction the order travels under, which later frees the id.
Returns: when the id is claimed for this order; when some other order already holds it.