HistoryEmulationConnector, NewTrade
Здравствуйте!
Скажите. пожалуйста, почему не срабатывает событие NewTrade(не попадает в обработчик), что делаю не так? (4.4.13 API)
(Newsecurity срабатывает как нужно)
using System;
using Ecng.Common;
using StockSharp.Algo.Storages;
using StockSharp.Algo.Testing;
using StockSharp.BusinessEntities;
namespace ConsoleApp1
{
class Program
{
private static HistoryEmulationConnector connector;
static void Main(string[] args)
{
var storageRegistry = new StorageRegistry { DefaultDrive = new LocalMarketDataDrive(@"D:\StockSharp\Storage\".ToFullPath()) };
var security = new Security { Id = "XBTUSD@BMEX", Code = "XBTUSD", Board = ExchangeBoard.Bitmex };
var portfolio = new Portfolio { Name = "test account", BeginValue = 1000000 };
connector = new HistoryEmulationConnector( new[] { security }, new[] { portfolio })
{
HistoryMessageAdapter =
{
StorageRegistry = storageRegistry,
StartDate = new DateTimeOffset(2017, 1, 1, 0, 0, 0, TimeSpan.FromMinutes(0)),
StopDate = new DateTimeOffset(2018, 2, 1, 0, 0, 0, TimeSpan.FromMinutes(0))
},
};
connector.NewSecurity += Connector_NewSecurity;
connector.NewTrade += Connector_NewTrade;
connector.Connect();
Console.ReadKey();
}
private static void Connector_NewSecurity(Security security)
{
if (security.Code == "XBTUSD")
{
connector.RegisterTrades(security);
connector.Start();
};
}
private static void Connector_NewTrade(Trade trade)
{
trade = trade;
}
}
}