public Mantle.Fix44.OrderCancelRequest OrderCancelRequest(NewOrderRequest request, string orderID) { var res = new Mantle.Fix44.OrderCancelRequest() { StandardHeader = StandardHeader() }; res.ClOrdID.Value = _clOrdIDGenerator.GenerateID(); // This field is required. It's treated differently by different exchanges: // - MOEX ignores this field but it'll reject the request if the field isn't set. // - OKcoin uses this field to identify the order. Note that they want OrderID (!) there. res.OrigClOrdID.Value = orderID; // MOEX identifies the order based on this field. OKcoin ignores this field. res.OrderID.Value = orderID; res.Instrument.Symbol.Value = request.Symbol; res.Side.Value = request.Side == Side.Buy ? '1' : '2'; res.TransactTime.Value = res.StandardHeader.SendingTime.Value; if (_cfg.Extensions == Extensions.Huobi) { res.HuobiSignature = HuobiSignature ( new KeyValuePair <string, string>[] { new KeyValuePair <string, string>("method", "cancel_order"), new KeyValuePair <string, string>("coin_type", HuobiCoinType(request.Symbol)), new KeyValuePair <string, string>("id", orderID), } ); } return(res); }
bool Cancel(IOrder order, NewOrderRequest request) { try { if (order.IsPending) { _log.Info("Can't cancel order with a pending request", order); return(false); } if (order.Status != OrderStatus.Accepted && order.Status != OrderStatus.PartiallyFilled) { _log.Info("Order is not in a cancelable state: {0}", order); return(false); } Assert.NotNull(order.OrderID); Mantle.Fix44.OrderCancelRequest msg = _messageBuilder.OrderCancelRequest(request, order.OrderID); return(StoreOp(order, msg.ClOrdID.Value, _connection.Send(msg), null)); } catch (Exception e) { if (!_disposed) { _log.Error(e, "Unexpected error while cancelling an order"); } return(false); } }
public Mantle.Fix44.OrderCancelRequest OrderCancelRequest(NewOrderRequest request, string orderID) { var res = new Mantle.Fix44.OrderCancelRequest() { StandardHeader = StandardHeader() }; res.ClOrdID.Value = _clOrdIDGenerator.GenerateID(); // This field is required. It's treated differently by different exchanges: // - MOEX ignores this field but it'll reject the request if the field isn't set. // - OKcoin uses this field to identify the order. Note that they want OrderID (!) there. res.OrigClOrdID.Value = orderID; // MOEX identifies the order based on this field. OKcoin ignores this field. res.OrderID.Value = orderID; res.Instrument.Symbol.Value = request.Symbol; res.Side.Value = request.Side == Side.Buy ? '1' : '2'; res.TransactTime.Value = res.StandardHeader.SendingTime.Value; if (_cfg.Extensions == Extensions.Huobi) { res.HuobiSignature = HuobiSignature ( new KeyValuePair<string, string>[] { new KeyValuePair<string, string>("method", "cancel_order"), new KeyValuePair<string, string>("coin_type", HuobiCoinType(request.Symbol)), new KeyValuePair<string, string>("id", orderID), } ); } return res; }