Extended settings of HistoryEmulationConnector.
EmulationSettingsMarketTimeChangedInterval - time change event input interval. If trades generators are used, then the trades will be generated with this periodicity. The default is 1 minute.
MarketEmulatorSettingsLatency - The minimum value of the registered orders latency. By default, it is equal to TimeSpan.Zero, which means instant acceptance of the registered orders by the exchange.
MarketEmulatorSettingsMatchOnTouch - to execute the orders if the price "touches" the level (an assumption is sometimes too "optimistic" and the mode must be switched off for a realistic testing). If the mode is off, then limit orders will be executed if the price is "passed through them" at least in 1 step. The option is available in all modes except the order log. The default is off.
Even if the strategy is tested on the candles, it is necessary to subscribe to the tick trades:
If the strategy needs the order books, it is necessary to subscribe to the order books:
If there are no order books, then to check the working ability of strategies that need order books, it is possible to enable the generation:
var mdGenerator = new TrendMarketDepthGenerator(connector.GetSecurityId(security)); trader.RegisterMarketDepth(mdGenerator);
The order book update interval MarketDataGeneratorInterval. The update can not be more often than tick trades come (because the order books are generated before each trade):
mdGenerator.Interval = TimeSpan.FromSeconds(1);
mdGenerator.MaxAsksDepth = 1; mdGenerator.MaxBidsDepth = 1;
Volumes of MarketDepthBestBid and MarketDepthBestAsk are taken from the volume of the trade on which there is generation. The MarketDepthGeneratorUseTradeVolume option sets realistic volume level in the order book:
mdGenerator.UseTradeVolume = true;
mdGenerator.MinVolume = 1; mdGenerator.MaxVolume = 1;
The minimum generated spread is equal to SecurityPriceStep. It should not generate spread between MarketDepthBestBid and MarketDepthBestAsk more than 5 SecurityPriceStep (so do not get too wide spread while the generation from candles is performed):
mdGenerator.MinSpreadStepCount = 1; mdGenerator.MaxSpreadStepCount = 5;