Exemple #1
0
        public CtpMdApi(string userID, string password, string brokerID, string mdAddress, CtpGateway gateway) : base()
        {
            this.UserID    = userID;
            this.Password  = password;
            this.BrokerID  = brokerID;
            this.MdAddress = mdAddress;
            this.Gateway   = gateway;

            //注册回调函数
            this.OnFrontConnected     += new FrontConnected(HandleOnFrontConnected);
            this.OnFrontDisconnected  += new FrontDisconnected(HandleOnFrontDisconnected);
            this.OnRspError           += new RspError(HandleOnRspError);
            this.OnHeartBeatWarning   += new HeartBeatWarning(HandleOnHeartBeatWarning);
            this.OnRspSubMarketData   += new RspSubMarketData(HandleOnRspSubMarketData);
            this.OnRspUnSubMarketData += new RspUnSubMarketData(HandleOnRspUnSubMarketData);
            this.OnRspUserLogin       += new RspUserLogin(HandleOnRspUserLogin);
            this.OnRspUserLogout      += new RspUserLogout(HandleOnRspUserLogout);
            this.OnRtnDepthMarketData += new RtnDepthMarketData(HandleOnRtnDepthMarketData);
        }
Exemple #2
0
        public CtpTdApi(string userID, string password, string brokerID, string tdAddress, string authCode, string userProductInfo, CtpGateway gateway)
        {
            this.UserID               = userID;
            this.Password             = password;
            this.BrokerID             = brokerID;
            this.TdAddress            = tdAddress;
            this.AuthCode             = authCode;
            this.UserProductInfo      = userProductInfo;
            this.Gateway              = gateway;
            this.OnFrontConnected    += new FrontConnected(HandleOnFrontConnected);
            this.OnFrontDisconnected += new FrontDisconnected(HandleOnFrontDisconnected);
            this.OnHeartBeatWarning  += new HeartBeatWarning(HandleOnHeartBeatWarning);
            this.OnRspError          += new RspError(HandleOnRspError);
            this.OnRspUserLogin      += new RspUserLogin(HandleOnRspUserLogin);
            ///撤单错误
            this.OnRspOrderAction += new RspOrderAction(HandleOnRspOrderAction);


            this.OnRspOrderInsert += new RspOrderInsert(HandleOnRspOrderInsert);

            ///撤单错误回报(交易所)
            this.OnErrRtnOrderAction += new ErrRtnOrderAction(HandleErrRtnOrderAction);
            ///报单错误回报
            this.OnErrRtnOrderInsert += new ErrRtnOrderInsert(HandleErrRtnOrderInsert);


            this.OnRspQryInstrument         += new RspQryInstrument(HandleOnRspQryInstrument);
            this.OnRspQryInvestorPosition   += new RspQryInvestorPosition(HandleOnRspQryInvestorPosition);
            this.OnRspQryTradingAccount     += new RspQryTradingAccount(HandleOnRspQryTradingAccount);
            this.OnRspSettlementInfoConfirm += new RspSettlementInfoConfirm(HandleOnRspSettlementInfoConfirm);
            this.OnRtnOrder        += new RtnOrder(HandleOnRtnOrder);
            this.OnRtnTrade        += new RtnTrade(HandleOnRtnTrade);
            this.OnRspAuthenticate += new RspAuthenticate(HandleOnRspAuthenticate);

            this.SubscribePublicTopic(EnumTeResumeType.THOST_TERT_RESTART);                                     // 注册公有流
            this.SubscribePrivateTopic(EnumTeResumeType.THOST_TERT_RESTART);                                    // 注册私有流
        }