Exemplo n.º 1
0
 protected override TrdPlaceOrder.Request.Builder MakeReqBuilder(ReqHisKL request)
 {
     TrdPlaceOrder.Request.Builder req       = TrdPlaceOrder.Request.CreateBuilder();
     TrdPlaceOrder.C2S.Builder     cs        = TrdPlaceOrder.C2S.CreateBuilder();
     Common.PacketID.Builder       packetID  = Common.PacketID.CreateBuilder().SetConnID(cnxID).SetSerialNo(0);
     TrdCommon.TrdHeader.Builder   trdHeader = TrdCommon.TrdHeader.CreateBuilder().SetAccID(this.accID).SetTrdEnv((int)TrdCommon.TrdEnv.TrdEnv_Real).SetTrdMarket((int)TrdCommon.TrdMarket.TrdMarket_HK);
     cs.SetPacketID(packetID).SetHeader(trdHeader).SetTrdSide((int)TrdCommon.TrdSide.TrdSide_Sell).SetOrderType((int)TrdCommon.OrderType.OrderType_AbsoluteLimit).SetCode("01810").SetQty(100.00).SetPrice(10.2).SetAdjustPrice(true);
     req.SetC2S(cs);
     return(req);
 }
Exemplo n.º 2
0
        public void OnReply_UnlockTrade(FTAPI_Conn client, int nSerialNo, TrdUnlockTrade.Response rsp)
        {
            Console.WriteLine("Recv UnlockTrade: {0} {1}", nSerialNo, rsp);
            if (rsp.RetType != (int)Common.RetType.RetType_Succeed)
            {
                Console.WriteLine("error code is {0}", rsp.RetMsg);
            }
            else
            {
                FTAPI_Trd trd = client as FTAPI_Trd;

                TrdPlaceOrder.Request.Builder req       = TrdPlaceOrder.Request.CreateBuilder();
                TrdPlaceOrder.C2S.Builder     cs        = TrdPlaceOrder.C2S.CreateBuilder();
                Common.PacketID.Builder       packetID  = Common.PacketID.CreateBuilder().SetConnID(trd.GetConnectID()).SetSerialNo(0);
                TrdCommon.TrdHeader.Builder   trdHeader = TrdCommon.TrdHeader.CreateBuilder().SetAccID(this.accID).SetTrdEnv((int)TrdCommon.TrdEnv.TrdEnv_Real).SetTrdMarket((int)TrdCommon.TrdMarket.TrdMarket_HK);
                cs.SetPacketID(packetID).SetHeader(trdHeader).SetTrdSide((int)TrdCommon.TrdSide.TrdSide_Sell).SetOrderType((int)TrdCommon.OrderType.OrderType_AbsoluteLimit).SetCode("01810").SetQty(100.00).SetPrice(10.2).SetAdjustPrice(true);
                req.SetC2S(cs);

                uint serialNo = trd.PlaceOrder(req.Build());
                Console.WriteLine("Send PlaceOrder: {0}, {1}", serialNo, req);
            }
        }