/// <summary> /// /// </summary> protected override string OnSubmit(ISourceOrderExecution provider, OrderTypeEnum orderType, int volume, decimal?price, decimal?slippage, decimal?takeProfit, decimal?stopLoss, out string operationResultMessage) { SystemMonitor.CheckError(provider.SupportsActiveOrderManagement, "Wrong position type for this provider."); IQuoteProvider quotes = _manager.ObtainQuoteProvider(_dataDelivery.SourceId, Symbol); ActiveOrder order = new ActiveOrder(_manager, provider, quotes, _dataDelivery.SourceId, Symbol, true); price = ProcessPrice(quotes, orderType, price); string id = provider.SubmitOrder(provider.DefaultAccount.Info, order, _info.Symbol, orderType, volume, slippage, price, takeProfit, stopLoss, string.Empty, out operationResultMessage); if (string.IsNullOrEmpty(id)) { return(string.Empty); } OrderInfo info = new OrderInfo(id, Symbol, orderType, OrderStateEnum.Submitted, volume, price, null, null, null, null, null, null, null, null, null, null, string.Empty, null); order.AdoptInfo(info); provider.TradeEntities.AddOrder(order); return(id); }
/// <summary> /// /// </summary> protected override string OnSubmit(ISourceOrderExecution provider, OrderTypeEnum orderType, int volume, decimal?price, decimal?slippage, decimal?takeProfit, decimal?stopLoss, out string operationResultMessage) { PassiveOrder order = new PassiveOrder(_manager, _dataDelivery.SourceId, provider.SourceId); string id = provider.SubmitOrder(provider.DefaultAccount.Info, order, _info.Symbol, orderType, volume, slippage, price, takeProfit, stopLoss, string.Empty, out operationResultMessage); if (string.IsNullOrEmpty(id)) { return(string.Empty); } if (order.Info.State != OrderStateEnum.Executed) {// It is possible that the submit executes the order instantly, so make sure this is not the case. OrderInfo info = new OrderInfo(id, Symbol, orderType, OrderStateEnum.Submitted, volume, price, null, null, null, null, null, null, null, null, null, null, string.Empty, null); order.AdoptInfo(info); } provider.TradeEntities.AddOrder(order); return(id); }
/// <summary> /// /// </summary> protected override string OnSubmit(ISourceOrderExecution provider, OrderTypeEnum orderType, int volume, decimal? price, decimal? slippage, decimal? takeProfit, decimal? stopLoss, out string operationResultMessage) { SystemMonitor.CheckError(provider.SupportsActiveOrderManagement, "Wrong position type for this provider."); IQuoteProvider quotes = _manager.ObtainQuoteProvider(_dataDelivery.SourceId, Symbol); ActiveOrder order = new ActiveOrder(_manager, provider, quotes, _dataDelivery.SourceId, Symbol, true); price = ProcessPrice(quotes, orderType, price); string id = provider.SubmitOrder(provider.DefaultAccount.Info, order, _info.Symbol, orderType, volume, slippage, price, takeProfit, stopLoss, string.Empty, out operationResultMessage); if (string.IsNullOrEmpty(id)) { return string.Empty; } OrderInfo info = new OrderInfo(id, Symbol, orderType, OrderStateEnum.Submitted, volume, price, null, null, null, null, null, null, null, null, null, null, string.Empty, null); order.AdoptInfo(info); provider.TradeEntities.AddOrder(order); return id; }
/// <summary> /// /// </summary> protected override string OnSubmit(ISourceOrderExecution provider, OrderTypeEnum orderType, int volume, decimal? price, decimal? slippage, decimal? takeProfit, decimal? stopLoss, out string operationResultMessage) { PassiveOrder order = new PassiveOrder(_manager, _dataDelivery.SourceId, provider.SourceId); string id = provider.SubmitOrder(provider.DefaultAccount.Info, order, _info.Symbol, orderType, volume, slippage, price, takeProfit, stopLoss, string.Empty, out operationResultMessage); if (string.IsNullOrEmpty(id)) { return string.Empty; } if (order.Info.State != OrderStateEnum.Executed) {// It is possible that the submit executes the order instantly, so make sure this is not the case. OrderInfo info = new OrderInfo(id, Symbol, orderType, OrderStateEnum.Submitted, volume, price, null, null, null, null, null, null, null, null, null, null, string.Empty, null); order.AdoptInfo(info); } provider.TradeEntities.AddOrder(order); return id; }