Пример #1
0
 public string SendOptionOrder(string symbol,
                               FutureBuyOrSell bs,
                               FutureCloseType oc,
                               FutureTradeCondition condition,
                               FuturePriceType priceType,
                               decimal price,
                               int vol)
 {
     return(_fireOrderMgrInstance.AddOptionOrder(symbol, bs, oc, condition, priceType, price, vol));
 }
Пример #2
0
        public string AddOptionOrder(
            string symbol,
            FutureBuyOrSell buySell,
            FutureCloseType openClose,
            FutureTradeCondition condition,
            FuturePriceType priceType,
            decimal price,
            int vol)
        {
            HttpSender      http    = new HttpSender(_sendFutureOrderApi);
            CookieContainer cookies = new CookieContainer();

            cookies.Add(this._loginCookies);

            string odrPriceType = "";
            string odrCondition = "";

            if (condition == FutureTradeCondition.IOC)
            {
                odrCondition = "IOC";
                odrPriceType = "MKT";
            }
            else if (condition == FutureTradeCondition.ROD)
            {
                odrCondition = "ROD";
                odrPriceType = "LMT";
            }
            else
            {
                odrCondition = "FOK";
                odrPriceType = "LMT";
            }

            PutOrderPostReq req = new PutOrderPostReq
            {
                assetcode = symbol,
                bs        = buySell == FutureBuyOrSell.Buy ? "B" : "S",
                gmrid     = this._gmrid,
                oct       = openClose == FutureCloseType.Open ? "O" :"C",
                on        = odrCondition,
                ot        = odrPriceType,
                price     = condition == FutureTradeCondition.IOC ? 0 : price,
                volume    = vol,
                fip       = "125.227.70.205"
            };

            ResponseResult response = http.SendRequest(HttpRequestMethod.Post, JsonConvert.SerializeObject(req), this._header, cookies);

            Console.Write(response.ResponseBody);
            PutOrderPostRsp rsp = JsonConvert.DeserializeObject <PutOrderPostRsp>(response.ResponseBody);

            PutOrderIdToCase(rsp.msg.Trim());
            return(rsp.msg.Trim());
        }