static void Main(string[] args) { q = new CtpQuote("ctp_quote"); t = new CtpTrade("ctp_trade"); t.SetOnFrontConnected(t_connected); t.SetOnRspUserLogin(t_login); t.SetOnRtnTradingNotice(t_notice); q.SetOnFrontConnected(connected); q.SetOnRspUserLogin(login); t.RegisterFront("tcp://180.168.146.187:10000"); q.RegisterFront("tcp://180.168.146.187:10010"); t.Init(); q.Init(); Console.ReadLine(); }
//响应注册 void SetCallBack() { _t.SetOnFrontConnected((DelegateOnFrontConnected)AddDele(new DelegateOnFrontConnected(CTPOnFrontConnected))); _t.SetOnRspUserLogin((DelegateOnRspUserLogin)AddDele(new DelegateOnRspUserLogin(CTPOnRspUserLogin))); _t.SetOnRspSettlementInfoConfirm((DelegateOnRspSettlementInfoConfirm)AddDele(new DelegateOnRspSettlementInfoConfirm(CTPOnRspSettlementInfoConfirm))); _t.SetOnFrontDisconnected((DelegateOnFrontDisconnected)AddDele(new DelegateOnFrontDisconnected(CTPOnFrontDisconnected))); _t.SetOnRspQryInstrument((DelegateOnRspQryInstrument)AddDele(new DelegateOnRspQryInstrument(CTPOnRspQryInstrument))); _t.SetOnRspQryInvestorPosition((DelegateOnRspQryInvestorPosition)AddDele(new DelegateOnRspQryInvestorPosition(CTPOnRspQryInvestorPosition))); _t.SetOnRspQryTradingAccount((DelegateOnRspQryTradingAccount)AddDele(new DelegateOnRspQryTradingAccount(CTPOnRspQryTradingAccount))); _t.SetOnRspOrderInsert((DelegateOnRspOrderInsert)AddDele(new DelegateOnRspOrderInsert(CTPOnRspOrderInsert))); _t.SetOnErrRtnOrderInsert((DelegateOnErrRtnOrderInsert)AddDele(new DelegateOnErrRtnOrderInsert(CTPOnErrRtnOrderInsert))); _t.SetOnErrRtnOrderAction((DelegateOnErrRtnOrderAction)AddDele(new DelegateOnErrRtnOrderAction(CTPOnErrRtnOrderAction))); _t.SetOnRspOrderAction((DelegateOnRspOrderAction)AddDele(new DelegateOnRspOrderAction(CTPOnRspOrderAction))); _t.SetOnRtnOrder((DelegateOnRtnOrder)AddDele(new DelegateOnRtnOrder(CTPOnRtnOrder))); _t.SetOnRtnTrade((DelegateOnRtnTrade)AddDele(new DelegateOnRtnTrade(CTPOnRtnTrade))); _t.SetOnRtnInstrumentStatus((DelegateOnRtnInstrumentStatus)AddDele(new DelegateOnRtnInstrumentStatus(CTPOnRtnInstrumentStatus))); _t.SetOnRtnTradingNotice((DelegateOnRtnTradingNotice)AddDele(new DelegateOnRtnTradingNotice(CTPOnRtnTradingNotice))); _t.SetOnRspUserPasswordUpdate((DelegateOnRspUserPasswordUpdate)AddDele(new DelegateOnRspUserPasswordUpdate(CTPOnRspUserPasswordUpdate))); _t.SetOnRspError((DelegateOnRspError)AddDele(new DelegateOnRspError(CTPOnRspError))); _t.SetOnRspQryProduct((DelegateOnRspQryProduct)AddDele(new DelegateOnRspQryProduct(CTPOnRspQryProduct))); }