MatchingEngineAdapter

StockSharp.MatchingEngine

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

MatchingEngineAdapter
public MatchingEngineAdapter()
matchingEngineAdapter = MatchingEngineAdapter()

Initializes a new instance.

Properties

OrderIdGenerator
public IncrementalIdGenerator OrderIdGenerator { get; set; }
value = matchingEngineAdapter.OrderIdGenerator
matchingEngineAdapter.OrderIdGenerator = value

Order ID generator.

PortfolioManager
public IPortfolioManager PortfolioManager { get; set; }
value = matchingEngineAdapter.PortfolioManager
matchingEngineAdapter.PortfolioManager = value

Portfolio manager for handling portfolio state.

Settings
public MatchingEngineSettings Settings { get; }
value = matchingEngineAdapter.Settings

Matching engine settings.

StopOrderManager
public IStopOrderManager StopOrderManager { get; }
value = matchingEngineAdapter.StopOrderManager

Stop order manager (read-only access).

TradeIdGenerator
public IncrementalIdGenerator TradeIdGenerator { get; set; }
value = matchingEngineAdapter.TradeIdGenerator
matchingEngineAdapter.TradeIdGenerator = value

Trade ID generator.

TransactionIdGenerator
public IdGenerator TransactionIdGenerator { get; set; }
value = matchingEngineAdapter.TransactionIdGenerator
matchingEngineAdapter.TransactionIdGenerator = value

Transaction id generator for internal use (group cancel, close positions).

Methods

CheckLimitOrders
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.

CheckStopOrders
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.

GetSecurityState
public SecurityState GetSecurityState(SecurityId securityId)
result = matchingEngineAdapter.GetSecurityState(securityId)

Get or create security state for the given security.

ProcessMessage
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).

ProcessOrderCancel
public void ProcessOrderCancel(OrderCancelMessage cancelMsg, List<Message> results)
matchingEngineAdapter.ProcessOrderCancel(cancelMsg, results)

Process order cancellation.

ProcessOrderRegister
public void ProcessOrderRegister(OrderRegisterMessage regMsg, List<Message> results)
matchingEngineAdapter.ProcessOrderRegister(regMsg, results)

Process order registration.

SendOutMessageAsync
public ValueTask SendOutMessageAsync(Message message, CancellationToken cancellationToken)
result = matchingEngineAdapter.SendOutMessageAsync(message, cancellationToken)

Send out message.

Events

NewOutMessageAsync
public event Func<Message, CancellationToken, ValueTask> NewOutMessageAsync
matchingEngineAdapter.NewOutMessageAsync += handler

New message event.