MatchingEngineAdapter

StockSharp.MatchingEngine

メッセージベースのマッチングエンジンアダプタ。エミュレーションなしで純粋なマッチングロジックが含まれています(ランダム、キャンドルマッチングなし、手数料なし)。IMessageTransportを実装して、メッセージベースの統合を実現します。

実装: IMessageTransport

コンストラクター

MatchingEngineAdapter
public MatchingEngineAdapter()
matchingEngineAdapter = MatchingEngineAdapter()

新規インスタンスを初期化します。

プロパティ

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

注文IDジェネレータ。

PortfolioManager
public virtual EmulatedPortfolioManager PortfolioManager { get; }
value = matchingEngineAdapter.PortfolioManager

ポートフォリオのステータスを処理するポートフォリオマネージャー。

Securities
public IEnumerable<SecurityMessage> Securities { get; }
value = matchingEngineAdapter.Securities

Every security the venue has stated a definition for.

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

エンジンの設定を一致させる。

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

注文マネージャーの停止(読み取り専用アクセス)。

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

トレードIDジェネレーター。

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

内部使用(グループキャンセル、クローズポジション)のトランザクションIDジェネレータ。

メソッド

AddPositionRevaluations
public void AddPositionRevaluations(DateTime time, List<Message> results)
matchingEngineAdapter.AddPositionRevaluations(time, results)

Report again every open position whose floating profit the market has moved since it was last reported.

time
Time of the move.
results
Messages to add the reports to.
AdoptActiveOrder
private void AdoptActiveOrder(ExecutionMessage execMsg, Sides side, List<Message> results)
matchingEngineAdapter.AdoptActiveOrder(execMsg, side, results)

Takes an order that is already standing somewhere else into this book, exactly as it is.

CheckStopOrders
public void CheckStopOrders(SecurityId securityId, decimal price, DateTime time, List<Message> results)
matchingEngineAdapter.CheckStopOrders(securityId, price, time, results)

注文を価格とプロセスのトリガーされた注文に対して停止チェックします。

CreatePortfolioUpdate
public static PositionChangeMessage CreatePortfolioUpdate(EmulatedPortfolio portfolio, DateTime time)
result = MatchingEngineAdapter.CreatePortfolioUpdate(portfolio, time)

The money row stating what an account holds: its realized and unrealized result, what its working orders hold, and what it can trade with now.

portfolio
The account the row is about.
time
Time to stamp the row with.

戻り値: The row.

CreatePositionUpdate
public PositionChangeMessage CreatePositionUpdate(EmulatedPortfolio portfolio, SecurityId securityId, DateTime serverTime, DateTime localTime)
result = matchingEngineAdapter.CreatePositionUpdate(portfolio, securityId, serverTime, localTime)

Create the message that reports one position of an account: its size, entry price and floating profit.

portfolio
The account.
securityId
Security ID.
serverTime
Server time.
localTime
Local time.

戻り値: The position update.

CreateStopInfo
private StopOrderInfo CreateStopInfo(OrderRegisterMessage regMsg, string error)
result = matchingEngineAdapter.CreateStopInfo(regMsg, error)

Reads the stop the registration's condition describes, or when it describes none and the order is an ordinary one.

regMsg
Registration to read.
error
Why the condition describes a stop that cannot be placed, or when it describes one that can, or none at all.

戻り値: The stop to rest, or .

EmitRegistrationResult
public void EmitRegistrationResult(OrderRegisterMessage regMsg, EmulatorOrder order, MatchResult matchResult, ExecutionMessage replyMsg, Func<ExecutionMessage, decimal?> chargeCommission, List<Message> results)
matchingEngineAdapter.EmitRegistrationResult(regMsg, order, matchResult, replyMsg, chargeCommission, results)

Turn a match into the messages it owes: the order rows, the trades, the maker side of each fill, the positions and the portfolio updates.

regMsg
The registration this is answering.
order
The order as the matcher saw it.
matchResult
What the matcher decided.
replyMsg
The acceptance row already published, mutated when the order ends here.
chargeCommission
Prices a trade before the position is booked from it, or null.
results
Where the messages go.
ForgetBook
public void ForgetBook(SecurityId securityId)
matchingEngineAdapter.ForgetBook(securityId)

Forgets the book stated so far for , so an incremental feed has to state a whole one again before its increments are folded in. Used when a venue has gone quiet on depth: what it sends after the break describes a market its old base no longer holds.

securityId
Security whose stated book is forgotten.
GetChargedPrice
private static decimal? GetChargedPrice(OrderRegisterMessage regMsg, SecurityState state)
result = MatchingEngineAdapter.GetChargedPrice(regMsg, state)

Price the order will be charged at: its own price when it names one, the opposite best for a market order.

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

特定の金融商品取引業者の財務機器の状態を取得または作成します。

NameAccountOn
private static void NameAccountOn(List<Message> results, int from, OrderRegisterMessage regMsg)
MatchingEngineAdapter.NameAccountOn(results, from, regMsg)

States the account and the instrument on each transactional row from onwards that is missing them.

ProcessMessage
public void ProcessMessage(Message message, List<Message> results)
matchingEngineAdapter.ProcessMessage(message, results)

メッセージの処理と結果を収集します。直接(非同期ディスパッチなし)と呼ぶことができます。

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

プロセスオーダーのキャンセル。

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

プロセス注文登録。

ProcessTime
public void ProcessTime(DateTime time, List<Message> results)
matchingEngineAdapter.ProcessTime(time, results)

Retire orders whose expiry has been reached and release the reservation held by their balance.

time
Current engine time.
results
Where generated lifecycle and portfolio messages are added.
ResolveActivationPercent
private static decimal ResolveActivationPercent(decimal marketPrice, decimal percent, Sides side, bool invertTrigger)
result = MatchingEngineAdapter.ResolveActivationPercent(marketPrice, percent, side, invertTrigger)

The level a stop rests at when its activation price states a distance from the market rather than a price of its own: that far above the market for one that fires on a rise, that far below it for one that fires on a fall.

marketPrice
Price the instrument is at.
percent
Distance from it, in percent.
side
Order side.
invertTrigger
Whether the stop fires on the opposite move, as a take-profit does.

戻り値: The absolute level.

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

送信する

TryGetLastTradePrice
private decimal? TryGetLastTradePrice(SecurityId securityId)
result = matchingEngineAdapter.TryGetLastTradePrice(securityId)

The price the instrument last traded at, as far as this engine has been told.

securityId
Instrument to read.

戻り値: The price, or when the venue has stated none.

ValidateRegistration
public InvalidOperationException ValidateRegistration(OrderRegisterMessage regMsg, decimal? chargedPrice)
result = matchingEngineAdapter.ValidateRegistration(regMsg, chargedPrice)

Check whether the registration is allowed: the instrument is trading, there is a market to price the order at, and the account can afford it.

regMsg
Registration to check.
chargedPrice
Price the order will actually be charged at, or when the book offers none.

戻り値: The reason the registration must be refused, or when it is allowed.

イベント

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

新規メッセージイベント