MatchingEngineAdapter
Message-based matching engine adapter. Contains pure matching logic without emulation (no random, no candle matching, no commissions). Implements IMessageTransport for message-based integration.
Implements: IMessageTransport
Constructors
public MatchingEngineAdapter()
matchingEngineAdapter = MatchingEngineAdapter()
Initializes a new instance.
Properties
public IncrementalIdGenerator OrderIdGenerator { get; set; }
value = matchingEngineAdapter.OrderIdGenerator
matchingEngineAdapter.OrderIdGenerator = value
Order ID generator.
public IPortfolioManager PortfolioManager { get; set; }
value = matchingEngineAdapter.PortfolioManager
matchingEngineAdapter.PortfolioManager = value
Portfolio manager for handling portfolio state.
public MatchingEngineSettings Settings { get; }
value = matchingEngineAdapter.Settings
Matching engine settings.
public IStopOrderManager StopOrderManager { get; }
value = matchingEngineAdapter.StopOrderManager
Stop order manager (read-only access).
public IncrementalIdGenerator TradeIdGenerator { get; set; }
value = matchingEngineAdapter.TradeIdGenerator
matchingEngineAdapter.TradeIdGenerator = value
Trade ID generator.
public IdGenerator TransactionIdGenerator { get; set; }
value = matchingEngineAdapter.TransactionIdGenerator
matchingEngineAdapter.TransactionIdGenerator = value
Transaction id generator for internal use (group cancel, close positions).
Methods
public void CheckLimitOrders(SecurityId securityId, decimal? tradePrice, DateTime time, List<Message> results)
matchingEngineAdapter.CheckLimitOrders(securityId, tradePrice, time, results)
Re-evaluate resting limit orders against the current order book and execute the ones the market has moved through. Unlike stop orders, limit orders are otherwise matched only at registration time, so a tick/quote trading through a resting limit would leave it sitting in the book and later fill at a price the market has left behind.
public void CheckStopOrders(SecurityId securityId, decimal price, DateTime time, List<Message> results)
matchingEngineAdapter.CheckStopOrders(securityId, price, time, results)
Check stop orders against a price and process triggered orders.
public SecurityState GetSecurityState(SecurityId securityId)
result = matchingEngineAdapter.GetSecurityState(securityId)
Get or create security state for the given security.
public void ProcessMessage(Message message, List<Message> results)
matchingEngineAdapter.ProcessMessage(message, results)
Process a message and collect results. Can be called directly (without async dispatch).
public void ProcessOrderCancel(OrderCancelMessage cancelMsg, List<Message> results)
matchingEngineAdapter.ProcessOrderCancel(cancelMsg, results)
Process order cancellation.
public void ProcessOrderRegister(OrderRegisterMessage regMsg, List<Message> results)
matchingEngineAdapter.ProcessOrderRegister(regMsg, results)
Process order registration.
public ValueTask SendOutMessageAsync(Message message, CancellationToken cancellationToken)
result = matchingEngineAdapter.SendOutMessageAsync(message, cancellationToken)
Send out message.
Events
public event Func<Message, CancellationToken, ValueTask> NewOutMessageAsync
matchingEngineAdapter.NewOutMessageAsync += handler
New message event.