Skip to content

Commit 9a09032

Browse files
committed
HLAPI QUOTE Complete Version
1 parent bc52090 commit 9a09032

17 files changed

Lines changed: 6339 additions & 309 deletions

Qubit_HL_Quote/dllmain.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// dllmain.cpp : Defines the entry point for the DLL application.
2+
#include "stdafx.h"
3+
#ifdef _X86_
4+
extern "C" { int _afxForceUSRDLL; }
5+
#else
6+
extern "C" { int __afxForceUSRDLL; }
7+
#endif
8+
9+
BOOL APIENTRY DllMain( HMODULE hModule,
10+
DWORD ul_reason_for_call,
11+
LPVOID lpReserved
12+
)
13+
{
14+
switch (ul_reason_for_call)
15+
{
16+
case DLL_PROCESS_ATTACH:
17+
case DLL_THREAD_ATTACH:
18+
case DLL_THREAD_DETACH:
19+
case DLL_PROCESS_DETACH:
20+
break;
21+
}
22+
return TRUE;
23+
}
24+

Qubit_HL_Quote/main.cpp

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#include "stdafx.h"
2+
#include "../include/ApiHeader.h"
3+
4+
#include "../include/QueueEnum.h"
5+
#include "Qubit_HL_Quote.h"
6+
7+
#include "../include/CrossPlatform.h"
8+
9+
inline CMdUserApi* GetApi(void* pApi)
10+
{
11+
return static_cast<CMdUserApi*>(pApi);
12+
}
13+
14+
void* __stdcall XRequest(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3)
15+
{
16+
RequestType rt = (RequestType)type;
17+
switch (rt)
18+
{
19+
case GetApiType:
20+
return (void*)(ApiType::MarketData | ApiType::QuoteRequest);
21+
case GetApiVersion:
22+
return (void*)"0.2.0.20150618";
23+
case GetApiName:
24+
return (void*)"CTP";
25+
case Create:
26+
return new CMdUserApi();
27+
default:
28+
break;
29+
}
30+
31+
if (pApi1 == nullptr)
32+
{
33+
return nullptr;
34+
}
35+
36+
CMdUserApi* pApi = GetApi(pApi1);
37+
38+
switch (rt)
39+
{
40+
case Release:
41+
delete pApi;
42+
return 0;
43+
case Register:
44+
pApi->Register(ptr1,ptr2);
45+
break;
46+
case Config:
47+
return (void*)pApi->Config((ConfigInfoField*)ptr1);
48+
case Connect:
49+
pApi->Connect((const char*)ptr3, (ServerInfoField*)ptr1, (UserInfoField*)ptr2,size2);
50+
break;
51+
case Disconnect:
52+
pApi->Disconnect();
53+
break;
54+
55+
case ReqCodeTable:
56+
pApi->ReqCodeTable((const char*)ptr1);
57+
break;
58+
//case Subscribe:
59+
// pApi->Subscribe((const char*)ptr1, (const char*)ptr2);
60+
// break;
61+
//case Unsubscribe:
62+
// pApi->Unsubscribe((const char*)ptr1, (const char*)ptr2);
63+
// break;
64+
//case SubscribeQuote:
65+
// pApi->SubscribeQuote((const char*)ptr1, (const char*)ptr2);
66+
// break;
67+
//case UnsubscribeQuote:
68+
// pApi->UnsubscribeQuote((const char*)ptr1, (const char*)ptr2);
69+
// break;
70+
default:
71+
break;
72+
}
73+
74+
return pApi1;
75+
}

include/HLAPI/ApiDataType.h

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
#ifndef _API_DATA_TYPE_H_
2+
#define _API_DATA_TYPE_H_
3+
4+
/////////////////////////////////////////////////////////////////////////
5+
///ErrorIDType是一个错误代码类型
6+
/////////////////////////////////////////////////////////////////////////
7+
typedef int ErrorIDType;
8+
9+
/////////////////////////////////////////////////////////////////////////
10+
///ErrorMsgType是一个错误信息类型
11+
/////////////////////////////////////////////////////////////////////////
12+
typedef char ErrorMsgType[256];
13+
14+
/////////////////////////////////////////////////////////////////////////
15+
///PriceType是一个价格类型
16+
/////////////////////////////////////////////////////////////////////////
17+
typedef double PriceType;
18+
19+
/////////////////////////////////////////////////////////////////////////
20+
///VolumeType是一个交易量类型
21+
/////////////////////////////////////////////////////////////////////////
22+
typedef int VolumeType;
23+
24+
/////////////////////////////////////////////////////////////////////////
25+
///QtyType是一个交易量类型
26+
/////////////////////////////////////////////////////////////////////////
27+
typedef double QtyType;
28+
29+
/////////////////////////////////////////////////////////////////////////
30+
///LargeVolumeType是一个大额数量类型
31+
/////////////////////////////////////////////////////////////////////////
32+
typedef double LargeVolumeType;
33+
34+
/////////////////////////////////////////////////////////////////////////
35+
///InstrumentIDType是一个合约代码类型
36+
/////////////////////////////////////////////////////////////////////////
37+
typedef char InstrumentIDType[31];
38+
39+
/////////////////////////////////////////////////////////////////////////
40+
///SymbolType是一个合约唯一符号类型
41+
/////////////////////////////////////////////////////////////////////////
42+
typedef char SymbolType[64];
43+
44+
/////////////////////////////////////////////////////////////////////////
45+
///DateTimeType是一个日期时间类型
46+
/////////////////////////////////////////////////////////////////////////
47+
typedef char DateTimeType[32];
48+
49+
/////////////////////////////////////////////////////////////////////////
50+
///ExchangeIDType是一个交易所代码类型
51+
/////////////////////////////////////////////////////////////////////////
52+
typedef char ExchangeIDType[9];
53+
54+
/////////////////////////////////////////////////////////////////////////
55+
///MoneyType是一个资金类型
56+
/////////////////////////////////////////////////////////////////////////
57+
typedef double MoneyType;
58+
59+
/////////////////////////////////////////////////////////////////////////
60+
///DateType是一个日期类型
61+
/////////////////////////////////////////////////////////////////////////
62+
typedef char DateType[9];
63+
typedef int DateIntType;
64+
65+
/////////////////////////////////////////////////////////////////////////
66+
///TimeType是一个时间类型
67+
/////////////////////////////////////////////////////////////////////////
68+
typedef char TimeType[9];
69+
typedef int TimeIntType;
70+
71+
/////////////////////////////////////////////////////////////////////////
72+
///UserIDType是一个用户代码类型
73+
/////////////////////////////////////////////////////////////////////////
74+
typedef char UserIDType[32];
75+
76+
///UserAccountNo是一个用户代码类型
77+
/////////////////////////////////////////////////////////////////////////
78+
typedef char UserAccountNoType[32];
79+
80+
/////////////////////////////////////////////////////////////////////////
81+
///TFtdcPasswordType是一个密码类型
82+
/////////////////////////////////////////////////////////////////////////
83+
typedef char PasswordType[41];
84+
85+
/////////////////////////////////////////////////////////////////////////
86+
///ProductInfoType是一个产品信息类型
87+
/////////////////////////////////////////////////////////////////////////
88+
typedef char ProductInfoType[11];
89+
90+
/////////////////////////////////////////////////////////////////////////
91+
///BrokerIDType是一个经纪公司代码类型
92+
/////////////////////////////////////////////////////////////////////////
93+
typedef char BrokerIDType[21];
94+
95+
/////////////////////////////////////////////////////////////////////////
96+
///AuthCodeType是一个客户端认证码类型
97+
/////////////////////////////////////////////////////////////////////////
98+
typedef char AuthCodeType[17];
99+
100+
/////////////////////////////////////////////////////////////////////////
101+
///AddressType是一个地址类型
102+
/////////////////////////////////////////////////////////////////////////
103+
typedef char AddressType[512];
104+
///ExtendInformationType是一个扩展信息类型
105+
/////////////////////////////////////////////////////////////////////////
106+
typedef char ExtendInformationType[128];
107+
/////////////////////////////////////////////////////////////////////////
108+
///VolumeMultipleType是一个合约数量乘数类型
109+
/////////////////////////////////////////////////////////////////////////
110+
typedef int VolumeMultipleType;
111+
112+
/////////////////////////////////////////////////////////////////////////
113+
///InstrumentNameType是一个合约名称类型
114+
/////////////////////////////////////////////////////////////////////////
115+
typedef char InstrumentNameType[31];
116+
117+
/////////////////////////////////////////////////////////////////////////
118+
///ContentType是一个消息正文类型
119+
/////////////////////////////////////////////////////////////////////////
120+
typedef char ContentType[501];
121+
122+
/////////////////////////////////////////////////////////////////////////
123+
///SessionIDType是一个会话编号类型
124+
/////////////////////////////////////////////////////////////////////////
125+
typedef char SessionIDType[32];
126+
127+
/////////////////////////////////////////////////////////////////////////
128+
///OrderIDType是一个订单唯一编号类型
129+
/////////////////////////////////////////////////////////////////////////
130+
typedef char OrderIDType[64];
131+
132+
/////////////////////////////////////////////////////////////////////////
133+
///TradeIDType是一个成交编号类型
134+
/////////////////////////////////////////////////////////////////////////
135+
typedef char TradeIDType[64];
136+
137+
/////////////////////////////////////////////////////////////////////////
138+
///PositionIDType是一个持仓编号类型
139+
/////////////////////////////////////////////////////////////////////////
140+
typedef char PositionIDType[64];
141+
142+
/////////////////////////////////////////////////////////////////////////
143+
///BarSizeType是一个BarSize类型
144+
/////////////////////////////////////////////////////////////////////////
145+
typedef long BarSizeType;
146+
147+
/////////////////////////////////////////////////////////////////////////
148+
///ReferIDType是一个请求ID回调索引值类型
149+
/////////////////////////////////////////////////////////////////////////
150+
typedef int ReferIDType;
151+
152+
/////////////////////////////////////////////////////////////////////////
153+
///BrokerIDType是一个经纪公司代码类型
154+
/////////////////////////////////////////////////////////////////////////
155+
typedef char ShareholderIDType[11];
156+
157+
typedef int SizeType;
158+
159+
#endif

0 commit comments

Comments
 (0)