Skip to content

Commit 42656fc

Browse files
committed
CTP升级成个股期权版
1 parent 5dcbdb9 commit 42656fc

19 files changed

Lines changed: 1536 additions & 157 deletions

QuantBox_CTP_Trade/TraderApi.cpp

Lines changed: 126 additions & 119 deletions
Large diffs are not rendered by default.

include/CTP/ThostFtdcTraderApi.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ class CThostFtdcTraderSpi
100100
///报价操作请求响应
101101
virtual void OnRspQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
102102

103+
///锁定应答
104+
virtual void OnRspLockInsert(CThostFtdcInputLockField *pInputLock, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
105+
103106
///申请组合录入请求响应
104107
virtual void OnRspCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
105108

@@ -196,6 +199,12 @@ class CThostFtdcTraderSpi
196199
///请求查询报价响应
197200
virtual void OnRspQryQuote(CThostFtdcQuoteField *pQuote, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
198201

202+
///请求查询锁定应答
203+
virtual void OnRspQryLock(CThostFtdcLockField *pLock, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
204+
205+
///请求查询锁定证券仓位应答
206+
virtual void OnRspQryLockPosition(CThostFtdcLockPositionField *pLockPosition, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
207+
199208
///请求查询组合合约安全系数响应
200209
virtual void OnRspQryCombInstrumentGuard(CThostFtdcCombInstrumentGuardField *pCombInstrumentGuard, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
201210

@@ -259,6 +268,12 @@ class CThostFtdcTraderSpi
259268
///保证金监控中心用户令牌
260269
virtual void OnRtnCFMMCTradingAccountToken(CThostFtdcCFMMCTradingAccountTokenField *pCFMMCTradingAccountToken) {};
261270

271+
///锁定通知
272+
virtual void OnRtnLock(CThostFtdcLockField *pLock) {};
273+
274+
///锁定错误通知
275+
virtual void OnErrRtnLockInsert(CThostFtdcInputLockField *pInputLock, CThostFtdcRspInfoField *pRspInfo) {};
276+
262277
///申请组合通知
263278
virtual void OnRtnCombAction(CThostFtdcCombActionField *pCombAction) {};
264279

@@ -474,6 +489,9 @@ class TRADER_API_EXPORT CThostFtdcTraderApi
474489
///报价操作请求
475490
virtual int ReqQuoteAction(CThostFtdcInputQuoteActionField *pInputQuoteAction, int nRequestID) = 0;
476491

492+
///锁定请求
493+
virtual int ReqLockInsert(CThostFtdcInputLockField *pInputLock, int nRequestID) = 0;
494+
477495
///申请组合录入请求
478496
virtual int ReqCombActionInsert(CThostFtdcInputCombActionField *pInputCombAction, int nRequestID) = 0;
479497

@@ -570,6 +588,12 @@ class TRADER_API_EXPORT CThostFtdcTraderApi
570588
///请求查询报价
571589
virtual int ReqQryQuote(CThostFtdcQryQuoteField *pQryQuote, int nRequestID) = 0;
572590

591+
///请求查询锁定
592+
virtual int ReqQryLock(CThostFtdcQryLockField *pQryLock, int nRequestID) = 0;
593+
594+
///请求查询锁定证券仓位
595+
virtual int ReqQryLockPosition(CThostFtdcQryLockPositionField *pQryLockPosition, int nRequestID) = 0;
596+
573597
///请求查询组合合约安全系数
574598
virtual int ReqQryCombInstrumentGuard(CThostFtdcQryCombInstrumentGuardField *pQryCombInstrumentGuard, int nRequestID) = 0;
575599

include/CTP/ThostFtdcUserApiDataType.h

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ typedef char TThostFtdcClientIDType[11];
7777
/////////////////////////////////////////////////////////////////////////
7878
typedef char TThostFtdcInstrumentIDType[31];
7979

80+
/////////////////////////////////////////////////////////////////////////
81+
///TFtdcInstrumentCodeType是一个合约标识码类型
82+
/////////////////////////////////////////////////////////////////////////
83+
typedef char TThostFtdcInstrumentCodeType[31];
84+
8085
/////////////////////////////////////////////////////////////////////////
8186
///TFtdcMarketIDType是一个市场代码类型
8287
/////////////////////////////////////////////////////////////////////////
@@ -393,6 +398,8 @@ typedef char TThostFtdcTraderConnectStatusType;
393398
#define THOST_FTDC_FC_SyncOTP 'E'
394399
///删除未知单
395400
#define THOST_FTDC_FC_DeleteOrder 'F'
401+
///锁定与解锁权限
402+
#define THOST_FTDC_FC_LockInsert 'G'
396403

397404
typedef char TThostFtdcFunctionCodeType;
398405

@@ -487,6 +494,8 @@ typedef char TThostFtdcFunctionCodeType;
487494
#define THOST_FTDC_BFC_ParkedOrderInsert 'K'
488495
///预埋报单操作
489496
#define THOST_FTDC_BFC_ParkedOrderAction 'L'
497+
///锁定与解锁权限
498+
#define THOST_FTDC_BFC_LockInsert 'M'
490499

491500
typedef char TThostFtdcBrokerFunctionCodeType;
492501

@@ -593,6 +602,10 @@ typedef char TThostFtdcTradingRoleType;
593602
#define THOST_FTDC_PC_EFP '5'
594603
///现货期权
595604
#define THOST_FTDC_PC_SpotOption '6'
605+
///个股期权
606+
#define THOST_FTDC_PC_ETFOption '7'
607+
///证券
608+
#define THOST_FTDC_PC_Stock '8'
596609

597610
typedef char TThostFtdcProductClassType;
598611

@@ -677,6 +690,8 @@ typedef char TThostFtdcRatioAttrType;
677690
#define THOST_FTDC_HF_Arbitrage '2'
678691
///套保
679692
#define THOST_FTDC_HF_Hedge '3'
693+
///备兑
694+
#define THOST_FTDC_HF_Covered '4'
680695

681696
typedef char TThostFtdcHedgeFlagType;
682697

@@ -1396,6 +1411,10 @@ typedef char TThostFtdcSystemParamIDType;
13961411
#define THOST_FTDC_TPID_LoginFailMaxNum 'L'
13971412
///是否强制认证
13981413
#define THOST_FTDC_TPID_IsAuthForce 'A'
1414+
///是否冻结证券持仓
1415+
#define THOST_FTDC_TPID_IsPosiFreeze 'F'
1416+
///是否限仓
1417+
#define THOST_FTDC_TPID_IsPosiLimit 'M'
13991418

14001419
typedef char TThostFtdcTradeParamIDType;
14011420

@@ -2181,6 +2200,11 @@ typedef char TThostFtdcCapitalCurrencyType[4];
21812200

21822201
typedef char TThostFtdcUserTypeType;
21832202

2203+
/////////////////////////////////////////////////////////////////////////
2204+
///TFtdcBranchIDType是一个营业部编号类型
2205+
/////////////////////////////////////////////////////////////////////////
2206+
typedef char TThostFtdcBranchIDType[9];
2207+
21842208
/////////////////////////////////////////////////////////////////////////
21852209
///TFtdcRateTypeType是一个费率类型类型
21862210
/////////////////////////////////////////////////////////////////////////
@@ -2775,6 +2799,31 @@ typedef char TThostFtdcCFMMCKeyKindType;
27752799
/////////////////////////////////////////////////////////////////////////
27762800
typedef char TThostFtdcAMLReportNameType[81];
27772801

2802+
/////////////////////////////////////////////////////////////////////////
2803+
///TFtdcDBFComdTypeType是一个DBF命令类型类型
2804+
/////////////////////////////////////////////////////////////////////////
2805+
typedef char TThostFtdcDBFComdTypeType[65];
2806+
2807+
/////////////////////////////////////////////////////////////////////////
2808+
///TFtdcDBFComTimeType是一个DBF时间类型类型
2809+
/////////////////////////////////////////////////////////////////////////
2810+
typedef char TThostFtdcDBFComTimeType[65];
2811+
2812+
/////////////////////////////////////////////////////////////////////////
2813+
///TFtdcDBFComNoType是一个DBF流水号类型类型
2814+
/////////////////////////////////////////////////////////////////////////
2815+
typedef char TThostFtdcDBFComNoType[17];
2816+
2817+
/////////////////////////////////////////////////////////////////////////
2818+
///TFtdcDBFFdNameType是一个DBF字段类型类型
2819+
/////////////////////////////////////////////////////////////////////////
2820+
typedef char TThostFtdcDBFFdNameType[256];
2821+
2822+
/////////////////////////////////////////////////////////////////////////
2823+
///TFtdcDBFFdContentType是一个DBF字段内容类型类型
2824+
/////////////////////////////////////////////////////////////////////////
2825+
typedef char TThostFtdcDBFFdContentType[256];
2826+
27782827
/////////////////////////////////////////////////////////////////////////
27792828
///TFtdcIndividualNameType是一个个人姓名类型
27802829
/////////////////////////////////////////////////////////////////////////
@@ -6273,4 +6322,99 @@ typedef char TThostFtdcCFFEXUploadFileNameType;
62736322

62746323
typedef char TThostFtdcCombDirectionType;
62756324

6325+
/////////////////////////////////////////////////////////////////////////
6326+
///TFtdcLockTypeType是一个锁定方向类型
6327+
/////////////////////////////////////////////////////////////////////////
6328+
///锁定
6329+
#define THOST_FTDC_LCKT_Lock '1'
6330+
///解锁
6331+
#define THOST_FTDC_LCKT_Unlock '2'
6332+
6333+
typedef char TThostFtdcLockTypeType;
6334+
6335+
/////////////////////////////////////////////////////////////////////////
6336+
///TFtdcBizTypeType是一个业务类型类型
6337+
/////////////////////////////////////////////////////////////////////////
6338+
///期货
6339+
#define THOST_FTDC_BZTP_Future '1'
6340+
///证券
6341+
#define THOST_FTDC_BZTP_Stock '2'
6342+
6343+
typedef char TThostFtdcBizTypeType;
6344+
6345+
/////////////////////////////////////////////////////////////////////////
6346+
///TFtdcDesignateTypeType是一个指定类型类型
6347+
/////////////////////////////////////////////////////////////////////////
6348+
///指定登记
6349+
#define THOST_FTDC_DSTP_Register '1'
6350+
///指定撤销
6351+
#define THOST_FTDC_DSTP_Cancel '2'
6352+
6353+
typedef char TThostFtdcDesignateTypeType;
6354+
6355+
/////////////////////////////////////////////////////////////////////////
6356+
///TFtdcFreezeReasonTypeType是一个冻结原因类型
6357+
/////////////////////////////////////////////////////////////////////////
6358+
///初始化
6359+
#define THOST_FTDC_FRTP_Init '1'
6360+
///锁定
6361+
#define THOST_FTDC_FRTP_Lock '2'
6362+
///执行
6363+
#define THOST_FTDC_FRTP_Exec '3'
6364+
6365+
typedef char TThostFtdcFreezeReasonTypeType;
6366+
6367+
/////////////////////////////////////////////////////////////////////////
6368+
///TFtdcFreezeTypeType是一个冻结类型类型
6369+
/////////////////////////////////////////////////////////////////////////
6370+
///冻结
6371+
#define THOST_FTDC_FZTP_Freeze '1'
6372+
///解冻
6373+
#define THOST_FTDC_FZTP_Unfreeze '2'
6374+
///强制执行
6375+
#define THOST_FTDC_FZTP_Force '3'
6376+
6377+
typedef char TThostFtdcFreezeTypeType;
6378+
6379+
/////////////////////////////////////////////////////////////////////////
6380+
///TFtdcTradeSystemTypeType是一个交易系统类型类型
6381+
/////////////////////////////////////////////////////////////////////////
6382+
///未知系统
6383+
#define THOST_FTDC_TSTP_Unknow '0'
6384+
///期货系统
6385+
#define THOST_FTDC_TSTP_Future '1'
6386+
///个股系统
6387+
#define THOST_FTDC_TSTP_IShare '2'
6388+
6389+
typedef char TThostFtdcTradeSystemTypeType;
6390+
6391+
/////////////////////////////////////////////////////////////////////////
6392+
///TFtdcStockDisposalTypeType是一个证券处置方向类型
6393+
/////////////////////////////////////////////////////////////////////////
6394+
///划入经纪公司账户
6395+
#define THOST_FTDC_STPT_ToBroker '1'
6396+
///划入投资者账户
6397+
#define THOST_FTDC_STPT_ToInvestor '2'
6398+
6399+
typedef char TThostFtdcStockDisposalTypeType;
6400+
6401+
/////////////////////////////////////////////////////////////////////////
6402+
///TFtdcStockDisposalSysIDType是一个证券处置编号类型
6403+
/////////////////////////////////////////////////////////////////////////
6404+
typedef char TThostFtdcStockDisposalSysIDType[21];
6405+
6406+
/////////////////////////////////////////////////////////////////////////
6407+
///TFtdcStockDisposalStatusType是一个报单操作状态类型
6408+
/////////////////////////////////////////////////////////////////////////
6409+
///已经提交
6410+
#define THOST_FTDC_SDPS_Submitted 'a'
6411+
///已经接受
6412+
#define THOST_FTDC_SDPS_Accepted 'b'
6413+
///已经被拒绝
6414+
#define THOST_FTDC_SDPS_Rejected 'c'
6415+
///已经被撤销
6416+
#define THOST_FTDC_SDPS_Cancelled 'd'
6417+
6418+
typedef char TThostFtdcStockDisposalStatusType;
6419+
62766420
#endif

0 commit comments

Comments
 (0)