コード例 #1
0
        public TraderSession trdUnlockTradeForReal(long futuUserID, String pwdMD5)
        {
            this.trdenv = TrdEnv.TrdEnv_Real;
            //获取交易账户列表
            TrdGetAccListExec rrdexec = new TrdGetAccListExec(futuUserID);

            request.execute(rrdexec);
            Trd_GetAccList.Response response = (Trd_GetAccList.Response)rrdexec.getValue();
            if (response.RetType == 0)
            {
                trdAccs = response.S2C.AccListList.ToList();
                //解锁交易
                TrdUnlockTradeExec exec = new TrdUnlockTradeExec(true, pwdMD5);
                request.execute(exec);
                Trd_UnlockTrade.Response res = (Trd_UnlockTrade.Response)exec.getValue();
                if (res.RetType == 0)
                {
                    List <long> accids = new List <long>();
                    foreach (TrdAcc accid in trdAccs)
                    {
                        accids.Add((long)accid.AccID);
                    }
                    //订阅接收交易账户的推送数据
                    TrdSubAccPushExec trdSubAccPushExec = new TrdSubAccPushExec(accids.ToArray());
                    request.execute(trdSubAccPushExec);
                    return(this);
                }
                throw new Exception(res.RetMsg);
            }
            throw new Exception(response.RetMsg);
        }
コード例 #2
0
        //    public QotGetOwnerPlate.Response qotGetOwnerPlate(QotMarket market, String[] symbol)
        //{
        //    QotGetOwnerPlateExec exec = new QotGetOwnerPlateExec(market, symbol);
        //request.execute(exec);
        //		return exec.getValue();
        //	}


        //    public QotGetHoldingChangeList.Response qotGetHoldingChangeList(QotMarket market, String symbol, int holderCategory, String beginTime, String endTime)
        //{
        //    QotGetHoldingChangeListExec exec = new QotGetHoldingChangeListExec(market, symbol, holderCategory, beginTime, endTime);
        //request.execute(exec);
        //		return exec.getValue();
        //	}


        //    public QotGetOptionChain.Response qotGetOptionChain(QotMarket market, String symbol, String beginTime, String endTime, int type, int condition)
        //{
        //    QotGetOptionChainExec exec = new QotGetOptionChainExec(market, symbol, beginTime, endTime, type, condition);
        //request.execute(exec);
        //		return exec.getValue();
        //	}


        //    public QotGetOrderDetail.Response qotGetOrderDetail(QotMarket market, String symbol, IUpdateCallBack<OrderDetails> callback)
        //{
        //    QotGetOrderDetailExec exec = new QotGetOrderDetailExec(market, symbol, callback);
        //request.execute(exec);
        //		return exec.getValue();
        //	}

        public TraderSession trdUnlockTradeForSimulate(long futuUserID, String pwdMD5)
        {
            this.trdenv = TrdEnv.TrdEnv_Simulate;
            TrdGetAccListExec rrdexec = new TrdGetAccListExec(futuUserID);

            request.execute(rrdexec);
            Trd_GetAccList.Response response = (Trd_GetAccList.Response)rrdexec.getValue();
            if (response.RetType == 0)
            {
                this.trdAccs = response.S2C.AccListList.ToList();

                return(this);
            }
            throw new Exception(response.RetMsg);
        }