MarketEmulator
モジュラーアーキテクチャーで市場エミュレータv2. ラップMatchingEngineAdapterとエミュレーション固有のロジックを追加します。 (ランダムボリューム、ティック/L1→オーダーブック変換、キャンドルマッチング、手数料、価格制限).
継承元: BaseLogReceiver
実装: IMarketEmulator, IMessageTransport, ILogSource, IDisposable
コンストラクター
public MarketEmulator(ISecurityProvider securityProvider, IPortfolioProvider portfolioProvider, IExchangeInfoProvider exchangeInfoProvider, IdGenerator transactionIdGenerator)
marketEmulator = MarketEmulator(securityProvider, portfolioProvider, exchangeInfoProvider, transactionIdGenerator)
新規インスタンスを初期化します。
プロパティ
public override DateTime CurrentTime { get; }
value = marketEmulator.CurrentTime
現在のUTCの時間。
public IExchangeInfoProvider ExchangeInfoProvider { get; }
value = marketEmulator.ExchangeInfoProvider
取引所および取引銀行のプロバイダ。
public IncrementalIdGenerator OrderIdGenerator { get; set; }
value = marketEmulator.OrderIdGenerator
marketEmulator.OrderIdGenerator = value
注文IDジェネレータ。
public EmulatedPortfolioManager PortfolioManager { get; }
value = marketEmulator.PortfolioManager
ポートフォリオのステータスを処理するポートフォリオマネージャー。
public IPortfolioProvider PortfolioProvider { get; }
value = marketEmulator.PortfolioProvider
注文を登録するために使用されるポートフォリオ。値が与えられていない場合は、デフォルト名で生成されるポートフォリオが作成されます。
public IEnumerable<MessageTypeInfo> PossibleSupportedMessages { get; }
value = marketEmulator.PossibleSupportedMessages
対応可能なメッセージタイプ。
public long ProcessedMessageCount { get; private set; }
value = marketEmulator.ProcessedMessageCount
marketEmulator.ProcessedMessageCount = value
処理されたメッセージ数。
public IEmulationRandomizer RandomProvider { get; set; }
value = marketEmulator.RandomProvider
marketEmulator.RandomProvider = value
Where anything in the strategy that draws at random takes its draws from.
public ISecurityProvider SecurityProvider { get; }
value = marketEmulator.SecurityProvider
機器に関する情報提供者
public IncrementalIdGenerator TradeIdGenerator { get; set; }
value = marketEmulator.TradeIdGenerator
marketEmulator.TradeIdGenerator = value
トレードIDジェネレーター。
public IdGenerator TransactionIdGenerator { get; }
value = marketEmulator.TransactionIdGenerator
トランザクションIDジェネレータ。
public bool VerifyMode { get; set; }
value = marketEmulator.VerifyMode
marketEmulator.VerifyMode = value
延長検証モード。
メソッド
private ValueTask ApplyCommissionsAsync(List<Message> messages, CancellationToken cancellationToken)
result = marketEmulator.ApplyCommissionsAsync(messages, cancellationToken)
Price every trade in this batch. Called once, where the batch leaves the emulator.
private void CheckLimitOrders(SecurityId securityId, decimal? tradePrice, DateTime time, List<Message> results)
marketEmulator.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 SecurityState GetSecurityState(SecurityId securityId)
result = marketEmulator.GetSecurityState(securityId)
State the emulation keeps for one security: its book, its orders and its definition.
- securityId
- Security to read.
戻り値: The state.
private void ReleaseStoredCandles(DateTime time, List<Message> results)
marketEmulator.ReleaseStoredCandles(time, results)
Hand over every bar still held whose close falls no later than , each at its own close and in order.
private void ReplayCandle(SecurityId securityId, SecurityEmulator emulator, CandleMessage candle, DateTime time, List<Message> results)
marketEmulator.ReplayCandle(securityId, emulator, candle, time, results)
Replay a closed candle as the prices it recorded, in the order it recorded them.
public ValueTask SendOutMessageAsync(Message message, CancellationToken cancellationToken)
result = marketEmulator.SendOutMessageAsync(message, cancellationToken)
送信する
イベント
public event Func<Message, CancellationToken, ValueTask> NewOutMessageAsync
marketEmulator.NewOutMessageAsync += handler
新規メッセージイベント