Beispiel #1
0
        /// <summary>
        /// 取消下单
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public static async Task CancelOrderAsync(CancelOrderReq order)
        {
            try
            {
                var requestUrl = TRADE_URL + CANCEL_ORDER_URL;

                var form = new Dictionary <string, string>();
                form.Add("orderNumber", order.OrderNo);
                form.Add("currencyPair", order.CurrencyPair);

                var json = await PostReqAsync(requestUrl, form);

                var parse = JToken.Parse(json) as dynamic;
                if (parse.result == "false")
                {
                    var code    = parse.code.ToString();
                    var message = parse.message.ToString();

                    throw new BotException(code, message);
                }
            }
            catch (JsonSerializationException)
            {
                throw new BotException("1002");
            }
            catch (Exception ex)
            {
                throw new BotException("1000", ex.Message);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 撤单
        /// </summary>
        /// <param name="req"></param>
        public void CancelOrder(CancelOrderReq cancelOrderReq)
        {
            ThostFtdcInputOrderActionField req = new ThostFtdcInputOrderActionField();

            ///经纪公司代码
            req.BrokerID = this.BrokerID;
            ///投资者代码
            req.InvestorID = this.UserID;
            ///报单操作引用
            //	TThostFtdcOrderActionRefType	OrderActionRef;
            ///报单本地委托号
            req.OrderRef = cancelOrderReq.orderID;
            ///请求编号
            //	TThostFtdcRequestIDType	RequestID;
            ///前置编号
            req.FrontID = cancelOrderReq.frontID;
            ///会话编号
            req.SessionID = cancelOrderReq.sessionID;
            ///交易所代码
            //	TThostFtdcExchangeIDType	ExchangeID;
            ///报单编号
            //	TThostFtdcOrderSysIDType	OrderSysID;
            ///操作标志
            req.ActionFlag = CTP.EnumActionFlagType.Delete;
            ///价格
            //	TThostFtdcPriceType	LimitPrice;
            ///数量变化
            //	TThostFtdcVolumeType	VolumeChange;
            ///用户代码
            //	TThostFtdcUserIDType	UserID;
            ///合约代码
            req.InstrumentID = cancelOrderReq.symbol;

            int iResult = this.ReqOrderAction(req, ++this.reqID);

            Console.WriteLine("--->>> 报单操作请求: " + ((iResult == 0) ? "成功" : "失败"));
        }
Beispiel #3
0
 public override void CancelOrder(CancelOrderReq req)
 {
     this.td.CancelOrder(req);
 }
Beispiel #4
0
 /// <summary>
 /// 撤单
 /// </summary>
 public virtual void CancelOrder(CancelOrderReq req)
 {
     td.CancelOrder(req);
 }
Beispiel #5
0
 public void CancelOrder(CancelOrderReq req)
 {
     throw new NotImplementedException();
 }
Beispiel #6
0
 /// <summary>
 /// 撤单
 /// </summary>
 public void CancelOrder(CancelOrderReq req)
 {
     Gateway.CancelOrder(req);
 }