Esempio n. 1
0
        public void TestRemoveParkedOrderAction()
        {
            _api.OnRspRemoveParkedOrderAction += new TradeApi.RspRemoveParkedOrderAction((ref CThostFtdcRemoveParkedOrderActionField pRemoveParkedOrderAction, ref CThostFtdcRspInfoField pRspInfo,
                                                                                          int nRequestID, byte bIsLast) =>
            {
                if (pRspInfo.ErrorID == 0)
                {
                    Console.WriteLine("删除预埋撤单成功, ParkedOrderActionID: {0}", pRemoveParkedOrderAction.ParkedOrderActionID);
                }
                else
                {
                    Console.WriteLine(pRspInfo.ErrorMsg);
                }
                Assert.IsTrue(pRspInfo.ErrorID == 0);
            });
            _api.OnRspParkedOrderAction += new TradeApi.RspParkedOrderAction((ref CThostFtdcParkedOrderActionField pParkedOrderAction,
                                                                              ref CThostFtdcRspInfoField pRspInfo, int nRequestID, byte bIsLast) =>
            {
                if (pRspInfo.ErrorID == 0)
                {
                    Console.WriteLine("预埋撤单录入成功, ParkedOrderActionID: {0}", pParkedOrderAction.ParkedOrderActionID);
                    _api.RemoveParkedOrderAction(1, pParkedOrderAction.ParkedOrderActionID);
                    Thread.Sleep(50);
                }
                else
                {
                    Console.WriteLine(pRspInfo.ErrorMsg);
                }
                Assert.IsTrue(pRspInfo.ErrorID == 0);
            });
            CThostFtdcParkedOrderActionField field = new CThostFtdcParkedOrderActionField();

            field.ActionFlag   = TThostFtdcActionFlagType.Delete;
            field.BrokerID     = _brokerID;
            field.InvestorID   = _investorID;
            field.InstrumentID = "TF1809";
            field.FrontID      = 1;
            field.SessionID    = -1253843411;
            field.OrderRef     = "1";
            field.ExchangeID   = "CFFEX";
            string OrderSysID = "132984";

            field.OrderSysID = new string('\0', 21 - OrderSysID.Length) + OrderSysID;
            _api.ParkedOrderAction(1, field);
            Thread.Sleep(200);
        }