Extended settings
Extended settings of HistoryEmulationConnector.
- MarketTimeChangedInterval - time change event input interval. If trades generators are used, then the trades will be generated with this periodicity. The default is 1 minute.
- MarketEmulatorSettings.Latency - 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.
- MarketEmulatorSettings.MatchOnTouch - 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:
_connector.SubscribeTrades(security);
If the strategy needs the order books, it is necessary to subscribe to the order books:
_connector.SubscribeMarketDepth(security);
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));
_connector.MarketDataAdapter.SendInMessage(new GeneratorMessage
{
IsSubscribe = true,
Generator = mdGenerator
});
The order book update interval MarketDataGenerator.Interval. 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);
The order books depth MarketDepthGenerator.MaxBidsDepth and MarketDepthGenerator.MaxAsksDepth. The more - the slower testing:
mdGenerator.MaxAsksDepth = 1; mdGenerator.MaxBidsDepth = 1;
Volumes of MarketDepth.BestBid and MarketDepth.BestAsk are taken from the volume of the trade on which there is generation. The MarketDepthGenerator.UseTradeVolume option sets realistic volume level in the order book:
mdGenerator.UseTradeVolume = true;
The volume level MarketDataGenerator.MinVolume and MarketDataGenerator.MaxVolume:
mdGenerator.MinVolume = 1; mdGenerator.MaxVolume = 1;
The minimum generated spread is equal to Security.PriceStep. It should not generate spread between MarketDepth.BestBid and MarketDepth.BestAsk more than 5 Security.PriceStep (so do not get too wide spread while the generation from candles is performed):
mdGenerator.MinSpreadStepCount = 1; mdGenerator.MaxSpreadStepCount = 5;