Новая заявка не попадает в Startegy.ActiveOrders после ReRegisterOrder в случае когда перерегистрируемая заявка была OrderTypes.Conditional, а новая заявка OrderTypes.Limit.
добавил в SampleSma след. код:
private void ProcessCandle(Candle candle)
{
if (ProcessState == ProcessStates.Stopping)
{
CancelActiveOrders();
return;
}
var stopOrder = CreateStopLimit();
this.AddInfoLog("ActiveOrders (Count={0}): {1}", ActiveOrders.Count(), ActiveOrders.Aggregate("", (current, o) => current + ", " + o.Id));
stopOrder.WhenRegistered().Do(oldOrder => {
var newOrder = oldOrder.Clone();
newOrder.Type = OrderTypes.Limit;
newOrder.Price = newOrder.Direction == OrderDirections.Buy ? Security.GetCurrentPrice().Value - 200 : Security.GetCurrentPrice().Value + 200;
newOrder.WhenRegistered().Do(OrderRegistered).Apply(this);
ReRegisterOrder(oldOrder, newOrder);
}).Apply(this);
stopOrder.WhenRegistered().Do(OrderRegistered).Apply(this);
RegisterOrder(stopOrder);
}
private Order CreateStopLimit() {
return new Order {
Type = OrderTypes.Conditional,
//Type = OrderTypes.Limit,
Volume = 1,
Price = Security.GetCurrentPrice().Value + 100,
//Price = Security.GetCurrentPrice().Value - 200,
Security = Security,
Direction = OrderDirections.Buy,
StopCondition = new QuikStopCondition {
Type = QuikStopConditionTypes.StopLimit,
StopPrice = Security.GetCurrentPrice().Value - 250,
},
};
}
private void OrderRegistered(Order order) {
this.AddInfoLog("Заявка {0} зарегистрирована Id={1}", order.Type, order.Id);
}
Лог:
16:06:42.843 | | SS_RIU2@RTS_SPBFUT010Lt | ActiveOrders (Count=0): 16:06:43.453 | | SS_RIU2@RTS_SPBFUT010Lt | Заявка Conditional зарегистрирована Id=148380 16:06:44.125 | | SS_RIU2@RTS_SPBFUT010Lt | Заявка Limit зарегистрирована Id=1774649150 16:07:25.734 | | SS_RIU2@RTS_SPBFUT010Lt | ActiveOrders (Count=0): 16:07:26.375 | | SS_RIU2@RTS_SPBFUT010Lt | Заявка Conditional зарегистрирована Id=148382 16:07:26.671 | | SS_RIU2@RTS_SPBFUT010Lt | Заявка Limit зарегистрирована Id=1774652285
Если обе заявки типа Limit, то все корректно. Измененный SampleSma, где ошибка повторяется во вложении.
Comentarios (4)
Iniciar sesión o Crear cuenta, Inicie sesión o regístrese para dejar un comentario
Дополнение: в Strategy.Orders тоже не попадает
Такого свойства нет.
Исправляюсь: не попадает в свойство Startegy.ActiveOrders Поправлено в первом посте
Проверьте на последней версии из codeplex.