public void Run() { api = new KSFTTraderAdapter(); cosApi = api.LoadExtApi(COS_API); api.OnFrontConnected += new FrontConnected(OnFrontConnected); api.OnRspUserLogin += new RspUserLogin(OnRspUserLogin); cosApi.OnRspInitInsertConditionalOrder += new RspInitInsertConditionalOrder(OnRspInitInsertConditionalOrder); cosApi.OnRspQueryConditionalOrder += new RspQueryConditionalOrder(OnRspQueryConditionalOrder); cosApi.OnRspInsertProfitAndLossOrder += new RspInsertProfitAndLossOrder(OnRspInsertProfitAndLossOrder); cosApi.OnRspModifyConditionalOrder += new RspModifyConditionalOrder(OnRspModifyConditionalOrder); cosApi.OnRspModifyProfitAndLossOrder += new RspModifyProfitAndLossOrder(OnRspModifyProfitAndLossOrder); cosApi.OnRspPauseConditionalOrder += new RspPauseConditionalOrder(OnRspPauseConditionalOrder); cosApi.OnRspQueryProfitAndLossOrder += new RspQueryProfitAndLossOrder(OnRspQueryProfitAndLossOrder); cosApi.OnRspRemoveConditionalOrder += new RspRemoveConditionalOrder(OnRspRemoveConditionalOrder); cosApi.OnRspRemoveProfitAndLossOrder += new RspRemoveProfitAndLossOrder(OnRspRemoveProfitAndLossOrder); cosApi.OnRspSelectConditionalOrder += new RspSelectConditionalOrder(OnRspSelectConditionalOrder); cosApi.OnRtnCOSAskSelect += new RtnCOSAskSelect(OnRtnCOSAskSelect); cosApi.OnRtnCOSStatus += new RtnCOSStatus(OnRtnCOSStatus); cosApi.OnRtnPLStatus += new RtnPLStatus(OnRtnPLStatus); api.SubscribePublicTopic(EnumTeResumeType.THOST_TERT_QUICK); // 注册公有流 api.SubscribePrivateTopic(EnumTeResumeType.THOST_TERT_QUICK); // 注册私有流 try { api.RegisterFront(FRONT_ADDR); api.Init(); api.Join(); // 阻塞直到关闭或者CTRL+C } catch (Exception e) { Console.WriteLine(e.Message); } finally { api.Release(); } }
int SESSION_ID; //会话编号 #endregion Fields #region Methods public void Run() { api = new KSFTTraderAdapter(); api.OnFrontConnected += new FrontConnected(OnFrontConnected); api.OnFrontDisconnected += new FrontDisconnected(OnFrontDisconnected); api.OnHeartBeatWarning += new HeartBeatWarning(OnHeartBeatWarning); api.OnRspError += new RspError(OnRspError); api.OnRspUserLogin += new RspUserLogin(OnRspUserLogin); api.OnRspUserLogout += new RspUserLogout(OnRspUserLogout); api.OnRspUserPasswordUpdate += new RspUserPasswordUpdate(OnRspUserPasswordUpdate); api.OnRspTradingAccountPasswordUpdate += new RspTradingAccountPasswordUpdate(OnRspTradingAccountPasswordUpdate); api.OnRspOrderAction += new RspOrderAction(OnRspOrderAction); api.OnRspOrderInsert += new RspOrderInsert(OnRspOrderInsert); api.OnRspQueryMaxOrderVolume += new RspQueryMaxOrderVolume(OnRspQueryMaxOrderVolume); api.OnRspQryOrder += new RspQryOrder(OnRspQryOrder); api.OnRspQryTrade += new RspQryTrade(OnRspQryTrade); api.OnRspQryInvestor += new RspQryInvestor(OnRspQryInvestor); api.OnRspQryTradingCode += new RspQryTradingCode(OnRspQryTradingCode); api.OnRspQryInstrumentMarginRate += new RspQryInstrumentMarginRate(OnRspQryInstrumentMarginRate); api.OnRspQryInstrumentCommissionRate += new RspQryInstrumentCommissionRate(OnRspQryInstrumentCommissionRate); api.OnRspQryExchange += new RspQryExchange(OnRspQryExchange); api.OnRspQryDepthMarketData += new RspQryDepthMarketData(OnRspQryDepthMarketData); api.OnRspQrySettlementInfo += new RspQrySettlementInfo(OnRspQrySettlementInfo); api.OnRspQryInvestorPositionDetail += new RspQryInvestorPositionDetail(OnRspQryInvestorPositionDetail); api.OnRspQryNotice += new RspQryNotice(OnRspQryNotice); api.OnRspQrySettlementInfoConfirm += new RspQrySettlementInfoConfirm(OnRspQrySettlementInfoConfirm); api.OnRspQryInvestorPositionCombineDetail += new RspQryInvestorPositionCombineDetail(OnRspQryInvestorPositionCombineDetail); api.OnRspQryEWarrantOffset += new RspQryEWarrantOffset(OnRspQryEWarrantOffset); api.OnRspQryTransferSerial += new RspQryTransferSerial(OnRspQryTransferSerial); api.OnRspQryAccountregister += new RspQryAccountregister(OnRspQryAccountregister); api.OnRspQryInstrument += new RspQryInstrument(OnRspQryInstrument); api.OnRspQryInvestorPosition += new RspQryInvestorPosition(OnRspQryInvestorPosition); api.OnRspQryTradingAccount += new RspQryTradingAccount(OnRspQryTradingAccount); api.OnRspSettlementInfoConfirm += new RspSettlementInfoConfirm(OnRspSettlementInfoConfirm); api.OnRtnOrder += new RtnOrder(OnRtnOrder); api.OnRtnTrade += new RtnTrade(OnRtnTrade); api.OnErrRtnOrderInsert += new ErrRtnOrderInsert(OnErrRtnOrderInsert); api.OnErrRtnOrderAction += new ErrRtnOrderAction(OnErrRtnOrderAction); api.OnRtnInstrumentStatus += new RtnInstrumentStatus(OnRtnInstrumentStatus); api.OnRtnTradingNotice += new RtnTradingNotice(OnRtnTradingNotice); api.OnRspQryContractBank += new RspQryContractBank(OnRspQryContractBank); api.OnRspQryTradingNotice += new RspQryTradingNotice(OnRspQryTradingNotice); api.OnRspQryBrokerTradingParams += new RspQryBrokerTradingParams(OnRspQryBrokerTradingParams); api.OnRspQryBrokerTradingAlgos += new RspQryBrokerTradingAlgos(OnRspQryBrokerTradingAlgos); api.OnRspFromBankToFutureByFuture += new RspFromBankToFutureByFuture(OnRspFromBankToFutureByFuture); api.OnRspFromFutureToBankByFuture += new RspFromFutureToBankByFuture(OnRspFromFutureToBankByFuture); api.OnRspQueryBankAccountMoneyByFuture += new RspQueryBankAccountMoneyByFuture(OnRspQueryBankAccountMoneyByFuture); api.OnRspQryInvestorOpenPosition += new RspQryInvestorOpenPosition(OnRspQryInvestorOpenPosition); api.OnRspQryInvestorOpenCombinePosition += new RspQryInvestorOpenCombinePosition(OnRspQryInvestorOpenCombinePosition); api.OnRspBulkCancelOrder += new RspBulkCancelOrder(OnRspBulkCancelOrder); api.SubscribePublicTopic(EnumTeResumeType.THOST_TERT_QUICK); // 注册公有流 api.SubscribePrivateTopic(EnumTeResumeType.THOST_TERT_QUICK); // 注册私有流 try { api.RegisterFront(FRONT_ADDR); api.Init(); api.Join(); // 阻塞直到关闭或者CTRL+C } catch (Exception e) { Console.WriteLine(e.Message); } finally { api.Release(); } }
int SESSION_ID; //会话编号 #endregion Fields #region Methods public void Run() { api = new KSFTTraderAdapter(); cosApi = api.LoadExtApi(COS_API); api.OnFrontConnected += new FrontConnected(OnFrontConnected); api.OnRspUserLogin += new RspUserLogin(OnRspUserLogin); cosApi.OnRspInitInsertConditionalOrder += new RspInitInsertConditionalOrder(OnRspInitInsertConditionalOrder); cosApi.OnRspQueryConditionalOrder += new RspQueryConditionalOrder(OnRspQueryConditionalOrder); cosApi.OnRspInsertProfitAndLossOrder += new RspInsertProfitAndLossOrder(OnRspInsertProfitAndLossOrder); cosApi.OnRspModifyConditionalOrder += new RspModifyConditionalOrder(OnRspModifyConditionalOrder); cosApi.OnRspModifyProfitAndLossOrder += new RspModifyProfitAndLossOrder(OnRspModifyProfitAndLossOrder); cosApi.OnRspPauseConditionalOrder += new RspPauseConditionalOrder(OnRspPauseConditionalOrder); cosApi.OnRspQueryProfitAndLossOrder += new RspQueryProfitAndLossOrder(OnRspQueryProfitAndLossOrder); cosApi.OnRspRemoveConditionalOrder += new RspRemoveConditionalOrder(OnRspRemoveConditionalOrder); cosApi.OnRspRemoveProfitAndLossOrder += new RspRemoveProfitAndLossOrder(OnRspRemoveProfitAndLossOrder); cosApi.OnRspSelectConditionalOrder += new RspSelectConditionalOrder(OnRspSelectConditionalOrder); cosApi.OnRtnCOSAskSelect += new RtnCOSAskSelect(OnRtnCOSAskSelect); cosApi.OnRtnCOSStatus += new RtnCOSStatus(OnRtnCOSStatus); cosApi.OnRtnPLStatus += new RtnPLStatus(OnRtnPLStatus); api.SubscribePublicTopic(EnumTeResumeType.THOST_TERT_QUICK); // 注册公有流 api.SubscribePrivateTopic(EnumTeResumeType.THOST_TERT_QUICK); // 注册私有流 try { api.RegisterFront(FRONT_ADDR); api.Init(); api.Join(); // 阻塞直到关闭或者CTRL+C } catch (Exception e) { Console.WriteLine(e.Message); } finally { api.Release(); } }