UNPKG

xyctp_test

Version:
501 lines (369 loc) 12.7 kB
const helper = require('./helper'); class Trade { constructor(ctp) { this.ctp = ctp; this._regsiterHandlers(); } // constructor(ctp, { privateTopicMode = 2, publicTopicMode = 2 }) { // this.ctp = ctp; // this._regsiterHandlers(); // //THOST_TERT_RESTART:从本交易日开始重传 0 // //THOST_TERT_RESUME:从上次收到的续传 1 // //THOST_TERT_QUICK:只传送登录后私有流的内容 2 // ctp.td.subscribePrivateTopic(privateTopicMode); // ctp.td.subscribePublicTopic(publicTopicMode); // } _regsiterHandlers() { const td = this.ctp.td; const allProps = helper.getAllProperties(this); allProps.forEach((prop) => { if (/^on[A-Z][a-zA-Z]*$/.test(prop)) { td.on(prop.slice(2), this[prop].bind(this)); } }); } // onFrontConnected() { // } // onFrontDisconnected(nReason) { // } // onRspAuthenticate(data, rsp, nReqId, bIsLast) { // } // onRspUserLogin(data, rsp, nReqId, bIsLast) { // } // onRspUserLogout(data, rsp, nReqId, bIsLast) { // } // // 报单通知 // onRtnOrder(data) { // } // // 成交通知 // onRtnTrade(data) { // } // // 报单录入请求响应 // onRspOrderInsert(data, rsp, nReqId, bIsLast) { // } // // 报单操作请求响应 // onRspOrderAction(data, rsp, nReqId, bIsLast) { // } // // 预埋单录入请求响应 // onRspParkedOrderInsert(data, rsp, nReqId, bIsLast) { // } // // 预埋撤单录入请求响应 // onRspParkedOrderAction(data, rsp, nReqId, bIsLast) { // } // // 删除预埋单响应 // onRspRemoveParkedOrder(data, rsp, nReqId, bIsLast) { // } // // 删除预埋撤单响应 // onRspRemoveParkedOrderAction(data, rsp, nReqId, bIsLast) { // } // // 执行宣告录入请求响应 // onRspExecOrderInsert(data, rsp, nReqId, bIsLast) { // } // // 执行宣告操作请求响应 // onRspExecOrderAction(data, rsp, nReqId, bIsLast) { // } // // 询价录入请求响应 // onRspForQuoteInsert(data, rsp, nReqId, bIsLast) { // } // // 报价录入请求响应 // onRspQuoteInsert(data, rsp, nReqId, bIsLast) { // } // // 报价操作请求响应 // onRspQuoteAction(data, rsp, nReqId, bIsLast) { // } // // 批量报单操作请求响应 // onRspBatchOrderAction(data, rsp, nReqId, bIsLast) { // } // // 申请组合录入请求响应 // onRspCombActionInsert(data, rsp, nReqId, bIsLast) { // } // // 请求查询报单响应 // onRspQryOrder(data, rsp, nReqId, bIsLast) { // } // // 请求查询成交响应 // onRspQryTrade(data, rsp, nReqId, bIsLast) { // } // // 查询最大报单数量响应 // onRspQueryMaxOrderVolume(data, rsp, nReqId, bIsLast) { // } // // 投资者结算结果确认响应 // onRspSettlementInfoConfirm(data, rsp, nReqId, bIsLast) { // } // // 请求查询投资者持仓响应 // onRspQryInvestorPosition(data, rsp, nReqId, bIsLast) { // } // // 请求查询签约银行响应 // onRspQryContractBank(data, rsp, nReqId, bIsLast) { // } // // 请求查询资金账户响应 // onRspQryTradingAccount(data, rsp, nReqId, bIsLast) { // } // // 期货发起期货资金转银行应答 // onRspFromFutureToBankByFuture(data, rsp, nReqId, bIsLast) { // } // // 期货发起银行资金转期货应答 // onRspFromBankToFutureByFuture(data, rsp, nReqId, bIsLast) { // } // // 用户口令更新请求响应 // onRspUserPasswordUpdate(data, rsp, nReqId, bIsLast) { // } // // 资金账户口令更新请求响应 // onRspTradingAccountPasswordUpdate(data, rsp, nReqId, bIsLast) { // } // // 请求查询投资者响应 // onRspQryInvestor(data, rsp, nReqId, bIsLast) { // } // // 请求查询交易编码响应 // onRspQryTradingCode(data, rsp, nReqId, bIsLast) { // } // // 请求查询合约保证金率响应 // onRspQryInstrumentMarginRate(data, rsp, nReqId, bIsLast) { // } // // 请求查询合约手续费率响应 // onRspQryInstrumentCommissionRate(data, rsp, nReqId, bIsLast) { // } // // 请求查询交易所响应 // onRspQryExchange(data, rsp, nReqId, bIsLast) { // } // // 请求查询产品响应 // onRspQryProduct(data, rsp, nReqId, bIsLast) { // } // // 请求查询合约响应 // onRspQryInstrument(data, rsp, nReqId, bIsLast) { // } // // 请求查询行情响应 // onRspQryDepthMarketData(data, rsp, nReqId, bIsLast) { // } // // 请求查询投资者结算结果响应 // onRspQrySettlementInfo(data, rsp, nReqId, bIsLast) { // } // // 请求查询转帐银行响应 // onRspQryTransferBank(data, rsp, nReqId, bIsLast) { // } // // 请求查询投资者持仓明细响应 // onRspQryInvestorPositionDetail(data, rsp, nReqId, bIsLast) { // } // // 请求查询客户通知响应 // onRspQryNotice(data, rsp, nReqId, bIsLast) { // } // // 请求查询结算信息确认响应 // onRspQrySettlementInfoConfirm(data, rsp, nReqId, bIsLast) { // } // // 请求查询投资者持仓组合明细响应 // onRspQryInvestorPositionCombineDetail(data, rsp, nReqId, bIsLast) { // } // // 查询保证金监管系统经纪公司资金账户密钥响应 // onRspQryCFMMCTradingAccountKey(data, rsp, nReqId, bIsLast) { // } // // 请求查询仓单折抵信息响应 // onRspQryEWarrantOffset(data, rsp, nReqId, bIsLast) { // } // // 请求查询投资者品种/跨品种保证金响应 // onRspQryInvestorProductGroupMargin(data, rsp, nReqId, bIsLast) { // } // // 请求查询交易所保证金率响应 // onRspQryExchangeMarginRate(data, rsp, nReqId, bIsLast) { // } // // 请求查询交易所调整保证金率响应 // onRspQryExchangeMarginRateAdjust(data, rsp, nReqId, bIsLast) { // } // // 请求查询汇率响应 // onRspQryExchangeRate(data, rsp, nReqId, bIsLast) { // } // // 请求查询二级代理操作员银期权限响应 // onRspQrySecAgentACIDMap(data, rsp, nReqId, bIsLast) { // } // // 请求查询产品报价汇率响应 // onRspQryProductExchRate(data, rsp, nReqId, bIsLast) { // } // // 请求查询产品组响应 // onRspQryProductGroup(data, rsp, nReqId, bIsLast) { // } // // 请求查询做市商合约手续费率响应 // onRspQryMMInstrumentCommissionRate(data, rsp, nReqId, bIsLast) { // } // // 请求查询做市商期权合约手续费响应 // onRspQryMMOptionInstrCommRate(data, rsp, nReqId, bIsLast) { // } // // 请求查询报单手续费响应 // onRspQryInstrumentOrderCommRate(data, rsp, nReqId, bIsLast) { // } // // 请求查询期权交易成本响应 // onRspQryOptionInstrTradeCost(data, rsp, nReqId, bIsLast) { // } // // 请求查询期权合约手续费响应 // onRspQryOptionInstrCommRate(data, rsp, nReqId, bIsLast) { // } // // 请求查询执行宣告响应 // onRspQryExecOrder(data, rsp, nReqId, bIsLast) { // } // // 请求查询询价响应 // onRspQryForQuote(data, rsp, nReqId, bIsLast) { // } // // 请求查询报价响应 // onRspQryQuote(data, rsp, nReqId, bIsLast) { // } // // 请求查询组合合约安全系数响应 // onRspQryCombInstrumentGuard(data, rsp, nReqId, bIsLast) { // } // // 请求查询申请组合响应 // onRspQryCombAction(data, rsp, nReqId, bIsLast) { // } // // 请求查询转帐流水响应 // onRspQryTransferSerial(data, rsp, nReqId, bIsLast) { // } // // 请求查询银期签约关系响应 // onRspQryAccountregister(data, rsp, nReqId, bIsLast) { // } // // 错误应答 // onRspError(rsp, nReqId, bIsLast) { // } // // 报单录入错误回报 // onErrRtnOrderInsert(data, rsp) { // } // // 报单操作错误回报 // onErrRtnOrderAction(data, rsp) { // } // // 合约交易状态通知 // onRtnInstrumentStatus(data) { // } // // 交易所公告通知 // onRtnBulletin(data) { // } // // 交易通知 // onRtnTradingNotice(data) { // } // // 提示条件单校验错误 // onRtnErrorConditionalOrder(data) { // } // // 执行宣告通知 // onRtnExecOrder(data) { // } // // 执行宣告录入错误回报 // onErrRtnExecOrderInsert(data, rsp) { // } // // 执行宣告操作错误回报 // onErrRtnExecOrderAction(data, rsp) { // } // // 询价录入错误回报 // onErrRtnForQuoteInsert(data, rsp) { // } // // 报价通知 // onRtnQuote(data) { // } // // 报价录入错误回报 // onErrRtnQuoteInsert(data, rsp) { // } // // 报价操作错误回报 // onErrRtnQuoteAction(data, rsp) { // } // // 询价通知 // onRtnForQuoteRsp(data) { // } // // 保证金监控中心用户令牌 // onRtnCFMMCTradingAccountToken(data) { // } // // 批量报单操作错误回报 // onErrRtnBatchOrderAction(data, rsp) { // } // // 申请组合通知 // onRtnCombAction(data) { // } // // 申请组合录入错误回报 // onErrRtnCombActionInsert(data, rsp) { // } // // 请求查询预埋撤单响应 // onRspQryParkedOrder(data, rsp, nReqId, bIsLast) { // } // // 请求查询交易通知响应 // onRspQryTradingNotice(data, rsp, nReqId, bIsLast) { // } // // 请求查询经纪公司交易参数响应 // onRspQryBrokerTradingParams(data, rsp, nReqId, bIsLast) { // } // // 请求查询经纪公司交易算法响应 // onRspQryBrokerTradingAlgos(data, rsp, nReqId, bIsLast) { // } // // 请求查询监控中心用户令牌响应 // onRspQueryCFMMCTradingAccountToken(data, rsp, nReqId, bIsLast) { // } // // 银行发起银行资金转期货通知 // onRtnFromBankToFutureByBank(data) { // } // // 银行发起期货资金转银行通知 // onRtnFromFutureToBankByBank(data) { // } // // 银行发起冲正银行转期货通知 // onRtnRepealFromBankToFutureByBank(data) { // } // // 银行发起冲正期货转银行通知 // onRtnRepealFromFutureToBankByBank(data) { // } // // 期货发起银行资金转期货通知 // onRtnFromBankToFutureByFuture(data) { // } // // 期货发起期货资金转银行通知 // onRtnFromFutureToBankByFuture(data) { // } // // 系统运行时期货端手工发起冲正银行转期货请求,银行处理完毕后报盘发回的通知 // onRtnRepealFromBankToFutureByFutureManual(data) { // } // // 系统运行时期货端手工发起冲正期货转银行请求,银行处理完毕后报盘发回的通知 // onRtnRepealFromFutureToBankByFutureManual(data) { // } // // 期货发起查询银行余额通知 // onRtnQueryBankBalanceByFuture(data) { // } // // 期货发起银行资金转期货错误回报 // onErrRtnBankToFutureByFuture(data, rsp) { // } // // 期货发起期货资金转银行错误回报 // onErrRtnFutureToBankByFuture(data, rsp) { // } // // 系统运行时期货端手工发起冲正银行转期货错误回报 // onErrRtnRepealBankToFutureByFutureManual(data, rsp) { // } // // 系统运行时期货端手工发起冲正期货转银行错误回报 // onErrRtnRepealFutureToBankByFutureManual(data, rsp) { // } // // 期货发起查询银行余额错误回报 // onErrRtnQueryBankBalanceByFuture(data, rsp) { // } // // 期货发起冲正银行转期货请求,银行处理完毕后报盘发回的通知 // onRtnRepealFromBankToFutureByFuture(data) { // } // // 期货发起冲正期货转银行请求,银行处理完毕后报盘发回的通知 // onRtnRepealFromFutureToBankByFuture(data) { // } // // 期货发起查询银行余额应答 // onRspQueryBankAccountMoneyByFuture(data, rsp, nReqId, bIsLast) { // } // // 银行发起银期开户通知 // onRtnOpenAccountByBank(data) { // } // // 银行发起银期销户通知 // onRtnCancelAccountByBank(data) { // } // // 银行发起变更银行账号通知 // onRtnChangeAccountByBank(data) { // } // // 查询用户当前支持的认证模式的回复 // onRspUserAuthMethod(data, rsp, nReqId, bIsLast) { // } // // 获取图形验证码请求的回复 // onRspGenUserCaptcha(data, rsp, nReqId, bIsLast) { // } // // 获取短信验证码请求的回复 // onRspGenUserText(data, rsp, nReqId, bIsLast) { // } // // 请求查询二级代理商信息响应 // onRspQrySecAgentTradeInfo(data, rsp, nReqId, bIsLast) { // } // // 请求查询资金账户响应 // onRspQrySecAgentTradingAccount(data, rsp, nReqId, bIsLast) { // } // // 请求查询二级代理商资金校验模式响应 // onRspQrySecAgentCheckMode(data, rsp, nReqId, bIsLast) { // } } module.exports = Trade;