public TEsOrderInsertReqField InsertOrder(string symbolCode, double price, EsunnyDirectType direction, EsunnyOffsetType offset, int volume)
        {
            TEsOrderInsertReqField req = new TEsOrderInsertReqField();


            if (this.contractMap.ContainsKey(symbolCode))
            {
                //交易所
                req.Exchange = contractMap[symbolCode].Exchange;
                //普通单
                req.CmbType   = EsunnyCombinOrderType.Normal;
                req.Contract1 = symbolCode.ToUpper();
            }
            else if (this.combinContractMap.ContainsKey(symbolCode))
            {
                //交易所
                req.Exchange = combinContractMap[symbolCode].Exchange;
                //跨期/跨品种
                req.CmbType = combinContractMap[symbolCode].CmbType;

                string[] items = symbolCode.Split('\\');

                req.Contract1 = items[0];
                req.Contract2 = items[1];
            }
            else
            {
                throw new ApplicationException("未知合约:" + symbolCode);
            }

            req.Direct     = direction;
            req.Offset     = offset;
            req.OrderPrice = price;
            req.OrderVol   = volume;
            req.RequestID  = this._requestID++;

            req.OrderType = EsunnyOrderType.LimitOrder;
            req.Hedge     = EsunnyHedgeType.Speculation;

            InvokeAPI(EsunnyWrapperAction.OrderInsert, req);

            return(req);
        }
Beispiel #2
0
        public TEsOrderInsertReqField InsertOrder(string symbolCode, double price, EsunnyDirectType direction, EsunnyOffsetType offset, int volume)
        {
            TEsOrderInsertReqField req = new TEsOrderInsertReqField();

              if (this.contractMap.ContainsKey(symbolCode))
              {
            //交易所
            req.Exchange = contractMap[symbolCode].Exchange;
            //普通单
            req.CmbType = EsunnyCombinOrderType.Normal;
            req.Contract1 = symbolCode.ToUpper();
              }
              else if (this.combinContractMap.ContainsKey(symbolCode))
              {
            //交易所
            req.Exchange = combinContractMap[symbolCode].Exchange;
            //跨期/跨品种
            req.CmbType = combinContractMap[symbolCode].CmbType;

            string[] items = symbolCode.Split('\\');

            req.Contract1 = items[0];
            req.Contract2 = items[1];

              }
              else
              {
            throw new ApplicationException("未知合约:" + symbolCode);
              }

              req.Direct = direction;
              req.Offset = offset;
              req.OrderPrice = price;
              req.OrderVol = volume;
              req.RequestID = this._requestID++;

              req.OrderType = EsunnyOrderType.LimitOrder;
              req.Hedge = EsunnyHedgeType.Speculation;

              InvokeAPI(EsunnyWrapperAction.OrderInsert, req);

              return req;
        }