diff --git a/QuantBox_CTP_Quote/QuantBox_CTP_Quote.vcxproj b/QuantBox_CTP_Quote/QuantBox_CTP_Quote.vcxproj index 4cf345a..4a78ef8 100644 --- a/QuantBox_CTP_Quote/QuantBox_CTP_Quote.vcxproj +++ b/QuantBox_CTP_Quote/QuantBox_CTP_Quote.vcxproj @@ -94,7 +94,7 @@ true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\CTP\x86 + ..\bin true diff --git a/QuantBox_CTP_Trade/QuantBox_CTP_Trade.vcxproj b/QuantBox_CTP_Trade/QuantBox_CTP_Trade.vcxproj index fa3fed2..3bc056e 100644 --- a/QuantBox_CTP_Trade/QuantBox_CTP_Trade.vcxproj +++ b/QuantBox_CTP_Trade/QuantBox_CTP_Trade.vcxproj @@ -94,7 +94,7 @@ true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\CTP\x86 + ..\bin true diff --git a/QuantBox_KingstarStock_Trade/QuantBox_KingstarStock_Trade.vcxproj b/QuantBox_KingstarStock_Trade/QuantBox_KingstarStock_Trade.vcxproj index 46072b1..226460a 100644 --- a/QuantBox_KingstarStock_Trade/QuantBox_KingstarStock_Trade.vcxproj +++ b/QuantBox_KingstarStock_Trade/QuantBox_KingstarStock_Trade.vcxproj @@ -70,7 +70,7 @@ xcopy "$(SolutionDir)include\Kingstar_Stock\win32\*.dll" "$(SolutionDir)XAPI\Ki MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;QUANTBOX_KINGSTARSTOCK_TRADE_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;QUANTBOX_KINGSTARSTOCK_TRADE_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true diff --git a/QuantBox_LTS_Trade/QuantBox_LTS_Trade.vcxproj b/QuantBox_LTS_Trade/QuantBox_LTS_Trade.vcxproj index d974675..d7405a1 100644 --- a/QuantBox_LTS_Trade/QuantBox_LTS_Trade.vcxproj +++ b/QuantBox_LTS_Trade/QuantBox_LTS_Trade.vcxproj @@ -75,7 +75,7 @@ true - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\LTS\x86 + $(SolutionDir)$(Configuration)\ true diff --git a/QuantBox_Queue/ArrayLockFreeQueue.h b/QuantBox_Queue/ArrayLockFreeQueue.h index 4ed39b1..a4b749d 100644 --- a/QuantBox_Queue/ArrayLockFreeQueue.h +++ b/QuantBox_Queue/ArrayLockFreeQueue.h @@ -31,6 +31,7 @@ class ArrayLockFreeQueue ELEM_T m_thequeue[Q_SIZE]; + volatile QUEUE_INT m_count; volatile QUEUE_INT m_writeIndex; diff --git a/QuantBox_Queue/ArrayLockFreeQueueImp.h b/QuantBox_Queue/ArrayLockFreeQueueImp.h index 9493003..f4366fb 100644 --- a/QuantBox_Queue/ArrayLockFreeQueueImp.h +++ b/QuantBox_Queue/ArrayLockFreeQueueImp.h @@ -28,6 +28,7 @@ inline QUEUE_INT ArrayLockFreeQueue::countToIndex(QUEUE_INT a_co return (a_count % Q_SIZE); } + template QUEUE_INT ArrayLockFreeQueue::size() { @@ -76,6 +77,7 @@ bool ArrayLockFreeQueue::try_dequeue(ELEM_T &a_data) return dequeue(a_data); } + template bool ArrayLockFreeQueue::dequeue(ELEM_T &a_data) { diff --git a/QuantBox_Queue/MsgQueue.cpp b/QuantBox_Queue/MsgQueue.cpp index 50df4a4..14e563f 100644 --- a/QuantBox_Queue/MsgQueue.cpp +++ b/QuantBox_Queue/MsgQueue.cpp @@ -1,7 +1,8 @@ #include "stdafx.h" #include "MsgQueue.h" -CMsgQueue::CMsgQueue()//:m_queue(1024) +//CMsgQueue::CMsgQueue():m_queue(1024) +CMsgQueue::CMsgQueue() { m_hThread = nullptr; m_bRunning = false; diff --git a/QuantBox_Queue/QuantBox_Queue.vcxproj b/QuantBox_Queue/QuantBox_Queue.vcxproj index b497faf..9d525b7 100644 --- a/QuantBox_Queue/QuantBox_Queue.vcxproj +++ b/QuantBox_Queue/QuantBox_Queue.vcxproj @@ -94,8 +94,8 @@ true + ..\bin QuantBox_Queue_x86 - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\LTS\x86 true @@ -114,7 +114,7 @@ false QuantBox_Queue_x86 - C:\Program Files\SmartQuant Ltd\OpenQuant 2014\XAPI\TongShi\x86 + $(SolutionDir)$(Configuration)\ false @@ -194,7 +194,7 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;BUILDING_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true @@ -233,6 +233,9 @@ + + + diff --git a/QuantBox_Queue/QuantBox_Queue.vcxproj.filters b/QuantBox_Queue/QuantBox_Queue.vcxproj.filters index f77e535..6b0fe4d 100644 --- a/QuantBox_Queue/QuantBox_Queue.vcxproj.filters +++ b/QuantBox_Queue/QuantBox_Queue.vcxproj.filters @@ -48,6 +48,15 @@ Header Files + + Header Files + + + Header Files + + + Header Files + diff --git a/QuantBox_Queue/atom_opt.h b/QuantBox_Queue/atom_opt.h index 149b3a7..f1a5891 100644 --- a/QuantBox_Queue/atom_opt.h +++ b/QuantBox_Queue/atom_opt.h @@ -7,7 +7,6 @@ #define AtomicSub(a_ptr,a_count) __sync_fetch_and_sub (a_ptr, a_count) #include // sched_yield() #else - #include #ifdef _WIN64 #define CAS(a_ptr, a_oldVal, a_newVal) (a_oldVal == InterlockedCompareExchange64(a_ptr, a_newVal, a_oldVal)) diff --git a/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.vcxproj b/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.vcxproj index ba0ee99..62948c7 100644 --- a/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.vcxproj +++ b/QuantBox_TongShi_Quote/QuantBox_TongShi_Quote.vcxproj @@ -81,7 +81,7 @@ MaxSpeed true true - WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) + WIN32;_WINDOWS;NDEBUG;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true @@ -89,7 +89,8 @@ true true true - .\QuantBox_TongShi_Quote.def + + false diff --git a/QuantBox_XAPI/QuantBox_XAPI.vcxproj b/QuantBox_XAPI/QuantBox_XAPI.vcxproj index 4057688..6be678c 100644 --- a/QuantBox_XAPI/QuantBox_XAPI.vcxproj +++ b/QuantBox_XAPI/QuantBox_XAPI.vcxproj @@ -69,7 +69,7 @@ MaxSpeed true true - WIN32;NDEBUG;_WINDOWS;_USRDLL;QUANTBOX_XAPI_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;QUANTBOX_XAPI_EXPORTS;_CRT_SECURE_NO_WARNINGS;BUILDING_DLL;%(PreprocessorDefinitions) true diff --git a/QuantBox_XAPI_TEST/QuantBox_XAPI_TEST.cpp b/QuantBox_XAPI_TEST/QuantBox_XAPI_TEST.cpp index 6c7798f..aba3041 100644 --- a/QuantBox_XAPI_TEST/QuantBox_XAPI_TEST.cpp +++ b/QuantBox_XAPI_TEST/QuantBox_XAPI_TEST.cpp @@ -44,9 +44,9 @@ class CXSpiImpl :public CXSpi int x = mon + i; int a = x / 12; int b = x % 12; - sprintf(buf, "IF%d%02d", (1900 + timeinfo->tm_year + a) % 100, b + 1); + sprintf(buf, "au%d%02d", (1900 + timeinfo->tm_year + a) % 100, b + 1); pApi->Subscribe(buf, ""); - sprintf(buf, "TF%d%02d", (1900 + timeinfo->tm_year + a) % 100, b + 1); + sprintf(buf, "ag%d%02d", (1900 + timeinfo->tm_year + a) % 100, b + 1); pApi->Subscribe(buf, ""); } } @@ -252,7 +252,8 @@ int main_4(int argc, char* argv[]) { CXSpiImpl* p = new CXSpiImpl(); #if defined WINDOWS || _WIN32 - char DLLPath1[250] = "C:\\Program Files\\SmartQuant Ltd\\OpenQuant 2014\\XAPI\\CTP\\x86\\QuantBox_CTP_Quote.dll"; + //char DLLPath1[250] = "C:\\Program Files\\SmartQuant Ltd\\OpenQuant 2014\\XAPI\\CTP\\x86\\QuantBox_CTP_Quote.dll"; + char DLLPath1[250] = ".\\QuantBox_CTP_Quote.dll"; #else char DLLPath1[250] = "libQuantBox_CTP_Quote.so"; #endif @@ -298,4 +299,4 @@ int main_4(int argc, char* argv[]) } return 0; -} \ No newline at end of file +} diff --git a/QuantBox_XAPI_TEST/QuantBox_XAPI_TEST.vcxproj b/QuantBox_XAPI_TEST/QuantBox_XAPI_TEST.vcxproj index fbd5aa9..b2bb13e 100644 --- a/QuantBox_XAPI_TEST/QuantBox_XAPI_TEST.vcxproj +++ b/QuantBox_XAPI_TEST/QuantBox_XAPI_TEST.vcxproj @@ -65,7 +65,7 @@ MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true diff --git a/QuantBox_XAPI_Windows.sln b/QuantBox_XAPI_Windows.sln index 198ac46..cab8055 100644 --- a/QuantBox_XAPI_Windows.sln +++ b/QuantBox_XAPI_Windows.sln @@ -53,6 +53,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_XAPI", "QuantBox_X EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "QuantBox_XAPI_TEST", "QuantBox_XAPI_TEST\QuantBox_XAPI_TEST.vcxproj", "{C77ADBF7-E610-4E57-BE4D-C122FC5BE611}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Qubit_HL_Quote", "Qubit_HL_Quote\Qubit_HL_Quote.vcxproj", "{BE164B27-EC28-4B7A-89C4-0B7EA38F8846}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -525,6 +527,24 @@ Global {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release|Win32.ActiveCfg = Release|Win32 {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release|Win32.Build.0 = Release|Win32 {C77ADBF7-E610-4E57-BE4D-C122FC5BE611}.Release|x64.ActiveCfg = Release|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Debug|Win32.ActiveCfg = Debug|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Debug|Win32.Build.0 = Debug|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Debug|x64.ActiveCfg = Debug|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Debug64|Any CPU.ActiveCfg = Debug|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Debug64|Mixed Platforms.ActiveCfg = Debug|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Debug64|Mixed Platforms.Build.0 = Debug|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Debug64|Win32.ActiveCfg = Debug|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Debug64|Win32.Build.0 = Debug|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Debug64|x64.ActiveCfg = Debug|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Release|Any CPU.ActiveCfg = Release|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Release|Mixed Platforms.Build.0 = Release|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Release|Win32.ActiveCfg = Release|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Release|Win32.Build.0 = Release|Win32 + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Qubit_HL_Quote/Qubit_HL_Quote.cpp b/Qubit_HL_Quote/Qubit_HL_Quote.cpp new file mode 100644 index 0000000..11615f0 --- /dev/null +++ b/Qubit_HL_Quote/Qubit_HL_Quote.cpp @@ -0,0 +1,405 @@ +// Qubit_HL_Quote.cpp : 定义 DLL 的初始化例程。 +// + +#include "stdafx.h" +#include "Qubit_HL_Quote.h" +#include "../include/QueueEnum.h" + +#include "../include/ApiHeader.h" +#include "../include/ApiStruct.h" + +#include "../include/toolkit.h" + +#include "../QuantBox_Queue/MsgQueue.h" +#ifdef _REMOTE +#include "../QuantBox_Queue/RemoteQueue.h" +#endif + +#include +#include + +#include +#include +using namespace std; + +void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + // 由内部调用,不用检查是否为空 + CMdUserApi* pApi = (CMdUserApi*)pApi2; + pApi->QueryInThread(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + return nullptr; +} + +CMdUserApi::CMdUserApi(void) +{ + m_pApi = nullptr; + m_lRequestID = 0; + m_nSleep = 1; + + // 自己维护两个消息队列 + m_msgQueue = new CMsgQueue(); + m_msgQueue_Query = new CMsgQueue(); + + m_msgQueue_Query->Register((void*)Query, this); + m_msgQueue_Query->StartThread(); + + //m_msgQueue->m_bDirectOutput = true; + + m_remoteQueue = nullptr; +} + +CMdUserApi::~CMdUserApi(void) +{ + Disconnect(); +} + +void CMdUserApi::QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + int iRet = 0; + switch (type) + { + case E_Init: + iRet = _Init(); + break; + case E_ReqUserLoginField: + iRet = _ReqUserLogin(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + break; + default: + break; + } + + if (0 == iRet) + { + //返回成功,填加到已发送池 + m_nSleep = 1; + } + else + { + m_msgQueue_Query->Input_Copy(type, pApi1, pApi2, double1, double2, ptr1, size1, ptr2, size2, ptr3, size3); + //失败,按4的幂进行延时,但不超过1s + m_nSleep *= 4; + m_nSleep %= 1023; + } + this_thread::sleep_for(chrono::milliseconds(m_nSleep)); +} + +void CMdUserApi::Register(void* pCallback, void* pClass) +{ + m_pClass = pClass; + if (m_msgQueue == nullptr) + return; + + m_msgQueue_Query->Register((void*)Query, this); + m_msgQueue->Register(pCallback, this); + if (pCallback) + { + m_msgQueue_Query->StartThread(); + m_msgQueue->StartThread(); + } + else + { + m_msgQueue_Query->StopThread(); + m_msgQueue->StopThread(); + } +} + +ConfigInfoField* CMdUserApi::Config(ConfigInfoField* pConfigInfo) +{ + return nullptr; +} + +void CMdUserApi::Connect(const string& szPath, + ServerInfoField* pServerInfo, + UserInfoField* pUserInfo, + int count) +{ + m_szPath = szPath; + memcpy(&m_ServerInfo, pServerInfo, sizeof(ServerInfoField)); + memcpy(&m_UserInfo, pUserInfo, sizeof(UserInfoField)); + + m_msgQueue_Query->Input_NoCopy(RequestType::E_Init, m_msgQueue_Query, this, 0, 0, + nullptr, 0, nullptr, 0, nullptr, 0); + +#ifdef _REMOTE + // 将收到的行情通过ZeroMQ发送出去 + if (strlen(m_ServerInfo.ExtendInformation) > 0) + { + m_remoteQueue = new CRemoteQueue(m_ServerInfo.ExtendInformation); + m_remoteQueue->StartThread(); + } +#endif +} + +int CMdUserApi::_Init() +{ + //sprintf(pszPath, "%s/%s/%s/Md/%d/", m_szPath.c_str(), m_ServerInfo.BrokerID, m_UserInfo.UserID, rand()); + //makedirs(pszPath); + + m_pApi = HLQuoteApi::CreateHLQuoteApi(); + + m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Initialized, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + if (m_pApi) + { + m_pApi->RegisterSpi(this); + + //添加地址 + size_t len = strlen(m_ServerInfo.Address) + 1; + char* buf = new char[len]; + strncpy(buf, m_ServerInfo.Address, len); + + char* token = strtok(buf, _QUANTBOX_SEPS_); + while (token) + { + if (strlen(token)>0) + { + m_pApi->RegisterNetwork(m_ServerInfo.Port, token); + } + token = strtok(NULL, _QUANTBOX_SEPS_); + } + delete[] buf; + + //初始化连接 + m_pApi->Init(); + m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Connecting, 0, nullptr, 0, nullptr, 0, nullptr, 0); + } + + return 0; +} + +void CMdUserApi::ReqUserLogin() +{ + HLApiReqUserLoginData* pBody = (HLApiReqUserLoginData*)m_msgQueue_Query->new_block(sizeof(HLApiReqUserLoginData)); + + strncpy(pBody->chClientID, m_UserInfo.UserID, sizeof(pBody->chClientID)); + strncpy(pBody->chPassword, m_UserInfo.Password, sizeof(pBody->chPassword)); + + m_msgQueue_Query->Input_NoCopy(RequestType::E_ReqUserLoginField, m_msgQueue_Query, this, 0, 0, + pBody, sizeof(HLApiReqUserLoginData), nullptr, 0, nullptr, 0); +} + +int CMdUserApi::_ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3) +{ + m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Logining, 0, nullptr, 0, nullptr, 0, nullptr, 0); + return m_pApi->ReqUserLogin((HLApiReqUserLoginData*)ptr1, ++m_lRequestID); +} + +void CMdUserApi::Disconnect() +{ + // 清理查询队列 + if (m_msgQueue_Query) + { + m_msgQueue_Query->StopThread(); + m_msgQueue_Query->Register(nullptr, nullptr); + m_msgQueue_Query->Clear(); + delete m_msgQueue_Query; + m_msgQueue_Query = nullptr; + } + + if (m_pApi) + { + m_pApi->RegisterSpi(NULL); + m_pApi->Release(); + m_pApi = NULL; + + // 全清理,只留最后一个 + m_msgQueue->Clear(); + m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + // 主动触发 + m_msgQueue->Process(); + } + + // 清理响应队列 + if (m_msgQueue) + { + m_msgQueue->StopThread(); + m_msgQueue->Register(nullptr, nullptr); + m_msgQueue->Clear(); + delete m_msgQueue; + m_msgQueue = nullptr; + } + + // 清理队列 + if (m_remoteQueue) + { + m_remoteQueue->StopThread(); + m_remoteQueue->Register(nullptr, nullptr); + m_remoteQueue->Clear(); + delete m_remoteQueue; + m_remoteQueue = nullptr; + } +} + + +void CMdUserApi::OnFrontConnected() +{ + m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Connected, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + //连接成功后自动请求登录 + ReqUserLogin(); +} + +void CMdUserApi::OnFrontDisconnected(int nReason) +{ + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + //连接失败返回的信息是拼接而成,主要是为了统一输出 + pField->ErrorID = nReason; + GetOnFrontDisconnectedMsg(nReason, pField->ErrorMsg); + + m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); +} + +void CMdUserApi::OnRspUserLogin(HLApiRspUserLoginData *pRspUserLogin, CHLRspInfoData *pRspInfo, int nRequestID, char cIsLast) +{ + RspUserLoginField* pField = (RspUserLoginField*)m_msgQueue->new_block(sizeof(RspUserLoginField)); + + if (pRspInfo->ErrorID == 0) + { + pField->TradingDay = GetDate(pRspUserLogin->chTradingDay); + pField->LoginTime = GetTime(pRspUserLogin->chLoginTime); + + sprintf_s(pField->SessionID, "%d", pRspUserLogin->nSessionID); + + m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Logined, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Done, 0, nullptr, 0, nullptr, 0, nullptr, 0); + + HLApiReqCodeTable req = { 0 }; + for (int i = 0; i < pRspUserLogin->nMarkets; i++) + { + //req.nDate = pRspUserLogin->nDynDate[i]; + memcpy(req.chMarket, pRspUserLogin->chMarketFlag + i, API_MARKET_LEN); + m_pApi->ReqCodeTable(&req, ++m_lRequestID); + } + } + else + { + pField->ErrorID = pRspInfo->ErrorID; + strncpy(pField->ErrorMsg, pRspInfo->ErrorMsg, sizeof(ErrorMsgType)); + + m_msgQueue->Input_NoCopy(ResponeType::OnConnectionStatus, m_msgQueue, m_pClass, ConnectionStatus::Disconnected, 0, pField, sizeof(RspUserLoginField), nullptr, 0, nullptr, 0); + } +} + +void CMdUserApi::OnRspCodeTable(HLApiRspCodeTable *pRspCodeTable, CHLRspInfoData *pRspInfo, int nRequestID, char cIsLast) +{ + HLApiReqMarketData data = { 0 }; + strncpy(data.chMarket, pRspCodeTable->chMarketFlag, sizeof (data.chMarket)); + m_pApi->ReqMarketData(&data, ++m_lRequestID); +} + +//行情回调,得保证此函数尽快返回 +void CMdUserApi::OnRtnMarketData(HLApiMarketData *pMarketData, int nSize) +{ + //for (int i = 0; i < 50; ++i) + //{ + // // 测试平台穿越速度,用完后需要注释掉 + // WriteLog("CTP:OnRtnDepthMarketData:%s %f %s.%03d", pDepthMarketData->InstrumentID, pDepthMarketData->LastPrice, pDepthMarketData->UpdateTime, pDepthMarketData->UpdateMillisec); + + DepthMarketDataField* pField = (DepthMarketDataField*)m_msgQueue->new_block(sizeof(DepthMarketDataField)); + + + sprintf(pField->Symbol, "%s.%s", pField->InstrumentID, pField->ExchangeID); + + //TODO:CTP大连没有ActionDay,所以API中是将TradingDay填到了这里,所以这里这种用法可能会出错,要测 + GetExchangeTime(pDepthMarketData->TradingDay, pDepthMarketData->ActionDay, pDepthMarketData->UpdateTime + , &pField->TradingDay, &pField->ActionDay, &pField->UpdateTime, &pField->UpdateMillisec); + + pField->UpdateMillisec = pDepthMarketData->UpdateMillisec; + + pField->LastPrice = pDepthMarketData->LastPrice == DBL_MAX ? 0 : pDepthMarketData->LastPrice; + pField->Volume = pDepthMarketData->Volume; + pField->Turnover = pDepthMarketData->Turnover; + pField->OpenInterest = pDepthMarketData->OpenInterest; + pField->AveragePrice = pDepthMarketData->AveragePrice; + + if (pDepthMarketData->OpenPrice != DBL_MAX) + { + pField->OpenPrice = pDepthMarketData->OpenPrice; + pField->HighestPrice = pDepthMarketData->HighestPrice; + pField->LowestPrice = pDepthMarketData->LowestPrice; + } + else + { + pField->OpenPrice = 0; + pField->HighestPrice = 0; + pField->LowestPrice = 0; + } + pField->SettlementPrice = pDepthMarketData->SettlementPrice != DBL_MAX ? pDepthMarketData->SettlementPrice : 0; + + pField->UpperLimitPrice = pDepthMarketData->UpperLimitPrice; + pField->LowerLimitPrice = pDepthMarketData->LowerLimitPrice; + pField->PreClosePrice = pDepthMarketData->PreClosePrice; + pField->PreSettlementPrice = pDepthMarketData->PreSettlementPrice; + pField->PreOpenInterest = pDepthMarketData->PreOpenInterest; + + do + { + if (pDepthMarketData->BidVolume1 == 0) + break; + pField->BidPrice1 = pDepthMarketData->BidPrice1; + pField->BidVolume1 = pDepthMarketData->BidVolume1; + + if (pDepthMarketData->BidVolume2 == 0) + break; + pField->BidPrice2 = pDepthMarketData->BidPrice2; + pField->BidVolume2 = pDepthMarketData->BidVolume2; + + if (pDepthMarketData->BidVolume3 == 0) + break; + pField->BidPrice3 = pDepthMarketData->BidPrice3; + pField->BidVolume3 = pDepthMarketData->BidVolume3; + + if (pDepthMarketData->BidVolume4 == 0) + break; + pField->BidPrice4 = pDepthMarketData->BidPrice4; + pField->BidVolume4 = pDepthMarketData->BidVolume4; + + if (pDepthMarketData->BidVolume5 == 0) + break; + pField->BidPrice5 = pDepthMarketData->BidPrice5; + pField->BidVolume5 = pDepthMarketData->BidVolume5; + } while (false); + + do + { + if (pDepthMarketData->AskVolume1 == 0) + break; + pField->AskPrice1 = pDepthMarketData->AskPrice1; + pField->AskVolume1 = pDepthMarketData->AskVolume1; + + if (pDepthMarketData->AskVolume2 == 0) + break; + pField->AskPrice2 = pDepthMarketData->AskPrice2; + pField->AskVolume2 = pDepthMarketData->AskVolume2; + + if (pDepthMarketData->AskVolume3 == 0) + break; + pField->AskPrice3 = pDepthMarketData->AskPrice3; + pField->AskVolume3 = pDepthMarketData->AskVolume3; + + if (pDepthMarketData->AskVolume4 == 0) + break; + pField->AskPrice4 = pDepthMarketData->AskPrice4; + pField->AskVolume4 = pDepthMarketData->AskVolume4; + + if (pDepthMarketData->AskVolume5 == 0) + break; + pField->AskPrice5 = pDepthMarketData->AskPrice5; + pField->AskVolume5 = pDepthMarketData->AskVolume5; + } while (false); + + // 这两个队列先头循序不要搞混,有删除功能的语句要放在后面 + // 如果放前面,会导致远程收到乱码 +#ifdef _REMOTE + if (m_remoteQueue) + { + m_remoteQueue->Input_Copy(ResponeType::OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, sizeof(DepthMarketDataField), nullptr, 0, nullptr, 0); + } +#endif + + m_msgQueue->Input_NoCopy(ResponeType::OnRtnDepthMarketData, m_msgQueue, m_pClass, 0, 0, pField, sizeof(DepthMarketDataField), nullptr, 0, nullptr, 0); + // 要关注一下其内的 + //} +} + + diff --git a/Qubit_HL_Quote/Qubit_HL_Quote.def b/Qubit_HL_Quote/Qubit_HL_Quote.def new file mode 100644 index 0000000..f79f590 --- /dev/null +++ b/Qubit_HL_Quote/Qubit_HL_Quote.def @@ -0,0 +1,6 @@ +; Qubit_HL_Quote.def : 声明 DLL 的模块参数。 + +LIBRARY + +EXPORTS + ; 此处可以是显式导出 diff --git a/Qubit_HL_Quote/Qubit_HL_Quote.h b/Qubit_HL_Quote/Qubit_HL_Quote.h new file mode 100644 index 0000000..4fab409 --- /dev/null +++ b/Qubit_HL_Quote/Qubit_HL_Quote.h @@ -0,0 +1,126 @@ +// Qubit_HL_Quote.h : Qubit_HL_Quote DLL 的主头文件 +// + +#pragma once + +#ifndef __AFXWIN_H__ + #error "在包含此文件之前包含“stdafx.h”以生成 PCH 文件" +#endif + +#include "resource.h" // 主符号 + + +// CQubit_HL_QuoteApp +// 有关此类实现的信息,请参阅 Qubit_HL_Quote.cpp +// + +#pragma once + +#include "../include/ApiStruct.h" +#include "../include/HLAPI/HLQuoteApi.h" + +#pragma comment(lib, "../include/HLAPI/HLQuoteApi.lib") +#pragma comment(lib, "../lib/QuantBox_Queue_x86.lib") + +#include +#include +#include +#include + +using namespace std; + +class CMsgQueue; + +class CMdUserApi : + public HLQuoteSpi +{ + enum RequestType + { + E_Init, + E_ReqUserLoginField, + }; + +public: + CMdUserApi(void); + virtual ~CMdUserApi(void); + + void Register(void* pCallback, void* pClass); + ConfigInfoField* Config(ConfigInfoField* pConfigInfo); + + void Connect(const string& szPath, + ServerInfoField* pServerInfo, + UserInfoField* pUserInfo, + int count); + void Disconnect(); + + void Subscribe(const string& szInstrumentIDs, const string& szExchageID); + void Unsubscribe(const string& szInstrumentIDs, const string& szExchageID); + + void SubscribeQuote(const string& szInstrumentIDs, const string& szExchageID); + void UnsubscribeQuote(const string& szInstrumentIDs, const string& szExchageID); + +private: + friend void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + void QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + int _Init(); + //登录请求 + void ReqUserLogin(); + int _ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + //订阅行情 + void Subscribe(const set& instrumentIDs, const string& szExchageID); + void SubscribeQuote(const set& instrumentIDs, const string& szExchageID); + + ///当客户端与交易后台建立起通信连接,客户端需要进行登录。 + virtual void OnFrontConnected(); + + ///当客户端与交易后台通信连接断开时,该方法被调用,客户端不需要处理,API会自动重连。 + virtual void OnFrontDisconnected(int nReason); + + ///错误应答 + //@cIsLast 包标志 API_PACKET_FIRST | API_PACKET_LAST 下同 + virtual void OnRspError(CHLRspInfoData *pRspInfo, int nRequestID, char cIsLast); + + ///用户登录应答 + virtual void OnRspUserLogin(HLApiRspUserLoginData *pRspUserLogin, CHLRspInfoData *pRspInfo, int nRequestID, char cIsLast); + + ///用户退出应答 + //virtual void OnRspUserLogout(void *pRspUserLogout, void *pRspInfo, int nRequestID, char cIsLast) {}; + + ///市场索引请求应答 + virtual void OnRspCodeTable(HLApiRspCodeTable *pRspCodeTable, CHLRspInfoData *pRspInfo, int nRequestID, char cIsLast); + + ///行情订阅请求应答 + virtual void OnRspMarketData(HLApiRspMarketData *pRspMarketData, CHLRspInfoData *pRspInfo, int nRequestID, char cIsLast); + + //订阅行情变化通知 + virtual void OnRtnMarketData(HLApiMarketData *pMarketData); + + //全市场行情变化通知(订阅股票代码为空时,为全市场行情推送) + virtual void OnRtnMarketData(HLApiMarketData *pMarketData, int nSize); + virtual void OnRtnPushStkData(HLApiMarketData *pMarketData, int nSize = 1); + +private: + mutex m_csMapInstrumentIDs; + mutex m_csMapQuoteInstrumentIDs; + + atomic m_lRequestID; //请求ID,每次请求前自增 + + set m_setInstrumentIDs; //正在订阅的合约 + set m_setQuoteInstrumentIDs; //正在订阅的合约 + HLQuoteApi* m_pApi; //行情API + + string m_szPath; //生成配置文件的路径 + ServerInfoField m_ServerInfo; + UserInfoField m_UserInfo; + int m_nSleep; + + CMsgQueue* m_msgQueue; //消息队列指针 + CMsgQueue* m_msgQueue_Query; + void* m_pClass; + + CMsgQueue* m_remoteQueue; +}; + + diff --git a/Qubit_HL_Quote/Qubit_HL_Quote.rc b/Qubit_HL_Quote/Qubit_HL_Quote.rc new file mode 100644 index 0000000..8a539f5 Binary files /dev/null and b/Qubit_HL_Quote/Qubit_HL_Quote.rc differ diff --git a/Qubit_HL_Quote/Qubit_HL_Quote.vcxproj b/Qubit_HL_Quote/Qubit_HL_Quote.vcxproj new file mode 100644 index 0000000..54c4448 --- /dev/null +++ b/Qubit_HL_Quote/Qubit_HL_Quote.vcxproj @@ -0,0 +1,124 @@ +锘 + + + + Debug + Win32 + + + Release + Win32 + + + + {BE164B27-EC28-4B7A-89C4-0B7EA38F8846} + Qubit_HL_Quote + MFCDLLProj + + + + DynamicLibrary + true + v120 + Unicode + Static + + + DynamicLibrary + false + v120 + true + Unicode + Static + + + + + + + + + + + + + true + + + false + + + + Use + Level3 + Disabled + WIN32;_WINDOWS;_DEBUG;_USRDLL;%(PreprocessorDefinitions) + + + Windows + true + .\Qubit_HL_Quote.def + + + false + _DEBUG;%(PreprocessorDefinitions) + + + 0x0804 + _DEBUG;%(PreprocessorDefinitions) + $(IntDir);%(AdditionalIncludeDirectories) + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;_WINDOWS;NDEBUG;_USRDLL;%(PreprocessorDefinitions) + + + Windows + true + true + true + .\Qubit_HL_Quote.def + + + false + NDEBUG;%(PreprocessorDefinitions) + + + 0x0804 + NDEBUG;%(PreprocessorDefinitions) + $(IntDir);%(AdditionalIncludeDirectories) + + + + + + + + + Create + Create + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Qubit_HL_Quote/Qubit_HL_Quote.vcxproj.filters b/Qubit_HL_Quote/Qubit_HL_Quote.vcxproj.filters new file mode 100644 index 0000000..0266cbc --- /dev/null +++ b/Qubit_HL_Quote/Qubit_HL_Quote.vcxproj.filters @@ -0,0 +1,55 @@ +锘 + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + 婧愭枃浠 + + + 婧愭枃浠 + + + + + 澶存枃浠 + + + 澶存枃浠 + + + 澶存枃浠 + + + 澶存枃浠 + + + + + 婧愭枃浠 + + + 璧勬簮鏂囦欢 + + + + + 璧勬簮鏂囦欢 + + + \ No newline at end of file diff --git a/Qubit_HL_Quote/ReadMe.txt b/Qubit_HL_Quote/ReadMe.txt new file mode 100644 index 0000000..1c5ba0a --- /dev/null +++ b/Qubit_HL_Quote/ReadMe.txt @@ -0,0 +1,45 @@ +锘======================================================================== + MICROSOFT 鍩虹绫诲簱 : Qubit_HL_Quote 椤圭洰姒傝堪 +======================================================================== + + +搴旂敤绋嬪簭鍚戝宸蹭负鎮ㄥ垱寤轰簡姝 Qubit_HL_Quote DLL銆傛 DLL 涓嶄粎婕旂ず Microsoft 鍩虹绫荤殑鍩烘湰浣跨敤鏂规硶锛岃繕鍙綔涓烘偍缂栧啓 DLL 鐨勮捣鐐广 + +鏈枃浠舵瑕佷粙缁嶇粍鎴 Qubit_HL_Quote DLL 鐨勬瘡涓枃浠剁殑鍐呭銆 + +Qubit_HL_Quote.vcxproj + 杩欐槸浣跨敤搴旂敤绋嬪簭鍚戝鐢熸垚鐨 VC++ 椤圭洰鐨勪富椤圭洰鏂囦欢锛屽叾涓寘鍚敓鎴愯鏂囦欢鐨 Visual C++ 鐨勭増鏈俊鎭紝浠ュ強鏈夊叧浣跨敤搴旂敤绋嬪簭鍚戝閫夋嫨鐨勫钩鍙般侀厤缃拰椤圭洰鍔熻兘鐨勪俊鎭 + +Qubit_HL_Quote.vcxproj.filters + 杩欐槸浣跨敤鈥滃簲鐢ㄧ▼搴忓悜瀵尖濈敓鎴愮殑 VC++ 椤圭洰绛涢夊櫒鏂囦欢銆傚畠鍖呭惈鏈夊叧椤圭洰鏂囦欢涓庣瓫閫夊櫒涔嬮棿鐨勫叧鑱斾俊鎭傚湪 IDE 涓紝閫氳繃杩欑鍏宠仈锛屽湪鐗瑰畾鑺傜偣涓嬩互鍒嗙粍褰㈠紡鏄剧ず鍏锋湁鐩镐技鎵╁睍鍚嶇殑鏂囦欢銆備緥濡傦紝鈥.cpp鈥濇枃浠朵笌鈥滄簮鏂囦欢鈥濈瓫閫夊櫒鍏宠仈銆 + +Qubit_HL_Quote.h + 杩欐槸 DLL 鐨勪富澶存枃浠躲傚畠澹版槑浜 CQubit_HL_QuoteApp 绫汇 + +Qubit_HL_Quote.cpp + 杩欐槸涓 DLL 婧愭枃浠躲傚畠鍖呭惈 CQubit_HL_QuoteApp 绫汇 + +Qubit_HL_Quote.rc + 杩欐槸绋嬪簭浣跨敤鐨勬墍鏈 Microsoft Windows 璧勬簮鐨勫垪琛ㄣ傚畠鍖呮嫭 RES 瀛愮洰褰曚腑瀛樺偍鐨勫浘鏍囥佷綅鍥惧拰鍏夋爣銆傛鏂囦欢鍙互鐩存帴鍦 Microsoft Visual C++ 涓繘琛岀紪杈戙 + +res\Qubit_HL_Quote.rc2 + 姝ゆ枃浠跺寘鍚笉鍦 Microsoft Visual C++ 涓繘琛岀紪杈戠殑璧勬簮銆傛偍搴旇灏嗕笉鍙敱璧勬簮缂栬緫鍣ㄧ紪杈戠殑鎵鏈夎祫婧愭斁鍦ㄦ鏂囦欢涓 + +Qubit_HL_Quote.def + 姝ゆ枃浠跺寘鍚湪 Microsoft Windows 涓繍琛屾墍蹇呴渶鐨 DLL 鐨勬湁鍏充俊鎭傚畠瀹氫箟浜 DLL 鐨勫悕绉板拰璇存槑绛夊弬鏁帮紝鑰屼笖杩樹粠 DLL 瀵煎嚭鍑芥暟銆 + +///////////////////////////////////////////////////////////////////////////// +鍏朵粬鏍囧噯鏂囦欢: + +StdAfx.h, StdAfx.cpp + 杩欎簺鏂囦欢鐢ㄤ簬鐢熸垚鍚嶄负 Qubit_HL_Quote.pch 鐨勯缂栬瘧澶 (PCH) 鏂囦欢鍜屽悕涓 StdAfx.obj 鐨勯缂栬瘧绫诲瀷鏂囦欢銆 + +Resource.h + 杩欐槸鏍囧噯澶存枃浠讹紝鍙敤浜庡畾涔夋柊鐨勮祫婧 ID銆侻icrosoft Visual C++ 灏嗚鍙栧苟鏇存柊姝ゆ枃浠躲 + +///////////////////////////////////////////////////////////////////////////// +鍏朵粬娉ㄩ噴: + +搴旂敤绋嬪簭鍚戝浣跨敤鈥淭ODO:鈥濇潵鎸囩ず搴旀坊鍔犳垨鑷畾涔夌殑婧愪唬鐮侀儴鍒嗐 + +///////////////////////////////////////////////////////////////////////////// diff --git a/Qubit_HL_Quote/Resource.h b/Qubit_HL_Quote/Resource.h new file mode 100644 index 0000000..26ae6ba --- /dev/null +++ b/Qubit_HL_Quote/Resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Qubit_HL_Quote.rc +// + +// 新对象的下一组默认值 +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS + +#define _APS_NEXT_RESOURCE_VALUE 1000 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 1000 +#define _APS_NEXT_COMMAND_VALUE 32771 +#endif +#endif diff --git a/Qubit_HL_Quote/dllmain.cpp b/Qubit_HL_Quote/dllmain.cpp new file mode 100644 index 0000000..574e92d --- /dev/null +++ b/Qubit_HL_Quote/dllmain.cpp @@ -0,0 +1,24 @@ +// dllmain.cpp : Defines the entry point for the DLL application. +#include "stdafx.h" +#ifdef _X86_ +extern "C" { int _afxForceUSRDLL; } +#else +extern "C" { int __afxForceUSRDLL; } +#endif + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/Qubit_HL_Quote/main.cpp b/Qubit_HL_Quote/main.cpp new file mode 100644 index 0000000..bd01ba9 --- /dev/null +++ b/Qubit_HL_Quote/main.cpp @@ -0,0 +1,75 @@ +#include "stdafx.h" +#include "../include/ApiHeader.h" + +#include "../include/QueueEnum.h" +#include "Qubit_HL_Quote.h" + +#include "../include/CrossPlatform.h" + +inline CMdUserApi* GetApi(void* pApi) +{ + return static_cast(pApi); +} + + 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) +{ + RequestType rt = (RequestType)type; + switch (rt) + { + case GetApiType: + return (void*)(ApiType::MarketData | ApiType::QuoteRequest); + case GetApiVersion: + return (void*)"0.2.0.20150618"; + case GetApiName: + return (void*)"CTP"; + case Create: + return new CMdUserApi(); + default: + break; + } + + if (pApi1 == nullptr) + { + return nullptr; + } + + CMdUserApi* pApi = GetApi(pApi1); + + switch (rt) + { + case Release: + delete pApi; + return 0; + case Register: + pApi->Register(ptr1,ptr2); + break; + case Config: + return (void*)pApi->Config((ConfigInfoField*)ptr1); + case Connect: + pApi->Connect((const char*)ptr3, (ServerInfoField*)ptr1, (UserInfoField*)ptr2,size2); + break; + case Disconnect: + pApi->Disconnect(); + break; + + case ReqCodeTable: + pApi->ReqCodeTable((const char*)ptr1); + break; + //case Subscribe: + // pApi->Subscribe((const char*)ptr1, (const char*)ptr2); + // break; + //case Unsubscribe: + // pApi->Unsubscribe((const char*)ptr1, (const char*)ptr2); + // break; + //case SubscribeQuote: + // pApi->SubscribeQuote((const char*)ptr1, (const char*)ptr2); + // break; + //case UnsubscribeQuote: + // pApi->UnsubscribeQuote((const char*)ptr1, (const char*)ptr2); + // break; + default: + break; + } + + return pApi1; +} diff --git a/Qubit_HL_Quote/res/Qubit_HL_Quote.rc2 b/Qubit_HL_Quote/res/Qubit_HL_Quote.rc2 new file mode 100644 index 0000000..0f8ae34 Binary files /dev/null and b/Qubit_HL_Quote/res/Qubit_HL_Quote.rc2 differ diff --git a/Qubit_HL_Quote/stdafx.cpp b/Qubit_HL_Quote/stdafx.cpp new file mode 100644 index 0000000..4cbc68f --- /dev/null +++ b/Qubit_HL_Quote/stdafx.cpp @@ -0,0 +1,7 @@ +// stdafx.cpp : 只包括标准包含文件的源文件 +// Qubit_HL_Quote.pch 将作为预编译头 +// stdafx.obj 将包含预编译类型信息 + +#include "stdafx.h" + + diff --git a/Qubit_HL_Quote/stdafx.h b/Qubit_HL_Quote/stdafx.h new file mode 100644 index 0000000..bde7e92 --- /dev/null +++ b/Qubit_HL_Quote/stdafx.h @@ -0,0 +1,39 @@ +// stdafx.h : 标准系统包含文件的包含文件, +// 或是经常使用但不常更改的 +// 特定于项目的包含文件 + +#pragma once + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料 +#endif + +#include "targetver.h" + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的 + +#include // MFC 核心组件和标准组件 +#include // MFC 扩展 + +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC OLE 类 +#include // MFC OLE 对话框类 +#include // MFC 自动化类 +#endif // _AFX_NO_OLE_SUPPORT + +#ifndef _AFX_NO_DB_SUPPORT +#include // MFC ODBC 数据库类 +#endif // _AFX_NO_DB_SUPPORT + +#ifndef _AFX_NO_DAO_SUPPORT +#include // MFC DAO 数据库类 +#endif // _AFX_NO_DAO_SUPPORT + +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC 对 Internet Explorer 4 公共控件的支持 +#endif +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC 对 Windows 公共控件的支持 +#endif // _AFX_NO_AFXCMN_SUPPORT + + diff --git a/Qubit_HL_Quote/targetver.h b/Qubit_HL_Quote/targetver.h new file mode 100644 index 0000000..7a7d2c8 --- /dev/null +++ b/Qubit_HL_Quote/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。 + +// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将 +// WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。 + +#include diff --git a/csharp/QuantBox.XAPI/GB2312Marshaler.cs b/csharp/QuantBox.XAPI/GB2312Marshaler.cs index 66f3b31..6b3ff17 100644 --- a/csharp/QuantBox.XAPI/GB2312Marshaler.cs +++ b/csharp/QuantBox.XAPI/GB2312Marshaler.cs @@ -33,7 +33,7 @@ public IntPtr MarshalManagedToNative(object managedObj) Marshal.WriteByte(buffer + strbuf.Length, 0); return buffer; } - + public unsafe object MarshalNativeToManaged(IntPtr pNativeData) { byte* walk = (byte*)pNativeData; @@ -52,7 +52,7 @@ public unsafe object MarshalNativeToManaged(IntPtr pNativeData) string data = encodingGB2312.GetString(strbuf); return data; } - + public void CleanUpNativeData(IntPtr pNativeData) { Marshal.FreeHGlobal(pNativeData); diff --git a/csharp/QuantBox.XAPI/QuantBox.XAPI.csproj b/csharp/QuantBox.XAPI/QuantBox.XAPI.csproj index 2bd8fc1..3785065 100644 --- a/csharp/QuantBox.XAPI/QuantBox.XAPI.csproj +++ b/csharp/QuantBox.XAPI/QuantBox.XAPI.csproj @@ -16,7 +16,7 @@ true full false - ..\..\..\QuantBox.DataReceiver\bin\Debug\ + ..\bin\ DEBUG;TRACE prompt 4 @@ -31,6 +31,7 @@ TRACE prompt 4 + true diff --git a/include/HLAPI/ApiDataType.h b/include/HLAPI/ApiDataType.h new file mode 100644 index 0000000..d0e59a3 --- /dev/null +++ b/include/HLAPI/ApiDataType.h @@ -0,0 +1,159 @@ +#ifndef _API_DATA_TYPE_H_ +#define _API_DATA_TYPE_H_ + +///////////////////////////////////////////////////////////////////////// +///ErrorIDType是一个错误代码类型 +///////////////////////////////////////////////////////////////////////// +typedef int ErrorIDType; + +///////////////////////////////////////////////////////////////////////// +///ErrorMsgType是一个错误信息类型 +///////////////////////////////////////////////////////////////////////// +typedef char ErrorMsgType[256]; + +///////////////////////////////////////////////////////////////////////// +///PriceType是一个价格类型 +///////////////////////////////////////////////////////////////////////// +typedef double PriceType; + +///////////////////////////////////////////////////////////////////////// +///VolumeType是一个交易量类型 +///////////////////////////////////////////////////////////////////////// +typedef int VolumeType; + +///////////////////////////////////////////////////////////////////////// +///QtyType是一个交易量类型 +///////////////////////////////////////////////////////////////////////// +typedef double QtyType; + +///////////////////////////////////////////////////////////////////////// +///LargeVolumeType是一个大额数量类型 +///////////////////////////////////////////////////////////////////////// +typedef double LargeVolumeType; + +///////////////////////////////////////////////////////////////////////// +///InstrumentIDType是一个合约代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char InstrumentIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///SymbolType是一个合约唯一符号类型 +///////////////////////////////////////////////////////////////////////// +typedef char SymbolType[64]; + +///////////////////////////////////////////////////////////////////////// +///DateTimeType是一个日期时间类型 +///////////////////////////////////////////////////////////////////////// +typedef char DateTimeType[32]; + +///////////////////////////////////////////////////////////////////////// +///ExchangeIDType是一个交易所代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char ExchangeIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///MoneyType是一个资金类型 +///////////////////////////////////////////////////////////////////////// +typedef double MoneyType; + +///////////////////////////////////////////////////////////////////////// +///DateType是一个日期类型 +///////////////////////////////////////////////////////////////////////// +typedef char DateType[9]; +typedef int DateIntType; + +///////////////////////////////////////////////////////////////////////// +///TimeType是一个时间类型 +///////////////////////////////////////////////////////////////////////// +typedef char TimeType[9]; +typedef int TimeIntType; + +///////////////////////////////////////////////////////////////////////// +///UserIDType是一个用户代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char UserIDType[32]; + +///UserAccountNo是一个用户代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char UserAccountNoType[32]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPasswordType是一个密码类型 +///////////////////////////////////////////////////////////////////////// +typedef char PasswordType[41]; + +///////////////////////////////////////////////////////////////////////// +///ProductInfoType是一个产品信息类型 +///////////////////////////////////////////////////////////////////////// +typedef char ProductInfoType[11]; + +///////////////////////////////////////////////////////////////////////// +///BrokerIDType是一个经纪公司代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char BrokerIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///AuthCodeType是一个客户端认证码类型 +///////////////////////////////////////////////////////////////////////// +typedef char AuthCodeType[17]; + +///////////////////////////////////////////////////////////////////////// +///AddressType是一个地址类型 +///////////////////////////////////////////////////////////////////////// +typedef char AddressType[512]; +///ExtendInformationType是一个扩展信息类型 +///////////////////////////////////////////////////////////////////////// +typedef char ExtendInformationType[128]; +///////////////////////////////////////////////////////////////////////// +///VolumeMultipleType是一个合约数量乘数类型 +///////////////////////////////////////////////////////////////////////// +typedef int VolumeMultipleType; + +///////////////////////////////////////////////////////////////////////// +///InstrumentNameType是一个合约名称类型 +///////////////////////////////////////////////////////////////////////// +typedef char InstrumentNameType[31]; + +///////////////////////////////////////////////////////////////////////// +///ContentType是一个消息正文类型 +///////////////////////////////////////////////////////////////////////// +typedef char ContentType[501]; + +///////////////////////////////////////////////////////////////////////// +///SessionIDType是一个会话编号类型 +///////////////////////////////////////////////////////////////////////// +typedef char SessionIDType[32]; + +///////////////////////////////////////////////////////////////////////// +///OrderIDType是一个订单唯一编号类型 +///////////////////////////////////////////////////////////////////////// +typedef char OrderIDType[64]; + +///////////////////////////////////////////////////////////////////////// +///TradeIDType是一个成交编号类型 +///////////////////////////////////////////////////////////////////////// +typedef char TradeIDType[64]; + +///////////////////////////////////////////////////////////////////////// +///PositionIDType是一个持仓编号类型 +///////////////////////////////////////////////////////////////////////// +typedef char PositionIDType[64]; + +///////////////////////////////////////////////////////////////////////// +///BarSizeType是一个BarSize类型 +///////////////////////////////////////////////////////////////////////// +typedef long BarSizeType; + +///////////////////////////////////////////////////////////////////////// +///ReferIDType是一个请求ID回调索引值类型 +///////////////////////////////////////////////////////////////////////// +typedef int ReferIDType; + +///////////////////////////////////////////////////////////////////////// +///BrokerIDType是一个经纪公司代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char ShareholderIDType[11]; + +typedef int SizeType; + +#endif \ No newline at end of file diff --git a/include/HLAPI/ApiEnum.h b/include/HLAPI/ApiEnum.h new file mode 100644 index 0000000..c2b1f77 --- /dev/null +++ b/include/HLAPI/ApiEnum.h @@ -0,0 +1,210 @@ +#ifndef _API_ENUM_H_ +#define _API_ENUM_H_ + +enum LogLevel +{ + E_Fatal, + E_Critical, + E_Error, + E_Warning, + E_Notice, + E_Information, + E_Debug, + E_Trace, +}; + + +//连接状态枚举 +enum ConnectionStatus :char +{ + Uninitialized, //未初始化 + Initialized, //已经初始化 + Disconnected, //连接已经断开 + Connecting, //连接中 + Connected, //连接成功 + Authorizing, //授权中 + Authorized, //授权成功 + Logining, //登录中 + Logined, //登录成功 + Confirming, //结算单确认中 + Confirmed, //已经确认 + Doing, + Done, //完成 + Unknown, //未知 + ConnectFailed, + InitializedFailed, + LoginFailed, + Logout, +}; + +enum ApiType :char +{ + Nono = 0, + Trade = 1, + MarketData = 2, + Level2 = 4, + QuoteRequest = 8, + HistoricalData = 16, + Instrument = 32, +}; + +enum DepthLevelType:char +{ + L0, + L1, + L5, + L10, + FULL, +}; + +enum ResumeType :char +{ + Restart, + Resume, + Quick, +}; + +enum PutCall :char +{ + Put, + Call, +}; + +enum OrderStatus :char +{ + NotSent, + PendingNew, + New, + Rejected, + PartiallyFilled, + Filled, + PendingCancel, + Cancelled, + Expired, + PendingReplace, + Replaced, +}; + +enum OrderSide :char +{ + Buy, + Sell, + Creation,//申购 + Redemption,//赎回 + Merger,//合并 + Demerger,//拆分 +}; + +enum OrderType :char +{ + Market, + Stop, + Limit, + StopLimit, + MarketOnClose, + TrailingStop, + TrailingStopLimit, +}; + +enum TimeInForce :char +{ + ATC, + Day, + GTC, + IOC, + OPG, + OC, + FOK, + GTX, + GTD, + GFS, +}; + + + +enum PositionSide :char +{ + Long, + Short, +}; + +enum ExecType : char +{ + ExecNew, + ExecRejected, + ExecTrade, + ExecPendingCancel, + ExecCancelled, + ExecCancelReject, + ExecPendingReplace, + ExecReplace, + ExecReplaceReject, +}; + +enum OpenCloseType :char +{ + Open, + Close, + CloseToday, +}; + +enum HedgeFlagType :char +{ + Speculation, + Arbitrage, + Hedge, + MarketMaker, +}; + +enum InstrumentType :char +{ + Stock, + Future, + Option, + FutureOption, + Bond, + FX, + Index, + ETF, + MultiLeg, + Synthetic, + LOF, + Other, +}; + +enum BarType :char +{ + Time, + Tick, + Volume, + Range, +}; + +enum DataObjetType : char +{ + Tick_, + Bid, + Ask, + Trade_, + Quote, + Bar, + Level2_, + Level2Snapshot, + Level2Update, +}; + +enum ExchangeType :char +{ + Undefined_, + SHFE, // 上期所 + DCE, // 大商所 + CZCE, // 郑商所 + CFFEX, // 中金所 + INE, // 能源中心 + SSE, // 上交所 + SZE, // 深交所 + NEEQ, // 全国中小企业股份转让系统,三板,临时这么写 + HKEx, +}; + +#endif diff --git a/include/HLAPI/ApiStruct.h b/include/HLAPI/ApiStruct.h new file mode 100644 index 0000000..2f42366 --- /dev/null +++ b/include/HLAPI/ApiStruct.h @@ -0,0 +1,604 @@ +#ifndef _API_STRUCT_H_ +#define _API_STRUCT_H_ + +#include "ApiDataType.h" +#include "ApiEnum.h" + + +struct PositionField +{ + ///唯一符号 + SymbolType Symbol; + ///合约代码 + InstrumentIDType InstrumentID; + ///交易所代码 + ExchangeIDType ExchangeID; + + PositionSide Side; + /// 总持仓 + QtyType Position; + /// 今日持仓 + QtyType TdPosition; + /// 昨日持仓 + QtyType YdPosition; + /// 可用持仓 + QtyType AvbPosition; + /// 可用昨日持仓 + QtyType AvbYdPosition; + /// 可用申赎数 + QtyType AvbETFPosition; + + InstrumentIDType InstrumentName; + //QtyType + /// 成本价 + PriceType HoldPrice; + /// 市值 + PriceType MktValue; + + HedgeFlagType HedgeFlag; + + int StockAskFrn; //卖出冻结 + int StockBidFrn; //买入冻结 + //TThostFtdcPositionDateType 还没处理 +}; + +struct QuoteField +{ + InstrumentIDType InstrumentID; + ExchangeIDType ExchangeID; + + QtyType AskQty; + PriceType AskPrice; + OpenCloseType AskOpenClose; + HedgeFlagType AskHedgeFlag; + + QtyType BidQty; + PriceType BidPrice; + OpenCloseType BidOpenClose; + HedgeFlagType BidHedgeFlag; + + ///询价编号 + OrderIDType QuoteReqID; + + OrderIDType ID; + OrderIDType AskID; + OrderIDType BidID; + OrderIDType AskOrderID; + OrderIDType BidOrderID; + OrderStatus Status; + ExecType ExecType; + ErrorIDType ErrorID; + ErrorMsgType Text; + + /* + QtyType LeavesQty; + QtyType CumQty; + PriceType AvgPx; + + + + + long DateTime;*/ +}; + +struct EtfSubscribeField +{ + ///用户代码 + UserIDType UserID; + //用户资金账号 + UserAccountNoType UserAccountNo; + InstrumentIDType InstrumentID; + QtyType Qty; + OrderSide Side; + OrderIDType OrderID; +}; + +struct OrderField +{ + InstrumentNameType InstrumentName; + InstrumentIDType InstrumentID; + ExchangeIDType ExchangeID; + OrderType Type; + OrderSide Side; + QtyType Qty; + PriceType Price; + OpenCloseType OpenClose; + HedgeFlagType HedgeFlag; + + PriceType StopPx; + TimeInForce TimeInForce; + + OrderStatus Status; + ExecType ExecType; + QtyType LeavesQty; + QtyType CumQty; + PriceType AvgPx; + ErrorIDType ErrorID; + ErrorMsgType Text; + + OrderIDType ID; + OrderIDType OrderID; + int DateTime; + + + TimeType Time; + long OrderRef; + ShareholderIDType ShareHolderID; +}; + +struct OrderCancelField +{ + + ///用户代码 + UserIDType UserID; + //用户资金账号 + UserAccountNoType UserAccountNo; + //撤销合同号 + OrderIDType OrderID; +}; + +struct TradeField +{ + InstrumentIDType InstrumentID; + ExchangeIDType ExchangeID; + + OrderSide Side; + QtyType Qty; + PriceType Price; + OpenCloseType OpenClose; + HedgeFlagType HedgeFlag; + MoneyType Commission; + int MatchedDate; //成交或撤单日期 + TimeType Time; + OrderIDType ID; + TradeIDType TradeID; + + InstrumentNameType InstrumentName; + ShareholderIDType ShareHolderID; + OrderStatus Status; + QtyType LeavesQty; + OrderStatus OdStatus; + OrderIDType RefID; + +}; + +struct ServerInfoField +{ + bool IsUsingUdp; + bool IsMulticast; + int TopicId; + int Port; + ResumeType MarketDataTopicResumeType; + ResumeType PrivateTopicResumeType; + ResumeType PublicTopicResumeType; + ResumeType UserTopicResumeType; + BrokerIDType BrokerID; + ProductInfoType UserProductInfo; + AuthCodeType AuthCode; + AddressType Address; + ExtendInformationType ExtendInformation; +}; + +struct ConfigInfoField +{ + +}; + +// 用户信息 +struct UserInfoField +{ + ///用户代码 + UserIDType UserID; + //用户资金账号 + UserAccountNoType UserAccountNo; + ///密码 + PasswordType Password; +}; + + +// 错误信息 +struct ErrorField +{ + // 错误代码 + ErrorIDType ErrorID; + // 错误信息 + ErrorMsgType ErrorMsg; +}; + + +// 登录回报 +struct RspUserLoginField +{ + ///交易日 + DateType TradingDay; + // 时间 + TimeType LoginTime; + // 会话ID + SessionIDType SessionID; + // 错误代码 + ErrorIDType ErrorID; + // 错误信息 + ErrorMsgType ErrorMsg; + // 交易所编号 + ExchangeIDType ExchangeID; + // 股东编号 + UserIDType SecurityID; + // 请求索引 + ReferIDType ReferID; + +}; + + + +///深度行情 +struct DepthMarketDataField +{ + ///交易所时间 + DateIntType TradingDay; // 交易日,用于给数据接收器划分到同一文件使用,基本没啥别的用处 + DateIntType ActionDay; + TimeIntType UpdateTime; + TimeIntType UpdateMillisec; + + ///唯一符号 + SymbolType Symbol; + ///合约代码 + InstrumentIDType InstrumentID; + ///交易所代码 + ExchangeIDType ExchangeID; + + ///最新价 + PriceType LastPrice; + ///数量 + LargeVolumeType Volume; + ///成交金额 + MoneyType Turnover; + ///持仓量 + LargeVolumeType OpenInterest; + ///当日均价 + PriceType AveragePrice; + + + ///今开盘 + PriceType OpenPrice; + ///最高价 + PriceType HighestPrice; + ///最低价 + PriceType LowestPrice; + ///今收盘 + PriceType ClosePrice; + ///本次结算价 + PriceType SettlementPrice; + + ///涨停板价 + PriceType UpperLimitPrice; + ///跌停板价 + PriceType LowerLimitPrice; + ///昨收盘 + PriceType PreClosePrice; + ///上次结算价 + PriceType PreSettlementPrice; + ///昨持仓量 + LargeVolumeType PreOpenInterest; + + + ///申买价一 + PriceType BidPrice1; + ///申买量一 + VolumeType BidVolume1; + ///申卖价一 + PriceType AskPrice1; + ///申卖量一 + VolumeType AskVolume1; + ///申买价二 + PriceType BidPrice2; + ///申买量二 + VolumeType BidVolume2; + ///申卖价二 + PriceType AskPrice2; + ///申卖量二 + VolumeType AskVolume2; + ///申买价三 + PriceType BidPrice3; + ///申买量三 + VolumeType BidVolume3; + ///申卖价三 + PriceType AskPrice3; + ///申卖量三 + VolumeType AskVolume3; + ///申买价四 + PriceType BidPrice4; + ///申买量四 + VolumeType BidVolume4; + ///申卖价四 + PriceType AskPrice4; + ///申卖量四 + VolumeType AskVolume4; + ///申买价五 + PriceType BidPrice5; + ///申买量五 + VolumeType BidVolume5; + ///申卖价五 + PriceType AskPrice5; + ///申卖量五 + VolumeType AskVolume5; +}; + +///Tick行情 +struct TickField +{ + ///交易所时间 + DateIntType Date; + TimeIntType Time; + TimeIntType Millisecond; + + PriceType LastPrice; + ///数量 + LargeVolumeType Volume; + ///持仓量 + LargeVolumeType OpenInterest; + PriceType BidPrice1; + PriceType AskPrice1; + VolumeType BidSize1; + VolumeType AskSize1; +}; + + +///Bar行情 +struct BarField +{ + ///交易所时间 + DateIntType Date; + TimeIntType Time; + + ///开 + PriceType Open; + ///高 + PriceType High; + ///低 + PriceType Low; + ///收 + PriceType Close; + ///数量 + LargeVolumeType Volume; + ///持仓量 + LargeVolumeType OpenInterest; + ///成交金额 + MoneyType Turnover; +}; + +///发给做市商的询价请求 +struct QuoteRequestField +{ + ///唯一符号 + SymbolType Symbol; + ///合约代码 + InstrumentIDType InstrumentID; + ///交易所代码 + ExchangeIDType ExchangeID; + ///交易日 + DateType TradingDay; + ///询价编号 + OrderIDType QuoteID; + ///询价时间 + TimeType QuoteTime; +}; + +///合约 +struct InstrumentField +{ + ///唯一符号 + SymbolType Symbol; + ///合约代码 + InstrumentIDType InstrumentID; + ///交易所代码 + ExchangeIDType ExchangeID; + ///合约名称 + InstrumentNameType InstrumentName; + + ///合约类型 + InstrumentType Type; + ///合约数量乘数 + VolumeMultipleType VolumeMultiple; + ///最小变动价位 + PriceType PriceTick; + ///到期日 + DateType ExpireDate; + ///基础商品代码 + InstrumentIDType UnderlyingInstrID; + ///执行价 + PriceType StrikePrice; + ///期权类型 + PutCall OptionsType; +}; + +///账号 +struct AccountField +{ + ///上次结算准备金 + MoneyType PreBalance; + ///当前保证金总额 + MoneyType CurrMargin; + ///平仓盈亏 + MoneyType CloseProfit; + ///持仓盈亏 + MoneyType PositionProfit; + ///期货结算准备金 + MoneyType Balance; + ///可用资金 + MoneyType Available; + + ///入金金额 + MoneyType Deposit; + ///出金金额 + MoneyType Withdraw; + + ///冻结的过户费 + MoneyType FrozenTransferFee; + ///冻结的印花税 + MoneyType FrozenStampTax; + ///冻结的手续费 + MoneyType FrozenCommission; + ///冻结的资金 + MoneyType FrozenCash; + + ///过户费 + MoneyType TransferFee; + ///印花税 + MoneyType StampTax; + ///手续费 + MoneyType Commission; + ///资金差额 + MoneyType CashIn; + +}; + +///账号 +struct SettlementInfoField +{ + ///交易日 + DateType TradingDay; + ///消息正文 + ContentType Content; +}; + +struct HistoricalDataRequestField +{ + ///唯一符号 + SymbolType Symbol; + ///合约代码 + InstrumentIDType InstrumentID; + ///交易所代码 + ExchangeIDType ExchangeID; + + int Date1; + int Date2; + int Time1; + int Time2; + + DataObjetType DataType; + BarType BarType; + long BarSize; + + int RequestId; + int CurrentDate; + int lRequest; +}; + +//ETF清单请求响应 +struct ETFListField +{ + //ETF代码 + InstrumentIDType ETFInstrumentID; + //ETF名称 + InstrumentNameType ETFInstrumentName; + ///交易所代码 + ExchangeIDType ExchangeID; //一级交易板块 + double dMaxCashRatio; //现金替代比例上限 + int nCreationRedemption; //基金当天申购赎回状态(1,0) + int nCreationRedemptionUnit; //最小申购赎回单位 + PriceType dEstimateCashComponent; //T日预估现金余额 + int nTradingDay; //T日日期 + InstrumentIDType InstrumentID; + PriceType dCashComponent; //T-1日现金差额(单位:元) + double dNAVperCU; //T-1日最小申购、赎回单位资产净值(单位:元) + int nItemDataSize; //成份股数量 + int size; + +}; + +struct ETFListDataField +{ + InstrumentIDType InstrumentID; //股票代码 + InstrumentNameType InstrumentName;//股票名称 + ExchangeIDType ExchangeID; //交易所代码 + int nNum; //股票数量 + int nFlag; //现金替代标志 + double dRatio; //溢价比例 + double dReplaceAmount; //替代金额 +}; + + +//ETF申赎请求 +struct ETFSubscribeInfo +{ + int eSubscribeFlag; //申赎标志 + InstrumentIDType InstrumentID; //ETF代码 + int nSubscribeQty; //申赎份额 + OrderIDType OrderID; //合同序号 +}; + +//分级基金 +struct RspStruFundInfoQry +{ + InstrumentIDType FundInstrumentID; + InstrumentNameType FundInstrumentName; + InstrumentIDType FundAInstrumentID; + InstrumentNameType FundAInstrumentName; + InstrumentIDType FundBInstrumentID; + InstrumentNameType FundBInstrumentName; + int nFundAShare; //分级A比例(0,100), 默认:50 + int nFundBShare; //分级B比例(0,100), 默认:50 +}; +///深度行情N档 +struct DepthMarketDataNField +{ + ///占用总字节大小 + SizeType Size; + ///交易所时间 + DateIntType TradingDay; // 交易日,用于给数据接收器划分到同一文件使用,基本没啥别的用处 + DateIntType ActionDay; + TimeIntType UpdateTime; + TimeIntType UpdateMillisec; + + ///交易所代码 + ExchangeType Exchange; + ///唯一符号 + SymbolType Symbol; + ///合约代码 + InstrumentIDType InstrumentID; + + ///最新价 + PriceType LastPrice; + ///数量 + LargeVolumeType Volume; + ///成交金额 + MoneyType Turnover; + ///持仓量 + LargeVolumeType OpenInterest; + ///当日均价 + PriceType AveragePrice; + + + ///今开盘 + PriceType OpenPrice; + ///最高价 + PriceType HighestPrice; + ///最低价 + PriceType LowestPrice; + ///今收盘 + PriceType ClosePrice; + ///本次结算价 + PriceType SettlementPrice; + + ///涨停板价 + PriceType UpperLimitPrice; + ///跌停板价 + PriceType LowerLimitPrice; + ///昨收盘 + PriceType PreClosePrice; + ///上次结算价 + PriceType PreSettlementPrice; + ///昨持仓量 + LargeVolumeType PreOpenInterest; + ///买档个数 + SizeType BidCount; + char status; +}; + +struct DepthField +{ + PriceType Price; + VolumeType Size; + VolumeType Count; +}; +#endif diff --git a/include/HLAPI/HLQuoteApi.dll b/include/HLAPI/HLQuoteApi.dll new file mode 100644 index 0000000..4e822f5 Binary files /dev/null and b/include/HLAPI/HLQuoteApi.dll differ diff --git a/include/HLAPI/HLQuoteApi.h b/include/HLAPI/HLQuoteApi.h new file mode 100644 index 0000000..5800448 --- /dev/null +++ b/include/HLAPI/HLQuoteApi.h @@ -0,0 +1,97 @@ +#ifndef HLQUOTEAPI_HHH_ +#define HLQUOTEAPI_HHH_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "HLUserApiDefine.h" + +#if defined(ISLIB) && defined(WIN32) +#ifdef LIB_HLQUOTEAPI_EXPORT +#define HLQUOTEAPI_EXPORT __declspec(dllexport) +#else +#define HLQUOTEAPI_EXPORT __declspec(dllimport) +#endif +#else +#define HLQUOTEAPI_EXPORT +#endif + + +class HLQUOTEAPI_EXPORT HLQuoteSpi +{ +public: + //当客户端与交易后台建立起通信连接,客户端需要进行登录。 + virtual void OnFrontConnected() {}; + + //当客户端与交易后台通信连接断开时,该方法被调用,客户端不需要处理,API会自动重连。 + virtual void OnFrontDisconnected(int nReason) {}; + + //错误应答 + //@cIsLast 包标志 API_PACKET_FIRST | API_PACKET_LAST 下同 + virtual void OnRspError(CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + //用户登录应答 + virtual void OnRspUserLogin(HLApiRspUserLoginData* pRspUserLogin, CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + //用户退出应答 + //virtual void OnRspUserLogout(void *pRspUserLogout, void *pRspInfo, int nRequestID, char cIsLast) {}; + + //市场代码表请求应答 + virtual void OnRspCodeTable(HLApiRspCodeTable* pRspCodeTable, CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + //行情订阅请求应答 + virtual void OnRspMarketData(HLApiRspMarketData* pRspMarketData, CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + //行情变化通知 + virtual void OnRtnMarketData(HLApiMarketData* pMarketData) {}; + + //全市场行情变化通知(订阅股票代码为空时,为全市场行情推送) + virtual void OnRtnMarketData(HLApiMarketData* pMarketData, int nSize) {}; + + //TCP实时推送的行情 + virtual void OnRtnPushStkData(HLApiMarketData* pMarketData, int nSize = 1) {}; + + //组播实时推送的行情 + virtual void OnRtnMarketData_MC(HLApiMarketData* pMarketData, int nSize = 1) {}; + +protected: + virtual ~HLQuoteSpi(void) = 0 {}; +}; + +class HLQUOTEAPI_EXPORT HLQuoteApi +{ +public: + //创建一个HLQuoteApi + static HLQuoteApi* CreateHLQuoteApi(void); + + //获取行情API版本号 + static const char* GetVersion(void); + + //注册行情服务器地址 + virtual void RegisterNetwork(unsigned short nPort, const char* pszFrontAddr, const char* pszMCGroup="") = 0; + + //注册行情回调接口 + virtual void RegisterSpi(HLQuoteSpi* pSpi) = 0; + + //行情API初始化 + virtual int Init(void) = 0; + + //用户登录请求 + virtual int ReqUserLogin(HLApiReqUserLoginData* pReqUserLogin, int nRequestID) = 0; + + //市场代码表请求 + virtual int ReqCodeTable(HLApiReqCodeTable* pReqCodeTable, int nRequestID) = 0; + + //行情订阅请求 + virtual int ReqMarketData(HLApiReqMarketData* pReqMarketData, int nRequestID) = 0; + + //行情API反初始化 + virtual void Release(void) = 0; + +protected: + virtual ~HLQuoteApi(void); +}; + +#endif /*HLQUOTEAPI_HHH_*/ + diff --git a/include/HLAPI/HLQuoteApi.lib b/include/HLAPI/HLQuoteApi.lib new file mode 100644 index 0000000..b8ce349 Binary files /dev/null and b/include/HLAPI/HLQuoteApi.lib differ diff --git a/include/HLAPI/HLTradeApi.dll b/include/HLAPI/HLTradeApi.dll new file mode 100644 index 0000000..3640713 Binary files /dev/null and b/include/HLAPI/HLTradeApi.dll differ diff --git a/include/HLAPI/HLTradeApi.h b/include/HLAPI/HLTradeApi.h new file mode 100644 index 0000000..7453708 --- /dev/null +++ b/include/HLAPI/HLTradeApi.h @@ -0,0 +1,147 @@ +#ifndef HLTRADEAPI_HHH_ +#define HLTRADEAPI_HHH_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "HLUserApiDefine.h" + + +#if defined(ISLIB) && defined(WIN32) + #ifdef LIB_HLTRADEAPI_EXPORT + #define HLTRADEAPI_EXPORT __declspec(dllexport) + #else + #define HLTRADEAPI_EXPORT __declspec(dllimport) + #endif +#else + #define HLTRADEAPI_EXPORT +#endif + +class HLTRADEAPI_EXPORT HLTradeSpi +{ +public: + ///当客户端与交易后台建立起通信连接,客户端需要进行登录。 + virtual void OnFrontConnected() {}; + + ///当客户端与交易后台通信连接断开时,该方法被调用,客户端不需要处理,API会自动重连。 + virtual void OnFrontDisconnected(int nReason) {}; + + ///错误应答 + //@cIsLast 包标志 API_PACKET_FIRST | API_PACKET_LAST 下同 + virtual void OnRspError(CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + ///用户登录_应答 + virtual void OnRspUserLogin(HLApiRspUserLoginData* pRspUserLogin, CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + ///用户退出_应答 + //virtual void OnRspUserLogout(void *pRspUserLogout, void *pRspInfo, int nRequestID, char cIsLast) {}; + + ///用户委托请求_应答 + virtual void OnRspOrder(HLApiRspOrder* pRspOrder, CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + ///用户撤单请求_应答 + virtual void OnRspCancelOrder(HLApiRspCancelOrder* pRspCancelOrder, CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + ///ETF清单请求_应答 + virtual void OnRspETFList(HLApiRspETFList* pRspETFList, CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + ///ETF申赎请求_应答 + virtual void OnRspETFSubscribe(HLApiRspETFSubscribe* pRspETFSubscribe, CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + ///查委托请求_应答 + virtual void OnRspOrderQry(HLApiRspOrderQry* pRspQryOrder, CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + ///查当日成交请求_应答 + virtual void OnRspTodayDealQry(HLApiRspTodayDealQry* pRspQryTodayDeal, CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + ///查资金请求_应答 + virtual void OnRspMoneyInfoQry(HLApiRspMoneyInfoQry* pRspQryMoneyInfo, CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + ///可用证券查询请求_应答 + virtual void OnRspAvlStockInfoQry(HLApiRspAvlStocksInfoQry* pReqQryAvlStockInfo, CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + ///委托、撤单、撤单失败通知 + virtual void OnRtnOrderInfo(HLApiRtnOrderInfo* pRtnOrderInfo, CHLRspInfoData* pRspInfo, int nRequestID) {}; + + ///成交通知 + virtual void OnRtnMatchInfo(HLApiRtnMatchInfo* pRtnMatchInfo, CHLRspInfoData* pRspInfo, int nRequestID) {}; + + ///可用证券变化通知 + virtual void OnRtnAvlStockInfo(HLApiRtnAvlStockInfo* pRtnAvlStockInfo, CHLRspInfoData* pRspInfo, int nRequestID) {}; + + ///资金变化通知 + virtual void OnRtnMoneyInfo(HLApiRtnMoneyInfo* pRtnMoneyInfo, CHLRspInfoData* pRspInfo, int nRequestID) {}; + + ///分级基金成分信息查询_应答 + virtual void OnRspStruFundInfoQry(HLApiRspStruFundInfoQry* pRspQryStruFundInfo, CHLRspInfoData* pRspInfo, int nRequestID, char cIsLast) {}; + + +protected: + virtual ~HLTradeSpi(void) {}; +}; + + +class HLTRADEAPI_EXPORT HLTradeApi +{ +public: + ///创建一个HLTradeApi,可以创建多个,一个API最多只有一个网络通道 + static HLTradeApi* CreateHLTradeApi(void); + + ///获取系统版本号 + ///@return 系统版本号标识字符串 + static const char* GetVersion(void); + + virtual void RegisterNetwork(unsigned short nPort, const char* pszFrontAddr) = 0; + + virtual void RegisterSpi(HLTradeSpi* pHLTradeSpi) = 0; + + virtual int Init(void) = 0; + + virtual void Release (void) = 0; + + ///用户登录请求 + virtual int ReqUserLogin(HLApiReqUserLoginData* pReqUserLogin, int nRequestID) = 0; + + ///委托请求 + virtual int ReqOrder(HLApiCmdOrder* pReqOrder, int nRequestID) = 0; + + ///撤单请求 + virtual int ReqCancelOrder(HLApiCmdCancelOrder* pReqOrder, int nRequestID) = 0; + + ///批量委托请求 + virtual int ReqBatchOrder(HLApiCmdBatchOrder* pReqBatchOrder, int nRequestID) = 0; + + ///ETF清单请求 + virtual int ReqETFList(HLApiReqETFList* pReqETFList, int nRequestID) = 0; + + ///ETF申赎请求 + virtual int ReqETFSubscribe(HLApiCmdETFSubscribe* pReqETFSubscribe, int nRequestID) = 0; + + ///查委托请求 + virtual int ReqQryOrder(HLApiCmdOrderQry* pReqQryOrder, int nRequestID) = 0; + + ///资金查询请求 + virtual int ReqQryMoneyInfo(HLApiCmdMoneyInfoQry* pReqQryAvailableMoneyInfo, int nRequestID) = 0; + + ///可用证券查询请求 + virtual int ReqQryAvlStockInfo(HLApiCmdAvlStocksInfoQry* pReqQryAvailableStockInfo, int nRequestID) = 0; + + ///当日成交查询请求 + virtual int ReqQryTodayDeal(HLApiCmdTodayDealQry* pReqQryTodayDeal, int nRequestID) = 0; + + ///分级基金成分信息查询 + virtual int ReqQryStruFundInfo(const HLApiCmdStruFundInfoQry* pReqQryStruFundInfo, int nRequestID) = 0; + + ///修改委托状态请求 + virtual int ReqChangeOrderStatus (HLApiRspOrder *pReqUserLogin, int nRequestID) = 0; + +protected: + virtual ~HLTradeApi (void); + +}; + + +#endif /*HLTRADEAPI_HHH_*/ + + diff --git a/include/HLAPI/HLTradeApi.lib b/include/HLAPI/HLTradeApi.lib new file mode 100644 index 0000000..4006dd3 Binary files /dev/null and b/include/HLAPI/HLTradeApi.lib differ diff --git a/include/HLAPI/HLTradeApid.dll b/include/HLAPI/HLTradeApid.dll new file mode 100644 index 0000000..b9767df Binary files /dev/null and b/include/HLAPI/HLTradeApid.dll differ diff --git a/include/HLAPI/HLTradeApid.lib b/include/HLAPI/HLTradeApid.lib new file mode 100644 index 0000000..afa55c5 Binary files /dev/null and b/include/HLAPI/HLTradeApid.lib differ diff --git a/include/HLAPI/HLUserApiDefine.h b/include/HLAPI/HLUserApiDefine.h new file mode 100644 index 0000000..877db35 --- /dev/null +++ b/include/HLAPI/HLUserApiDefine.h @@ -0,0 +1,527 @@ +#ifndef HLUSERAPIDEFINE_HHH_ +#define HLUSERAPIDEFINE_HHH_ + +//errcode +const int API_ERROR_OK = 0; //OK +const int API_ERROR_DISCONNECTED = -1; //未连接 +const int API_ERROR_NORESULT = 0xD000; //没有查询结果 + +#define API_PACKET_FIRST 0x01 //首包标记 +#define API_PACKET_LAST 0x02 //尾包标记 + +#define API_ERRORMSG_LEN 256 +#define API_APP_LEN 16 +#define API_CLIENT_LEN 16 +#define API_ORDERID_LEN 11 +#define API_ACCOUNT_LEN 16 +#define API_PSW_LEN 16 +#define API_IPADDR 16 +#define API_CLIENTINFO 32 +#define API_DATE_LEN 9 //日期结构 yyyymmdd +#define API_TIME_LEN 9 //时间结构 hh:mm:ss +#define API_MARKET_LEN 4 +#define API_SYMBOL_LEN 8 +#define API_SYMBOLNAME_LEN 16 +#define API_SAVE_LEN 32 +#define API_PREFIX_LEN 4 +#define API_MATCHED_SN_LEN 17 //成交编号 +#define API_STOCK_PBU_LEN 9 //交易单元 +#define API_TRADE_COUNT_LEN 11 //证券帐户 +#define API_QUERY_POS_LEN 33 //定为串 +#define API_ORD_TIME_LEN 33 //委托时间 +#define API_ORDER_ID_LEN 11 //合同序号 + + +#define API_MAX_BATCH_ORDER_COUNT 15 //批量委托最大数量 +#define API_MAX_DAY_ORDER_RECORDSET_COUNT 100 //当日委托查询返回记录最大数量 +#define API_MAX_AVL_STK_COUNTS 100 //查询可用股份时,每次返回最大股份数量 + +//交易所 +#define API_EXCH_SZ "SZ" //深圳 +#define API_EXCH_SH "SH" //上海 +#define API_EXCH_CF "CF" //中国金融期货交易所 +#define API_EXCH_SP "SP" //商品期货 + +typedef char API_MARKETFLAG[API_MARKET_LEN]; + +//板块标志 +typedef enum +{ + SectorSHA = '1', //上海A股 + SectorSZA = '2', //深圳A股 + SectorSHB = '3', //上海B股 + SectorSZB = '4', //深圳B股 + SectorSBA = '5', //三板A + SectorSBB = '6', //三板B +} SECTORSYMBOL; + +//成交状态集合 +typedef enum +{ + MatchStatusDone = 0, //不包含撤单记录 + MatchStatusCancel = 1, //包含撤单记录 +} MATCHSTATUSSET; + +//证券业务 +typedef enum +{ + ETFSubcribe = 1, //申购 + ETFRedeem = 2, //赎回 + StockBuy = 100, //证券买入 + StockSel = 101, //证券卖出 + + Fund_Creation = 102, //基金申购 + Fund_Redemption = 103, //基金赎回 + Fund_Merger = 104, //基金合并 + Fund_Demerger = 105, //基金分拆 + +} STOCKBIZ; + +//报价方式 +typedef enum +{ + StockLimit = 100, //订单申报-限价委托(支持深沪市) + //StockCancel = 101, //撤单申报 + StockAction1 = 120, //订单申报-最优成交转价(支持深沪市) + StockAction2 = 121, //订单申报-最优成交剩撤(支持深市) + StockAction3 = 122, //订单申报-全成交或撤销(支持深市) + StockAction4 = 123, //订单申报-本方最优价格(支持深市) + StockAction5 = 124, //订单申报-对手最优价格(支持深市) + StockAction6 = 125, //订单申报-即时成交剩撤(支持沪市) +} STOCKBIZACTION; + +//委托单类型 +typedef enum +{ + OrderLimited = 0, //限价 + OrderAutoOffer = 1, //自动盘口 + OrderAskPrice1 = 2, //卖一价 + OrderBidPrice1 = 3, //买一价 +} ORDERPRICETYPE; + +//委托状态 +typedef enum +{ + OrderNotSend = 'o', //未报 + OrderSending = 's', //正报 + OrderNewComer = 'n', //待报 + OrderSended = 'a', //已报 + OrderToBeDel = '3', //已报待撤 + OrderPartCToBeDel = '4', //部成待撤 + OrderPartDeleted = 'b', //部成部撤 + OrderToBeDelete = 'f', //场外撤单 + OrderPartCDeleted = 'p', //部成 + OrderCompleted = 'c', //全成 + OrderUseless = 'e', //错单 + OrderBeDeleted = 'd', //全撤 + OrderConfirmed = 'D', //已确认 + OrderDenied = 'E', //已否决 + OrderCanceling = 'Z', //正在撤单 + LogoicOrderAbandoned= 'L', //逻辑单作废 +} ORDERSTATUS; + +//推送标志 +typedef enum +{ + MatchPushDeal = 0, //成交推送 + MatchPushCancel = 1, //撤单推送 + MatchPushOrderFailed = 2, //委托失败推送 + MatchPushCancelFailed = 4, //撤单失败推送 +} MATCHPUSHFLAG; + +//委托有效标志 +typedef enum +{ + OrderFlagInvalid = 0, //无效 + OrderFlagValid = 1, //有效 +} ORDERVALIDFLAG; + +//撤单标志 +typedef enum +{ + FlagNormal = 'F', //正常 + FlagCanceled = 'T', //撤单 +} ISWITHDRAW; + +//币种 +typedef enum +{ + CurrencyRMB = 1, //人民币 + CurrencyUSD = 2, //美元 + CurrencyHK = 3, //港币 +} CURRENCYTYPE; + +//资金状态 +typedef enum +{ + FundStatusNormal = 0, //正常 + FundStatusCancel = 9, //销户 +} FUNDSTATUS; + +//ETF申赎标志 +typedef enum +{ + ETFSubcribeFlag = 1, //申购 + ETFRedeemFlag = 2, //赎回 +} ETFSUBSCRIBEFLAG; + + +//委托数据 +typedef struct +{ + char chSecurityCode[API_SYMBOL_LEN]; //证券代码 + double dOrderPrice; //委托价 + ORDERPRICETYPE eOrderPriceType; //委托价方式 + int nOrderQty; //委托股数 + STOCKBIZ eStockBiz; //证券业务 + STOCKBIZACTION eStockBizAction; //报价方式 +} ORDERDATA; + + +//证券数据 +struct HLApiSecurityCode +{ + int nType; //证券类型 + char chSecurityCode[API_SYMBOL_LEN]; //证券代码 + char chSymbol[API_SYMBOLNAME_LEN]; //证券名称 +}; + +//ETF股票数据 +struct ETFItemData +{ + char chSecurityCode[API_SYMBOL_LEN]; //股票代码 + char chSymbol[API_SYMBOLNAME_LEN]; //股票名称 + SECTORSYMBOL eSectorSymbol; //板块标志 + int nNum; //股票数量 + int nFlag; //现金替代标志 + double dRatio; //溢价比例 + double dReplaceAmount; //替代金额 +}; + +///响应信息 +struct CHLRspInfoData +{ + int ErrorID; + char ErrorMsg[API_ERRORMSG_LEN]; +}; + +//用户登录请求 +struct HLApiReqUserLoginData +{ + char chApplication[API_APP_LEN]; //应用类型 + char chClientID[API_CLIENT_LEN]; //客户号 + char chPassword[API_PSW_LEN]; //密码 + char chDynPassword[API_PSW_LEN]; //动态密码 + char chCurIP[API_IPADDR]; //IP + int nUserType; //客户类型 + char chClientInfo[API_CLIENTINFO]; //客户端信息 +}; + +//用户登录响应 +struct HLApiRspUserLoginData +{ + char chTradingDay[API_DATE_LEN]; //交易日 + char chLoginTime[API_TIME_LEN]; //登录时间 + char chClientID[API_CLIENT_LEN]; //客户号 + int nSessionID; //session id + char chSvrInfo[API_CLIENTINFO]; //服务端信息 + int nMarkets; //市场个数 + API_MARKETFLAG* chMarketFlag; //市场标志(SZ;SH;HK;CF) + int* nDynDate; //动态数据日期 +}; + +//市场索引请求 +struct HLApiReqCodeTable +{ + char chMarket[API_MARKET_LEN]; //市场标志(SZ;SH;HK;CF) +}; + +//市场索引请求应答 +struct HLApiRspCodeTable +{ + API_MARKETFLAG chMarketFlag; //市场标志(SZ;SH;HK;CF) + int nDate; //数据日期 + int nCount; //数据总数(-1:未授权) + HLApiSecurityCode* pSecurityCode; //数据 +}; + +//当日ETF清单请求 +struct HLApiReqETFList +{ + char chSecurityCode[API_SYMBOL_LEN]; //证券代码 +}; + +//ETF清单请求响应 +struct HLApiRspETFList +{ + char chSecurityCode[API_SYMBOL_LEN]; //ETF代码 + char chSymbol[API_SYMBOLNAME_LEN]; //ETF名称 + char szFundid[API_SYMBOL_LEN]; //一级市场代码 + SECTORSYMBOL eSectorSymbol; //板块标志 + int nCreationRedemptionUnit; //最小申购赎回单位 + double dMaxCashRatio; //现金替代比例上限 + int nCreationRedemption; //基金当天申购赎回状态(1,0) + double dEstimateCashComponent; //T日预估现金余额 + int nTradingDay; //T日日期 + double dCashComponent; //T-1日现金差额(单位:元) + double dNAVperCU; //T-1日最小申购、赎回单位资产净值(单位:元) + ETFItemData* pETFItemData; //成份股数组指针 + int nItemDataSize; //成份股数量 +}; + +//行情订阅请求 +struct HLApiReqMarketData +{ + int nType; //命令类型(0订阅 1退订) + char chMarket[API_MARKET_LEN]; //市场标志(SZ;SH;HK;CF) + char chSecurityCode[API_SYMBOL_LEN]; //股票代码(空则为全市场行情) +}; + +//行情订阅请求应答 +struct HLApiRspMarketData +{ + int nResult; //命令结果(0成功 1失败) + int nType; //命令类型(0订阅 1退订) + char chMarket[API_MARKET_LEN]; //市场标志(SZ;SH;HK;CF) + char chSecurityCode[API_SYMBOL_LEN]; //股票代码(空则为全市场行情) +}; + +//行情信息 +struct HLApiMarketData +{ + char chMarket[API_MARKET_LEN]; //市场标志(SZ;SH;HK;CF) + char chSymbol[API_SYMBOL_LEN]; //股票代码 + int nTime; //时间(HHMMSSmmm) + int nStatus; //状态 + double dPreClose; //前收盘价 + double dOpen; //开盘价 + double dHigh; //最高价 + double dLow; //最低价 + double dMatch; //最新价 + double dAskPrice[10]; //申卖价 + unsigned int nAskVol[10]; //申卖量 + double dBidPrice[10]; //申买价 + unsigned int nBidVol[10]; //申买量 + unsigned int nNumTrades; //成交笔数 + long long iVolume; //成交总量 + long long iTurnover; //成交总金额 + long long nTotalBidVol; //委托买入总量 + long long nTotalAskVol; //委托卖出总量 + double dHighLimited; //涨停价 + double dLowLimited; //跌停价 +}; + +//用户委托请求 +struct HLApiCmdOrder +{ + char chClientID[API_CLIENT_LEN]; //客户号 + char chAccountNO[API_ACCOUNT_LEN]; //资金账户 + //int nOrderBsn; //委托批号(0则系统生成) + ORDERDATA stOrderData; //委托数据 + int nSaveInt1; //客户保留字段1 + int nSaveInt2; //客户保留字段2 + char chSaveString[API_SAVE_LEN]; //客户保留字段3 +}; + +//用户委托请求应答 +struct HLApiRspOrder +{ + char chClientID[API_CLIENT_LEN]; //客户号 + char chAccountNO[API_ACCOUNT_LEN]; //资金账户 + char chSecurityCode[API_SYMBOL_LEN]; //证券代码 + char chSecurityName[API_SYMBOLNAME_LEN];//证券名称 + char chOrderID[API_ORDER_ID_LEN]; //合同序号 + ORDERSTATUS eOrderStatus; //委托状态 + STOCKBIZ eStockBiz; //证券业务 + double dOrderPrice; //委托价格 + int nOrderQty; //委托数量 + double dMatchedPrice; //已成均价 + int nMatchedQty; //已成数量 + char chOrderTime[API_ORD_TIME_LEN]; //委托时间 + int nOrderDay; //委托日期 + int nSaveInt1; //客户保留字段1 + int nSaveInt2; //客户保留字段2 + char chSaveString[API_SAVE_LEN]; //客户保留字段3 +}; + +//用户撤单请求 +struct HLApiCmdCancelOrder +{ + char chOrderID[API_ORDERID_LEN]; //合同序号 + char chClientID[API_CLIENT_LEN]; //客户号 + char chAccountNO[API_ACCOUNT_LEN]; //资金账户 +}; + +//用户撤单请求应答 +typedef struct HLApiCmdCancelOrder HLApiRspCancelOrder; + +//用户批量委托请求 +struct HLApiCmdBatchOrder +{ + char chClientID[API_CLIENT_LEN]; //客户号 + char chAccountNO[API_ACCOUNT_LEN]; //资金账户 + int nOrderCount; //委托数,最大个数API_MAX_BATCH_ORDER_COUNT + ORDERDATA stOrderData[API_MAX_BATCH_ORDER_COUNT]; //委托数据 + int nSaveInt1; //客户保留字段1 + int nSaveInt2; //客户保留字段2 + char chSaveString[API_SAVE_LEN]; //客户保留字段3 +}; + +//ETF申赎请求 +struct HLApiCmdETFSubscribe +{ + char chClientID[API_CLIENT_LEN]; //客户号 + char chAccountNO[API_ACCOUNT_LEN]; //资金账户 + ETFSUBSCRIBEFLAG eSubscribeFlag; //申赎标志 + char chSecurityCode[API_SYMBOL_LEN]; //ETF代码 + int nSubscribeQty; //申赎份额 +}; + +//ETF申赎请求应答 +struct HLApiRspETFSubscribe +{ + char chClientID[API_CLIENT_LEN]; //客户号 + char chAccountNO[API_ACCOUNT_LEN]; //资金账户 + ETFSUBSCRIBEFLAG eSubscribeFlag; //申赎标志 + char chSecurityCode[API_SYMBOL_LEN]; //ETF代码 + int nSubscribeQty; //申赎份额 + char chOrderID[API_ORDERID_LEN]; //合同序号 +}; + +//成交、撤单、废单通知推送 +struct HLApiRtnMatchInfo +{ + char chMatchedSN[API_MATCHED_SN_LEN]; //成交编号 + SECTORSYMBOL eSectorSymbol; //板块标志 + char chSecurityCode[API_SYMBOL_LEN]; //证券代码 + char chSecurityName[API_SYMBOLNAME_LEN];//证券名称 + char chClientID[API_CLIENT_LEN]; //客户号 + char chAccountNO[API_ACCOUNT_LEN]; //资金账户 + char chOrderID[API_ORDER_ID_LEN]; //合同序号 + int nMatchedQty; //成交或撤单数量 + double dMatchedPrice; //成交或撤单均价 + int nMatchedDate; //成交或撤单日期 + char chMatchedTime[API_ORD_TIME_LEN]; //成交或撤单时间 + MATCHPUSHFLAG eMatchPushFlag; //推送类型标志 + STOCKBIZ eStockBiz; //证券业务(成交查询时有效) +}; + +typedef struct HLApiRspOrder HLApiRtnOrderInfo; + +typedef struct HLApiRspAvlStocksInfoQry HLApiRtnAvlStockInfo; + +typedef struct HLApiRspMoneyInfoQry HLApiRtnMoneyInfo; + +//委托查询请求 +struct HLApiCmdOrderQry +{ + char chClientID[API_CLIENT_LEN]; //客户号 + char chAccountNO[API_ACCOUNT_LEN]; //资金账户 + char chBeginDate[API_DATE_LEN]; //起始日期(空为查询所有) + char chEndDate[API_DATE_LEN]; //终止日期(空为查询所有) + char chOrderID[API_ORDERID_LEN]; //合同序号(空为查询所有) + char chSecurityCode[API_SYMBOL_LEN]; //证券代码(空为查询所有) + STOCKBIZ eStockBiz; //证券业务(0为查询所有) + double dOrderPrice; //委托价(0为查询所有) + int nOrderQty; //委托股数(0为查询所有) +}; + +//委托查询请求应答 +typedef struct HLApiRspOrder HLApiRspOrderQry; + +//可用资金查询 +struct HLApiCmdMoneyInfoQry +{ + char chClientID[API_CLIENT_LEN]; //客户号 + char chAccountNO[API_ACCOUNT_LEN]; //资金账户 + CURRENCYTYPE eCurrencyType; //币种 +}; + +//可用资金查询应答 +struct HLApiRspMoneyInfoQry +{ + char chClientID[API_CLIENT_LEN]; //客户号 + char chAccountNO[API_ACCOUNT_LEN]; //资金账户 + CURRENCYTYPE eCurrencyType; //币种 + //unsigned short nIntOrg; //内部机构 + //double dMarketValue; //资产总值 + //double dFundValue; //资金资产 + //double dStkValue; //市值 + //double dFundLoan; //融资总金额 + //double dFundPreBln; //资金昨日余额 + double dFundBln; //资金余额 + double dFundAvl; //可用资金 + double dFundWithDraw; //可取资金 + //double dFundUnFrz; //资金解冻金额 + //double dFundTradeFrz; //资金交易冻结金额 + //double dFundTradeUnFrz; //资金交易解冻金额 + //double dFundTradeInTransit; //资金交易在途金额 + //double FundTradeInBln; //资金交易轧差金额 + //FUNDSTATUS nFundStatus; //资金状态(正常、销户) +}; + +//可用股份查询 +struct HLApiCmdAvlStocksInfoQry +{ + char chClientID[API_CLIENT_LEN]; //客户号 + char chAccountNO[API_ACCOUNT_LEN]; //资金账户 + char chSecurityCode[API_SYMBOL_LEN]; //证券代码(空为查询所有) +}; + +//可用股份查询应答 +struct HLApiRspAvlStocksInfoQry +{ + char chClientID[API_CLIENT_LEN]; //客户号 + char chAccountNO[API_ACCOUNT_LEN]; //资金账户 + SECTORSYMBOL eSectorSymbol; //板块标志 + char chSecurityCode[API_SYMBOL_LEN]; //证券代码 + char chSecurityName[API_SYMBOLNAME_LEN];//证券名称 + int nStockBln; //证券余额(含当日成交,既拥股数) + int nStockAvlValue; //可用余额 + int nStockPreBln; //昨日库存 + double dStkValue; //市值 + double dProPrice; //成本价 + int nStockSR; //可申赎数量 + int nStockAskFrn; //卖出冻结 + int nStockBidFrn; //买入冻结 +}; + +//当日成交查询 +struct HLApiCmdTodayDealQry +{ + char chClientID[API_CLIENT_LEN]; //客户号 + char chAccountNO[API_ACCOUNT_LEN]; //资金账户 + char chSecurityCode[API_SYMBOL_LEN]; //证券代码 + MATCHSTATUSSET eMatchStatus; //成交状态集合 +}; + +//当日成交查询应答 +typedef struct HLApiRtnMatchInfo HLApiRspTodayDealQry; + + +//分级基金成分信息查询 +struct HLApiCmdStruFundInfoQry +{ + char chFundCode[API_SYMBOL_LEN]; //母基金代码,空串""则查询整个清单 +}; + + +//分级基金成分信息查询_应答 +struct HLApiRspStruFundInfoQry +{ + char chFundCode[API_SYMBOL_LEN]; //母基金代码 + char chFundName[API_SYMBOLNAME_LEN]; //母基金名称 + char chFundACode[API_SYMBOL_LEN]; //分级A代码 + char chFundAName[API_SYMBOLNAME_LEN]; //分级A名称 + char chFundBCode[API_SYMBOL_LEN]; //分级B代码 + char chFundBName[API_SYMBOLNAME_LEN]; //分级B名称 + int nFundAShare; //分级A比例(0,100), 默认:50 + int nFundBShare; //分级B比例(0,100), 默认:50 +}; + + + +#endif /*HLUSERAPIDEFINE_HHH_*/ + + + diff --git a/include/HLAPI/Qubit_HL_Quote.h b/include/HLAPI/Qubit_HL_Quote.h new file mode 100644 index 0000000..e11e71e --- /dev/null +++ b/include/HLAPI/Qubit_HL_Quote.h @@ -0,0 +1,123 @@ +// Qubit_HL_Quote.h : Qubit_HL_Quote DLL 的主头文件 +// + +#pragma once + + + +// CQubit_HL_QuoteApp +// 有关此类实现的信息,请参阅 Qubit_HL_Quote.cpp +// + +#pragma once + +#include "../include/ApiStruct.h" +#include "../include/HLAPI/HLQuoteApi.h" + + +#pragma comment(lib, "../include/HLAPI/HLQuoteApi.lib") +#pragma comment(lib, "../lib/QuantBox_Queue_x86.lib") + +#include +#include +#include +#include +#include + +using namespace std; + +class CMsgQueue; + +class CMdUserApi : + public HLQuoteSpi +{ + enum RequestType + { + E_Init, + E_ReqUserLoginField, + }; + +public: + CMdUserApi(void); + virtual ~CMdUserApi(void); + + void Register(void* pCallback, void* pClass); + ConfigInfoField* Config(ConfigInfoField* pConfigInfo); + + void Connect(const string& szPath, + ServerInfoField* pServerInfo, + UserInfoField* pUserInfo, + int count); + void Disconnect(); + + //void Subscribe(const string& szInstrumentIDs, const string& szExchageID); + //void Unsubscribe(const string& szInstrumentIDs, const string& szExchageID); + + //void SubscribeQuote(const string& szInstrumentIDs, const string& szExchageID); + //void UnsubscribeQuote(const string& szInstrumentIDs, const string& szExchageID); + +private: + friend void* __stdcall Query(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + void QueryInThread(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + int _Init(); + //登录请求 + void ReqUserLogin(); + int _ReqUserLogin(char type, void* pApi1, void* pApi2, double double1, double double2, void* ptr1, int size1, void* ptr2, int size2, void* ptr3, int size3); + + //订阅行情 + void Subscribe(const set& instrumentIDs, const string& szExchageID); + void SubscribeQuote(const set& instrumentIDs, const string& szExchageID); + + ///当客户端与交易后台建立起通信连接,客户端需要进行登录。 + virtual void OnFrontConnected(); + + ///当客户端与交易后台通信连接断开时,该方法被调用,客户端不需要处理,API会自动重连。 + virtual void OnFrontDisconnected(int nReason); + + ///错误应答 + //@cIsLast 包标志 API_PACKET_FIRST | API_PACKET_LAST 下同 + virtual void OnRspError(CHLRspInfoData *pRspInfo, int nRequestID, char cIsLast); + + ///用户登录应答 + virtual void OnRspUserLogin(HLApiRspUserLoginData *pRspUserLogin, CHLRspInfoData *pRspInfo, int nRequestID, char cIsLast); + + ///用户退出应答 + //virtual void OnRspUserLogout(void *pRspUserLogout, void *pRspInfo, int nRequestID, char cIsLast) {}; + + ///市场索引请求应答 + virtual void OnRspCodeTable(HLApiRspCodeTable *pRspCodeTable, CHLRspInfoData *pRspInfo, int nRequestID, char cIsLast); + + ///行情订阅请求应答 + virtual void OnRspMarketData(HLApiRspMarketData *pRspMarketData, CHLRspInfoData *pRspInfo, int nRequestID, char cIsLast); + + //订阅行情变化通知 + virtual void OnRtnMarketData(HLApiMarketData *pMarketData); + + //全市场行情变化通知(订阅股票代码为空时,为全市场行情推送) + virtual void OnRtnMarketData(HLApiMarketData *pMarketData, int nSize); + virtual void OnRtnPushStkData(HLApiMarketData *pMarketData, int nSize); + +private: + mutex m_csMapInstrumentIDs; + mutex m_csMapQuoteInstrumentIDs; + + atomic m_lRequestID; //请求ID,每次请求前自增 + + set m_setInstrumentIDs; //正在订阅的合约 + set m_setQuoteInstrumentIDs; //正在订阅的合约 + HLQuoteApi* m_pApi; //行情API + + string m_szPath; //生成配置文件的路径 + ServerInfoField m_ServerInfo; + UserInfoField m_UserInfo; + int m_nSleep; + + CMsgQueue* m_msgQueue; //消息队列指针 + CMsgQueue* m_msgQueue_Query; + void* m_pClass; + + CMsgQueue* m_remoteQueue; +}; + + diff --git a/include/HLAPI/SecurityFtdcUserApiDataType.h b/include/HLAPI/SecurityFtdcUserApiDataType.h new file mode 100644 index 0000000..54fc3a0 --- /dev/null +++ b/include/HLAPI/SecurityFtdcUserApiDataType.h @@ -0,0 +1,2102 @@ +///////////////////////////////////////////////////////////////////////// +///@company shanghai liber information Technology Co.,Ltd +///@file SecurityFtdcUserApiDataType.h +///@brief 定义业务数据类型 +///////////////////////////////////////////////////////////////////////// + +#ifndef SECURITY_FTDCDATATYPE_H +#define SECURITY_FTDCDATATYPE_H + +enum SECURITY_TE_RESUME_TYPE +{ + SECURITY_TERT_RESTART = 0, + SECURITY_TERT_RESUME, + SECURITY_TERT_QUICK +}; + +///////////////////////////////////////////////////////////////////////// +///TFtdcErrorIDType是一个错误代码类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcErrorIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcErrorMsgType是一个错误信息类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcErrorMsgType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeIDType是一个交易所代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcExchangeIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeNameType是一个交易所名称类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcExchangeNameType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangePropertyType是一个交易所属性类型 +///////////////////////////////////////////////////////////////////////// +///正常 +#define SECURITY_FTDC_EXP_Normal '0' +///根据成交生成报单 +#define SECURITY_FTDC_EXP_GenOrderByTrade '1' + +typedef char TSecurityFtdcExchangePropertyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeConnectStatusType是一个交易所连接状态类型 +///////////////////////////////////////////////////////////////////////// +///没有任何连接 +#define SECURITY_FTDC_ECS_NoConnection '1' +///已经发出合约查询请求 +#define SECURITY_FTDC_ECS_QryInstrumentSent '2' +///已经获取信息 +#define SECURITY_FTDC_ECS_GotInformation '9' + +typedef char TSecurityFtdcExchangeConnectStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDateType是一个日期类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcDateType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeType是一个时间类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcTimeType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentIDType是一个合约代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcInstrumentIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductNameType是一个产品名称类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcProductNameType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductClassType是一个产品类型类型 +///////////////////////////////////////////////////////////////////////// +///期货 +#define SECURITY_FTDC_PC_Futures '1' +///期权 +#define SECURITY_FTDC_PC_Options '2' +///组合 +#define SECURITY_FTDC_PC_Combination '3' +///即期 +#define SECURITY_FTDC_PC_Spot '4' +///期转现 +#define SECURITY_FTDC_PC_EFP '5' +///证券A股 +#define SECURITY_FTDC_PC_StockA '6' +///证券B股 +#define SECURITY_FTDC_PC_StockB '7' +///ETF +#define SECURITY_FTDC_PC_ETF '8' +///ETF申赎 +#define SECURITY_FTDC_PC_ETFPurRed '9' + +typedef char TSecurityFtdcProductClassType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeMultipleType是一个合约数量乘数类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcVolumeMultipleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceType是一个价格类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcPriceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeType是一个数量类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcVolumeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionTypeType是一个持仓类型类型 +///////////////////////////////////////////////////////////////////////// +///净持仓 +#define SECURITY_FTDC_PT_Net '1' +///综合持仓 +#define SECURITY_FTDC_PT_Gross '2' + +typedef char TSecurityFtdcPositionTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionDateTypeType是一个持仓日期类型类型 +///////////////////////////////////////////////////////////////////////// +///使用历史持仓 +#define SECURITY_FTDC_PDT_UseHistory '1' +///不使用历史持仓 +#define SECURITY_FTDC_PDT_NoUseHistory '2' + +typedef char TSecurityFtdcPositionDateTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcExchangeInstIDType是一个合约在交易所的代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcExchangeInstIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcYearType是一个年份类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcYearType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMonthType是一个月份类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcMonthType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstLifePhaseType是一个合约生命周期状态类型 +///////////////////////////////////////////////////////////////////////// +///未上市 +#define SECURITY_FTDC_IP_NotStart '0' +///上市 +#define SECURITY_FTDC_IP_Started '1' +///停牌 +#define SECURITY_FTDC_IP_Pause '2' +///到期 +#define SECURITY_FTDC_IP_Expired '3' + +typedef char TSecurityFtdcInstLifePhaseType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBoolType是一个布尔型类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcBoolType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightModelIDType是一个股票权限模版代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcRightModelIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightModelNameType是一个股票权限模版名称类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcRightModelNameType[161]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPosTradeTypeType是一个持仓交易类型类型 +///////////////////////////////////////////////////////////////////////// +///今日新增持仓能卖出 +#define SECURITY_FTDC_PTT_CanSelTodayPos '1' +///今日新增持仓不能卖出 +#define SECURITY_FTDC_PTT_CannotSellTodayPos '2' + +typedef char TSecurityFtdcPosTradeTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTraderIDType是一个交易所交易员代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcTraderIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcParticipantIDType是一个会员代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcParticipantIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPasswordType是一个密码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcPasswordType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerIDType是一个经纪公司代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcBrokerIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderLocalIDType是一个本地报单编号类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcOrderLocalIDType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerAbbrType是一个经纪公司简称类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcBrokerAbbrType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerNameType是一个经纪公司名称类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcBrokerNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorIDType是一个投资者代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcInvestorIDType[15]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPartyNameType是一个参与人名称类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcPartyNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIdCardTypeType是一个证件类型类型 +///////////////////////////////////////////////////////////////////////// +///组织机构代码 +#define SECURITY_FTDC_ICT_EID '0' +///身份证 +#define SECURITY_FTDC_ICT_IDCard '1' +///军官证 +#define SECURITY_FTDC_ICT_OfficerIDCard '2' +///警官证 +#define SECURITY_FTDC_ICT_PoliceIDCard '3' +///士兵证 +#define SECURITY_FTDC_ICT_SoldierIDCard '4' +///户口簿 +#define SECURITY_FTDC_ICT_HouseholdRegister '5' +///护照 +#define SECURITY_FTDC_ICT_Passport '6' +///台胞证 +#define SECURITY_FTDC_ICT_TaiwanCompatriotIDCard '7' +///回乡证 +#define SECURITY_FTDC_ICT_HomeComingCard '8' +///营业执照号 +#define SECURITY_FTDC_ICT_LicenseNo '9' +///税务登记号 +#define SECURITY_FTDC_ICT_TaxNo 'A' +///其他证件 +#define SECURITY_FTDC_ICT_OtherCard 'x' + +typedef char TSecurityFtdcIdCardTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIdentifiedCardNoType是一个证件号码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcIdentifiedCardNoType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientIDType是一个交易编码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcClientIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountIDType是一个投资者帐号类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcAccountIDType[15]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcClientTypeType是一个交易编码类型类型 +///////////////////////////////////////////////////////////////////////// +///普通 +#define SECURITY_FTDC_CLT_Normal '1' +///信用交易 +#define SECURITY_FTDC_CLT_Credit '2' +///衍生品账户 +#define SECURITY_FTDC_CLT_Derive '3' +///其他类型 +#define SECURITY_FTDC_CLT_Other '4' + +typedef char TSecurityFtdcClientTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorGroupNameType是一个投资者分组名称类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcInvestorGroupNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserIDType是一个用户代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcUserIDType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserNameType是一个用户名称类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcUserNameType[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionCodeType是一个功能代码类型 +///////////////////////////////////////////////////////////////////////// +///强制用户登出 +#define SECURITY_FTDC_FC_ForceUserLogout '2' +///变更管理用户口令 +#define SECURITY_FTDC_FC_UserPasswordUpdate '3' +///变更经纪公司口令 +#define SECURITY_FTDC_FC_BrokerPasswordUpdate '4' +///变更投资者口令 +#define SECURITY_FTDC_FC_InvestorPasswordUpdate '5' +///报单插入 +#define SECURITY_FTDC_FC_OrderInsert '6' +///报单操作 +#define SECURITY_FTDC_FC_OrderAction '7' +///同步系统数据 +#define SECURITY_FTDC_FC_SyncSystemData '8' +///同步经纪公司数据 +#define SECURITY_FTDC_FC_SyncBrokerData '9' +///超级查询 +#define SECURITY_FTDC_FC_SuperQuery 'B' +///报单插入 +#define SECURITY_FTDC_FC_ParkedOrderInsert 'C' +///报单操作 +#define SECURITY_FTDC_FC_ParkedOrderAction 'D' +///同步动态令牌 +#define SECURITY_FTDC_FC_SyncOTP 'E' +///未知单操作 +#define SECURITY_FTDC_FC_UnkownOrderAction 'F' +///转托管 +#define SECURITY_FTDC_FC_DepositoryTransfer 'G' +///余券划转 +#define SECURITY_FTDC_FC_ExcessStockTransfer 'H' + +typedef char TSecurityFtdcFunctionCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserTypeType是一个用户类型类型 +///////////////////////////////////////////////////////////////////////// +///投资者 +#define SECURITY_FTDC_UT_Investor '0' +///操作员 +#define SECURITY_FTDC_UT_Operator '1' +///管理员 +#define SECURITY_FTDC_UT_SuperUser '2' + +typedef char TSecurityFtdcUserTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerFunctionCodeType是一个经纪公司功能代码类型 +///////////////////////////////////////////////////////////////////////// +///强制用户登出 +#define SECURITY_FTDC_BFC_ForceUserLogout '1' +///变更用户口令 +#define SECURITY_FTDC_BFC_UserPasswordUpdate '2' +///同步经纪公司数据 +#define SECURITY_FTDC_BFC_SyncBrokerData '3' +///报单插入 +#define SECURITY_FTDC_BFC_OrderInsert '5' +///报单操作 +#define SECURITY_FTDC_BFC_OrderAction '6' +///全部查询 +#define SECURITY_FTDC_BFC_AllQuery '7' +///未知单操作 +#define SECURITY_FTDC_BFC_UnkownOrderAction '8' +///转托管 +#define SECURITY_FTDC_BFC_DepositoryTransfer '9' +///余券划转 +#define SECURITY_FTDC_BFC_ExcessStockTransfer 'A' +///资金内转 +#define SECURITY_FTDC_BFC_FundInterTransfer 'B' +///系统功能:登入/登出/修改密码等 +#define SECURITY_FTDC_BFC_log 'a' +///基本查询:查询基础数据,如合约,交易所等常量 +#define SECURITY_FTDC_BFC_BaseQry 'b' +///交易查询:如查成交,委托 +#define SECURITY_FTDC_BFC_TradeQry 'c' +///交易功能:报单,撤单 +#define SECURITY_FTDC_BFC_Trade 'd' +///转账 +#define SECURITY_FTDC_BFC_Virement 'e' +///查询/管理:查询会话,踢人等 +#define SECURITY_FTDC_BFC_Session 'g' +///同步动态令牌 +#define SECURITY_FTDC_BFC_SyncOTP 'E' + +typedef char TSecurityFtdcBrokerFunctionCodeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCurrencyCodeType是一个币种类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCurrencyCodeType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMoneyType是一个资金类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcMoneyType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRatioType是一个比率类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcRatioType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAccountTypeType是一个账户类型类型 +///////////////////////////////////////////////////////////////////////// +///普通账户 +#define SECURITY_FTDC_AcT_Normal '1' +///信用账户 +#define SECURITY_FTDC_AcT_Credit '2' +///衍生品账户 +#define SECURITY_FTDC_AcT_Derive '3' +///其他类型 +#define SECURITY_FTDC_AcT_Other '4' + +typedef char TSecurityFtdcAccountTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDepartmentRangeType是一个投资者范围类型 +///////////////////////////////////////////////////////////////////////// +///所有 +#define SECURITY_FTDC_DR_All '1' +///组织架构 +#define SECURITY_FTDC_DR_Group '2' +///单一投资者 +#define SECURITY_FTDC_DR_Single '3' + +typedef char TSecurityFtdcDepartmentRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserRightTypeType是一个客户权限类型类型 +///////////////////////////////////////////////////////////////////////// +///登录 +#define SECURITY_FTDC_URT_Logon '1' +///银期转帐 +#define SECURITY_FTDC_URT_Transfer '2' +///邮寄结算单 +#define SECURITY_FTDC_URT_EMail '3' +///传真结算单 +#define SECURITY_FTDC_URT_Fax '4' +///条件单 +#define SECURITY_FTDC_URT_ConditionOrder '5' + +typedef char TSecurityFtdcUserRightTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProductInfoType是一个产品信息类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcProductInfoType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthCodeType是一个客户端认证码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcAuthCodeType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLargeVolumeType是一个大额数量类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcLargeVolumeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMillisecType是一个时间(毫秒)类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcMillisecType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHedgeFlagType是一个投机套保标志类型 +///////////////////////////////////////////////////////////////////////// +///投机 +#define SECURITY_FTDC_HF_Speculation '1' +///套保 +#define SECURITY_FTDC_HF_Hedge '3' + +typedef char TSecurityFtdcHedgeFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDirectionType是一个买卖方向类型 +///////////////////////////////////////////////////////////////////////// +///买 +#define SECURITY_FTDC_D_Buy '0' +///卖 +#define SECURITY_FTDC_D_Sell '1' +///ETF申购 +#define SECURITY_FTDC_D_ETFPur '2' +///ETF赎回 +#define SECURITY_FTDC_D_ETFRed '3' +///现金替代,只用作回报 +#define SECURITY_FTDC_D_CashIn '4' +///债券入库 +#define SECURITY_FTDC_D_PledgeBondIn '5' +///债券出库 +#define SECURITY_FTDC_D_PledgeBondOut '6' +///配股 +#define SECURITY_FTDC_D_Rationed '7' +///转托管 +#define SECURITY_FTDC_D_DepositoryTransfer '8' +///信用账户配股 +#define SECURITY_FTDC_D_CreditRationed '9' +///担保品买入 +#define SECURITY_FTDC_D_BuyCollateral 'A' +///担保品卖出 +#define SECURITY_FTDC_D_SellCollateral 'B' +///担保品转入 +#define SECURITY_FTDC_D_CollateralTransferIn 'C' +///担保品转出 +#define SECURITY_FTDC_D_CollateralTransferOut 'D' +///融资买入 +#define SECURITY_FTDC_D_MarginTrade 'E' +///融券卖出 +#define SECURITY_FTDC_D_ShortSell 'F' +///卖券还款 +#define SECURITY_FTDC_D_RepayMargin 'G' +///买券还券 +#define SECURITY_FTDC_D_RepayStock 'H' +///直接还款 +#define SECURITY_FTDC_D_DirectRepayMargin 'I' +///直接还券 +#define SECURITY_FTDC_D_DirectRepayStock 'J' +///余券划转 +#define SECURITY_FTDC_D_ExcessStockTransfer 'K' +///OF申购 +#define SECURITY_FTDC_D_OFPur 'L' +///OF赎回 +#define SECURITY_FTDC_D_OFRed 'M' +///SF拆分 +#define SECURITY_FTDC_D_SFSplit 'N' +///SF合并 +#define SECURITY_FTDC_D_SFMerge 'O' +///备兑 +#define SECURITY_FTDC_D_Covered 'P' +///证券冻结(开)/解冻(平) +#define SECURITY_FTDC_D_Freeze 'Q' +///行权 +#define SECURITY_FTDC_D_Execute 'R' +///CB回售 +#define SECURITY_FTDC_D_CBRed 'S' +///CB转股 +#define SECURITY_FTDC_D_CBConv 'T' + +typedef char TSecurityFtdcDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeIDType是一个成交编号类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcTradeIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeTypeType是一个成交类型类型 +///////////////////////////////////////////////////////////////////////// +///普通成交 +#define SECURITY_FTDC_TRDT_Common '0' +///期权执行 +#define SECURITY_FTDC_TRDT_OptionsExecution '1' +///OTC成交 +#define SECURITY_FTDC_TRDT_OTC '2' +///期转现衍生成交 +#define SECURITY_FTDC_TRDT_EFPDerived '3' +///组合衍生成交 +#define SECURITY_FTDC_TRDT_CombinationDerived '4' +///ETF申购 +#define SECURITY_FTDC_TRDT_EFTPurchase '5' +///ETF赎回 +#define SECURITY_FTDC_TRDT_EFTRedem '6' + +typedef char TSecurityFtdcTradeTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCreationredemptionStatusType是一个基金当天申购赎回状态类型 +///////////////////////////////////////////////////////////////////////// +///不允许申购赎回 +#define SECURITY_FTDC_CDS_Forbidden '0' +///表示允许申购和赎回 +#define SECURITY_FTDC_CDS_Allow '1' +///允许申购、不允许赎回 +#define SECURITY_FTDC_CDS_OnlyPurchase '2' +///不允许申购、允许赎回 +#define SECURITY_FTDC_CDS_OnlyRedeem '3' + +typedef char TSecurityFtdcCreationredemptionStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcETFCurrenceReplaceStatusType是一个ETF现金替代标志类型 +///////////////////////////////////////////////////////////////////////// +///禁止现金替代 +#define SECURITY_FTDC_ETFCRS_Forbidden '0' +///可以现金替代 +#define SECURITY_FTDC_ETFCRS_Allow '1' +///必须现金替代 +#define SECURITY_FTDC_ETFCRS_Force '2' +///跨市场股票退补现金替代 +#define SECURITY_FTDC_ETFCRS_CrossMarketComp '3' +///跨市场必须现金替代 +#define SECURITY_FTDC_ETFCRS_CrossMarketFroce '4' + +typedef char TSecurityFtdcETFCurrenceReplaceStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInterestType是一个利息类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcInterestType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRepurchaseMaxTimesType是一个正回购放大倍数类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcRepurchaseMaxTimesType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCapitalStockTypeType是一个股本类型类型 +///////////////////////////////////////////////////////////////////////// +///总通股本 +#define SECURITY_FTDC_CPTSTOCK_TOTALSTOCK '1' +///流通股本 +#define SECURITY_FTDC_CPTSTOCK_CIRCULATION '2' + +typedef char TSecurityFtdcCapitalStockTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarginPriceTypeType是一个保证金价格类型类型 +///////////////////////////////////////////////////////////////////////// +///昨结算价 +#define SECURITY_FTDC_MPT_PreSettlementPrice '1' +///最新价 +#define SECURITY_FTDC_MPT_SettlementPrice '2' +///成交均价 +#define SECURITY_FTDC_MPT_AveragePrice '3' +///开仓价 +#define SECURITY_FTDC_MPT_OpenPrice '4' + +typedef char TSecurityFtdcMarginPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAlgorithmType是一个盈亏算法类型 +///////////////////////////////////////////////////////////////////////// +///浮盈浮亏都计算 +#define SECURITY_FTDC_AG_All '1' +///浮盈不计,浮亏计 +#define SECURITY_FTDC_AG_OnlyLost '2' +///浮盈计,浮亏不计 +#define SECURITY_FTDC_AG_OnlyGain '3' +///浮盈浮亏都不计算 +#define SECURITY_FTDC_AG_None '4' + +typedef char TSecurityFtdcAlgorithmType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIncludeCloseProfitType是一个是否包含平仓盈利类型 +///////////////////////////////////////////////////////////////////////// +///包含平仓盈利 +#define SECURITY_FTDC_ICP_Include '0' +///不包含平仓盈利 +#define SECURITY_FTDC_ICP_NotInclude '2' + +typedef char TSecurityFtdcIncludeCloseProfitType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAllWithoutTradeType是一个是否受可提比例限制类型 +///////////////////////////////////////////////////////////////////////// +///不受可提比例限制 +#define SECURITY_FTDC_AWT_Enable '0' +///受可提比例限制 +#define SECURITY_FTDC_AWT_Disable '2' +///无仓不受可提比例限制 +#define SECURITY_FTDC_AWT_NoHoldEnable '3' + +typedef char TSecurityFtdcAllWithoutTradeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHandlePositionAlgoIDType是一个持仓处理算法编号类型 +///////////////////////////////////////////////////////////////////////// +///基本 +#define SECURITY_FTDC_HPA_Base '1' +///非交易 +#define SECURITY_FTDC_HPA_NoneTrade '4' +///证券 +#define SECURITY_FTDC_HPA_Stock '5' + +typedef char TSecurityFtdcHandlePositionAlgoIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeParamIDType是一个交易系统参数代码类型 +///////////////////////////////////////////////////////////////////////// +///系统加密算法 +#define SECURITY_FTDC_TPID_EncryptionStandard 'E' +///用户最大会话数 +#define SECURITY_FTDC_TPID_SingleUserSessionMaxNum 'S' +///最大连续登录失败数 +#define SECURITY_FTDC_TPID_LoginFailMaxNum 'L' +///是否强制认证 +#define SECURITY_FTDC_TPID_IsAuthForce 'A' +///是否生成用户事件 +#define SECURITY_FTDC_TPID_GenUserEvent 'G' +///起始报单本地编号 +#define SECURITY_FTDC_TPID_StartOrderLocalID 'O' +///融资融券买券还券算法 +#define SECURITY_FTDC_TPID_RepayStockAlgo 'R' +///衍生品账户资金提取线 +#define SECURITY_FTDC_TPID_DeriveWithdrawRatio 'D' + +typedef char TSecurityFtdcTradeParamIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementParamValueType是一个参数代码值类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcSettlementParamValueType[256]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMemoType是一个备注类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcMemoType[161]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriorityType是一个优先级类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcPriorityType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderRefType是一个报单引用类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcOrderRefType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMarketIDType是一个市场代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcMarketIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcMacAddressType是一个Mac地址类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcMacAddressType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentNameType是一个合约名称类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcInstrumentNameType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSysIDType是一个报单编号类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcOrderSysIDType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIPAddressType是一个IP地址类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcIPAddressType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIPPortType是一个IP端口类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcIPPortType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProtocolInfoType是一个协议信息类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcProtocolInfoType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDepositSeqNoType是一个出入金流水号类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcDepositSeqNoType[15]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSystemNameType是一个系统名称类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcSystemNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorRangeType是一个投资者范围类型 +///////////////////////////////////////////////////////////////////////// +///所有 +#define SECURITY_FTDC_IR_All '1' +///投资者组 +#define SECURITY_FTDC_IR_Group '2' +///单一投资者 +#define SECURITY_FTDC_IR_Single '3' + +typedef char TSecurityFtdcInvestorRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDataSyncStatusType是一个数据同步状态类型 +///////////////////////////////////////////////////////////////////////// +///未同步 +#define SECURITY_FTDC_DS_Asynchronous '1' +///同步中 +#define SECURITY_FTDC_DS_Synchronizing '2' +///已同步 +#define SECURITY_FTDC_DS_Synchronized '3' + +typedef char TSecurityFtdcDataSyncStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTraderConnectStatusType是一个交易所交易员连接状态类型 +///////////////////////////////////////////////////////////////////////// +///没有任何连接 +#define SECURITY_FTDC_TCS_NotConnected '1' +///已经连接 +#define SECURITY_FTDC_TCS_Connected '2' +///已经发出合约查询请求 +#define SECURITY_FTDC_TCS_QryInstrumentSent '3' +///订阅私有流 +#define SECURITY_FTDC_TCS_SubPrivateFlow '4' + +typedef char TSecurityFtdcTraderConnectStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderActionStatusType是一个报单操作状态类型 +///////////////////////////////////////////////////////////////////////// +///已经提交 +#define SECURITY_FTDC_OAS_Submitted 'a' +///已经接受 +#define SECURITY_FTDC_OAS_Accepted 'b' +///已经被拒绝 +#define SECURITY_FTDC_OAS_Rejected 'c' + +typedef char TSecurityFtdcOrderActionStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderStatusType是一个报单状态类型 +///////////////////////////////////////////////////////////////////////// +///全部成交 +#define SECURITY_FTDC_OST_AllTraded '0' +///部分成交还在队列中 +#define SECURITY_FTDC_OST_PartTradedQueueing '1' +///部分成交不在队列中 +#define SECURITY_FTDC_OST_PartTradedNotQueueing '2' +///未成交还在队列中 +#define SECURITY_FTDC_OST_NoTradeQueueing '3' +///未成交不在队列中 +#define SECURITY_FTDC_OST_NoTradeNotQueueing '4' +///撤单 +#define SECURITY_FTDC_OST_Canceled '5' +///未知 +#define SECURITY_FTDC_OST_Unknown 'a' +///尚未触发 +#define SECURITY_FTDC_OST_NotTouched 'b' +///已触发 +#define SECURITY_FTDC_OST_Touched 'c' + +typedef char TSecurityFtdcOrderStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSubmitStatusType是一个报单提交状态类型 +///////////////////////////////////////////////////////////////////////// +///已经提交 +#define SECURITY_FTDC_OSS_InsertSubmitted '0' +///撤单已经提交 +#define SECURITY_FTDC_OSS_CancelSubmitted '1' +///修改已经提交 +#define SECURITY_FTDC_OSS_ModifySubmitted '2' +///已经接受 +#define SECURITY_FTDC_OSS_Accepted '3' +///报单已经被拒绝 +#define SECURITY_FTDC_OSS_InsertRejected '4' +///撤单已经被拒绝 +#define SECURITY_FTDC_OSS_CancelRejected '5' +///改单已经被拒绝 +#define SECURITY_FTDC_OSS_ModifyRejected '6' + +typedef char TSecurityFtdcOrderSubmitStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPositionDateType是一个持仓日期类型 +///////////////////////////////////////////////////////////////////////// +///今日持仓 +#define SECURITY_FTDC_PSD_Today '1' +///历史持仓 +#define SECURITY_FTDC_PSD_History '2' + +typedef char TSecurityFtdcPositionDateType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradingRoleType是一个交易角色类型 +///////////////////////////////////////////////////////////////////////// +///代理 +#define SECURITY_FTDC_ER_Broker '1' +///自营 +#define SECURITY_FTDC_ER_Host '2' +///做市商 +#define SECURITY_FTDC_ER_Maker '3' + +typedef char TSecurityFtdcTradingRoleType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPosiDirectionType是一个持仓多空方向类型 +///////////////////////////////////////////////////////////////////////// +///净 +#define SECURITY_FTDC_PD_Net '1' +///多头 +#define SECURITY_FTDC_PD_Long '2' +///空头 +#define SECURITY_FTDC_PD_Short '3' +///备兑 +#define SECURITY_FTDC_PD_Covered '4' + +typedef char TSecurityFtdcPosiDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderPriceTypeType是一个报单价格条件类型 +///////////////////////////////////////////////////////////////////////// +///即时成交剩余撤销市价单 +#define SECURITY_FTDC_OPT_AnyPrice '1' +///限价 +#define SECURITY_FTDC_OPT_LimitPrice '2' +///最优五档即时成交剩余撤销市价单 +#define SECURITY_FTDC_OPT_BestPrice '3' +///最优五档即时成交剩余转限价市价单 +#define SECURITY_FTDC_OPT_BestLimitPrice '4' +///全部成交或撤销市价单 +#define SECURITY_FTDC_OPT_AllPrice '5' +///本方最优价格市价单 +#define SECURITY_FTDC_OPT_ForwardBestPrice '6' +///对方最优价格市价单 +#define SECURITY_FTDC_OPT_ReverseBestPrice '7' +///即时成交剩余转限价市价单 +#define SECURITY_FTDC_OPT_Any2LimitPrice '8' +///全部成交或撤销限价单 +#define SECURITY_FTDC_OPT_AllLimitPrice '9' +///激活A股网络密码服务代码 +#define SECURITY_FTDC_OPT_ActiveANetPassSvrCode 'G' +///注销A股网络密码服务代码 +#define SECURITY_FTDC_OPT_InactiveANetPassSvrCode 'H' +///激活B股网络密码服务代码 +#define SECURITY_FTDC_OPT_ActiveBNetPassSvrCode 'I' +///注销B股网络密码服务代码 +#define SECURITY_FTDC_OPT_InactiveBNetPassSvrCode 'J' +///回购注销 +#define SECURITY_FTDC_OPT_Repurchase 'K' +///指定撤销 +#define SECURITY_FTDC_OPT_DesignatedCancel 'L' +///指定登记 +#define SECURITY_FTDC_OPT_Designated 'M' +///证券参与申购 +#define SECURITY_FTDC_OPT_SubscribingShares 'N' +///证券参与配股 +#define SECURITY_FTDC_OPT_Split 'O' +///要约收购登记 +#define SECURITY_FTDC_OPT_TenderOffer 'P' +///要约收购撤销 +#define SECURITY_FTDC_OPT_TenderOfferCancel 'Q' +///证券投票 +#define SECURITY_FTDC_OPT_Ballot 'R' +///可转债转换登记 +#define SECURITY_FTDC_OPT_ConvertibleBondsConvet 'S' +///可转债回售登记 +#define SECURITY_FTDC_OPT_ConvertibleBondsRepurchase 'T' +///权证行权 +#define SECURITY_FTDC_OPT_Exercise 'U' +///开放式基金申购 +#define SECURITY_FTDC_OPT_PurchasingFunds 'V' +///开放式基金赎回 +#define SECURITY_FTDC_OPT_RedemingFunds 'W' +///开放式基金认购 +#define SECURITY_FTDC_OPT_SubscribingFunds 'X' +///开放式基金转托管转出 +#define SECURITY_FTDC_OPT_LOFIssue 'Y' +///开放式基金设置分红方式 +#define SECURITY_FTDC_OPT_LOFSetBonusType 'Z' +///开放式基金转换为其他基金 +#define SECURITY_FTDC_OPT_LOFConvert 'a' +///债券入库 +#define SECURITY_FTDC_OPT_DebentureStockIn 'b' +///债券出库 +#define SECURITY_FTDC_OPT_DebentureStockOut 'c' +///ETF申购 +#define SECURITY_FTDC_OPT_PurchasesETF 'd' +///ETF赎回 +#define SECURITY_FTDC_OPT_RedeemETF 'e' + +typedef char TSecurityFtdcOrderPriceTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOffsetFlagType是一个开平标志类型 +///////////////////////////////////////////////////////////////////////// +///开仓 +#define SECURITY_FTDC_OF_Open '0' +///平仓 +#define SECURITY_FTDC_OF_Close '1' +///强平 +#define SECURITY_FTDC_OF_ForceClose '2' +///平今 +#define SECURITY_FTDC_OF_CloseToday '3' +///平昨 +#define SECURITY_FTDC_OF_CloseYesterday '4' +///强减 +#define SECURITY_FTDC_OF_ForceOff '5' +///本地强平 +#define SECURITY_FTDC_OF_LocalForceClose '6' + +typedef char TSecurityFtdcOffsetFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcForceCloseReasonType是一个强平原因类型 +///////////////////////////////////////////////////////////////////////// +///非强平 +#define SECURITY_FTDC_FCC_NotForceClose '0' +///资金不足 +#define SECURITY_FTDC_FCC_LackDeposit '1' +///客户超仓 +#define SECURITY_FTDC_FCC_ClientOverPositionLimit '2' +///会员超仓 +#define SECURITY_FTDC_FCC_MemberOverPositionLimit '3' +///持仓非整数倍 +#define SECURITY_FTDC_FCC_NotMultiple '4' +///违规 +#define SECURITY_FTDC_FCC_Violation '5' +///其它 +#define SECURITY_FTDC_FCC_Other '6' +///自然人临近交割 +#define SECURITY_FTDC_FCC_PersonDeliv '7' + +typedef char TSecurityFtdcForceCloseReasonType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderTypeType是一个报单类型类型 +///////////////////////////////////////////////////////////////////////// +///正常 +#define SECURITY_FTDC_ORDT_Normal '0' +///报价衍生 +#define SECURITY_FTDC_ORDT_DeriveFromQuote '1' +///组合衍生 +#define SECURITY_FTDC_ORDT_DeriveFromCombination '2' +///组合报单 +#define SECURITY_FTDC_ORDT_Combination '3' +///条件单 +#define SECURITY_FTDC_ORDT_ConditionalOrder '4' +///互换单 +#define SECURITY_FTDC_ORDT_Swap '5' + +typedef char TSecurityFtdcOrderTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTimeConditionType是一个有效期类型类型 +///////////////////////////////////////////////////////////////////////// +///立即完成,否则撤销 +#define SECURITY_FTDC_TC_IOC '1' +///本节有效 +#define SECURITY_FTDC_TC_GFS '2' +///当日有效 +#define SECURITY_FTDC_TC_GFD '3' +///指定日期前有效 +#define SECURITY_FTDC_TC_GTD '4' +///撤销前有效 +#define SECURITY_FTDC_TC_GTC '5' +///集合竞价有效 +#define SECURITY_FTDC_TC_GFA '6' + +typedef char TSecurityFtdcTimeConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVolumeConditionType是一个成交量类型类型 +///////////////////////////////////////////////////////////////////////// +///任何数量 +#define SECURITY_FTDC_VC_AV '1' +///最小数量 +#define SECURITY_FTDC_VC_MV '2' +///全部数量 +#define SECURITY_FTDC_VC_CV '3' + +typedef char TSecurityFtdcVolumeConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcContingentConditionType是一个触发条件类型 +///////////////////////////////////////////////////////////////////////// +///立即 +#define SECURITY_FTDC_CC_Immediately '1' +///止损 +#define SECURITY_FTDC_CC_Touch '2' +///止赢 +#define SECURITY_FTDC_CC_TouchProfit '3' +///预埋单 +#define SECURITY_FTDC_CC_ParkedOrder '4' +///最新价大于条件价 +#define SECURITY_FTDC_CC_LastPriceGreaterThanStopPrice '5' +///最新价大于等于条件价 +#define SECURITY_FTDC_CC_LastPriceGreaterEqualStopPrice '6' +///最新价小于条件价 +#define SECURITY_FTDC_CC_LastPriceLesserThanStopPrice '7' +///最新价小于等于条件价 +#define SECURITY_FTDC_CC_LastPriceLesserEqualStopPrice '8' +///卖一价大于条件价 +#define SECURITY_FTDC_CC_AskPriceGreaterThanStopPrice '9' +///卖一价大于等于条件价 +#define SECURITY_FTDC_CC_AskPriceGreaterEqualStopPrice 'A' +///卖一价小于条件价 +#define SECURITY_FTDC_CC_AskPriceLesserThanStopPrice 'B' +///卖一价小于等于条件价 +#define SECURITY_FTDC_CC_AskPriceLesserEqualStopPrice 'C' +///买一价大于条件价 +#define SECURITY_FTDC_CC_BidPriceGreaterThanStopPrice 'D' +///买一价大于等于条件价 +#define SECURITY_FTDC_CC_BidPriceGreaterEqualStopPrice 'E' +///买一价小于条件价 +#define SECURITY_FTDC_CC_BidPriceLesserThanStopPrice 'F' +///买一价小于等于条件价 +#define SECURITY_FTDC_CC_BidPriceLesserEqualStopPrice 'H' + +typedef char TSecurityFtdcContingentConditionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcActionFlagType是一个操作标志类型 +///////////////////////////////////////////////////////////////////////// +///删除 +#define SECURITY_FTDC_AF_Delete '0' +///修改 +#define SECURITY_FTDC_AF_Modify '3' + +typedef char TSecurityFtdcActionFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradingRightType是一个交易权限类型 +///////////////////////////////////////////////////////////////////////// +///可以交易 +#define SECURITY_FTDC_TR_Allow '0' +///不能交易 +#define SECURITY_FTDC_TR_Forbidden '2' + +typedef char TSecurityFtdcTradingRightType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderSourceType是一个报单来源类型 +///////////////////////////////////////////////////////////////////////// +///来自参与者 +#define SECURITY_FTDC_OSRC_Participant '0' +///来自管理员 +#define SECURITY_FTDC_OSRC_Administrator '1' + +typedef char TSecurityFtdcOrderSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPriceSourceType是一个成交价来源类型 +///////////////////////////////////////////////////////////////////////// +///前成交价 +#define SECURITY_FTDC_PSRC_LastPrice '0' +///买委托价 +#define SECURITY_FTDC_PSRC_Buy '1' +///卖委托价 +#define SECURITY_FTDC_PSRC_Sell '2' + +typedef char TSecurityFtdcPriceSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOrderActionRefType是一个报单操作引用类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcOrderActionRefType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFrontIDType是一个前置编号类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcFrontIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSessionIDType是一个会话编号类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcSessionIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstallIDType是一个安装编号类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcInstallIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceNoType是一个序号类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcSequenceNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRequestIDType是一个请求编号类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcRequestIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombOffsetFlagType是一个组合开平标志类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCombOffsetFlagType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCombHedgeFlagType是一个组合投机套保标志类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCombHedgeFlagType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSequenceSeriesType是一个序列系列号类型 +///////////////////////////////////////////////////////////////////////// +typedef short TSecurityFtdcSequenceSeriesType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommPhaseNoType是一个通讯时段编号类型 +///////////////////////////////////////////////////////////////////////// +typedef short TSecurityFtdcCommPhaseNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserEventTypeType是一个用户事件类型类型 +///////////////////////////////////////////////////////////////////////// +///登录 +#define SECURITY_FTDC_UET_Login '1' +///登出 +#define SECURITY_FTDC_UET_Logout '2' +///交易成功 +#define SECURITY_FTDC_UET_Trading '3' +///交易失败 +#define SECURITY_FTDC_UET_TradingError '4' +///修改密码 +#define SECURITY_FTDC_UET_UpdatePassword '5' +///客户端认证 +#define SECURITY_FTDC_UET_Authenticate '6' +///其他 +#define SECURITY_FTDC_UET_Other '9' + +typedef char TSecurityFtdcUserEventTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserEventInfoType是一个用户事件信息类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcUserEventInfoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPTypeType是一个动态令牌类型类型 +///////////////////////////////////////////////////////////////////////// +///无动态令牌 +#define SECURITY_FTDC_OTP_NONE '0' +///时间令牌 +#define SECURITY_FTDC_OTP_TOTP '1' + +typedef char TSecurityFtdcOTPTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSourceType是一个成交来源类型 +///////////////////////////////////////////////////////////////////////// +///来自交易所普通回报 +#define SECURITY_FTDC_TSRC_NORMAL '0' +///来自查询 +#define SECURITY_FTDC_TSRC_QUERY '1' + +typedef char TSecurityFtdcTradeSourceType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBranchIDType是一个营业部编号类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcBranchIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStockPriceType是一个证券交易价格类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcStockPriceType[16]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRightModelIDType是一个股票权限模版代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcRightModelIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSerialNumberType是一个序列号类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcSerialNumberType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentRangeType是一个股票权限分类类型 +///////////////////////////////////////////////////////////////////////// +///所有 +#define SECURITY_FTDC_INR_All '1' +///产品 +#define SECURITY_FTDC_INR_Product '2' +///股票权限模版 +#define SECURITY_FTDC_INR_Model '3' +///股票 +#define SECURITY_FTDC_INR_Stock '4' +///市场 +#define SECURITY_FTDC_INR_Market '5' + +typedef char TSecurityFtdcInstrumentRangeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBusinessUnitType是一个业务单元类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcBusinessUnitType[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOTPVendorsIDType是一个动态令牌提供商类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcOTPVendorsIDType[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastDriftType是一个上次OTP漂移值类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcLastDriftType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastSuccessType是一个上次OTP成功值类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcLastSuccessType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAuthKeyType是一个令牌密钥类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcAuthKeyType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcUserSessionHashType是一个用户会话Hash值类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcUserSessionHashType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStockTradeTypeType是一个证券交易类型类型 +///////////////////////////////////////////////////////////////////////// +///可交易证券 +#define SECURITY_FTDC_STT_Stock '0' +///买入网络密码服务 +#define SECURITY_FTDC_STT_BuyNetService '1' +///回购注销 +#define SECURITY_FTDC_STT_CancelRepurchase '2' +///指定撤销 +#define SECURITY_FTDC_STT_CancelRegister '3' +///指定登记 +#define SECURITY_FTDC_STT_Register '4' +///买入发行申购 +#define SECURITY_FTDC_STT_PurchaseIssue '5' +///卖出配股 +#define SECURITY_FTDC_STT_Allotment '6' +///卖出要约收购 +#define SECURITY_FTDC_STT_SellTender '7' +///买入要约收购 +#define SECURITY_FTDC_STT_BuyTender '8' +///网上投票 +#define SECURITY_FTDC_STT_NetVote '9' +///卖出可转债回售 +#define SECURITY_FTDC_STT_SellConvertibleBonds 'a' +///权证行权代码 +#define SECURITY_FTDC_STT_OptionExecute 'b' +///开放式基金申购 +#define SECURITY_FTDC_STT_PurchaseOF 'c' +///开放式基金赎回 +#define SECURITY_FTDC_STT_RedeemOF 'd' +///开放式基金认购 +#define SECURITY_FTDC_STT_SubscribeOF 'e' +///开放式基金转托管转出 +#define SECURITY_FTDC_STT_OFCustodianTranfer 'f' +///开放式基金分红设置 +#define SECURITY_FTDC_STT_OFDividendConfig 'g' +///开放式基金转成其他基金 +#define SECURITY_FTDC_STT_OFTransfer 'h' +///债券入库 +#define SECURITY_FTDC_STT_BondsIn 'i' +///债券出库 +#define SECURITY_FTDC_STT_BondsOut 'j' +///EFT申购 +#define SECURITY_FTDC_STT_PurchaseETF 'k' +///EFT赎回 +#define SECURITY_FTDC_STT_RedeemETF 'l' +///可转债回售登记 +#define SECURITY_FTDC_STT_ConvertibleRegister 'm' + +typedef char TSecurityFtdcStockTradeTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcHandleTradingAccountAlgoIDType是一个资金处理算法编号类型 +///////////////////////////////////////////////////////////////////////// +///基本 +#define SECURITY_FTDC_HTAA_Base '1' + +typedef char TSecurityFtdcHandleTradingAccountAlgoIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStockWthType是一个股票使用流水号类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcStockWthType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcStockSeqType是一个股票使用流水号类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcStockSeqType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWTFSType是一个委托方式类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcWTFSType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWTLBType是一个委托类别类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcWTLBType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcWTRQType是一个委托日期类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcWTRQType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcINTEGERType是一个一般整型类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcINTEGERType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcINT3Type是一个三位数整型类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcINT3Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcINT6Type是一个六位数整型类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcINT6Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcINT12Type是一个十二位数整型类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcINT12Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR1Type是一个一字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR1Type[2]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR2Type是一个二字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR2Type[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR3Type是一个三字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR3Type[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR4Type是一个四字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR4Type[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR5Type是一个五字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR5Type[6]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR6Type是一个六字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR6Type[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR8Type是一个八字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR8Type[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR10Type是一个十字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR10Type[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR11Type是一个十一字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR11Type[12]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR12Type是一个十二字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR12Type[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR13Type是一个十三字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR13Type[14]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR14Type是一个十四字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR14Type[15]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR16Type是一个十六字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR16Type[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR19Type是一个十九字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR19Type[20]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR20Type是一个二十字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR20Type[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR21Type是一个二十一字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR21Type[22]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR23Type是一个二十三字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR23Type[24]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR30Type是一个三十字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR30Type[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR32Type是一个三十二字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR32Type[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR50Type是一个五十字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR50Type[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR64Type是一个六十四字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR64Type[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCHAR65Type是一个六十五字节CHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCHAR65Type[66]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR4Type是一个四字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR4Type[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR6Type是一个六字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR6Type[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR8Type是一个八字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR8Type[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR10Type是一个十字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR10Type[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR12Type是一个十二字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR12Type[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR16Type是一个十六字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR16Type[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR20Type是一个二十字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR20Type[21]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR30Type是一个三十字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR30Type[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR50Type是一个五十字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR50Type[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR60Type是一个六十字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR60Type[61]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR65Type是一个六十五字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR65Type[66]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR80Type是一个八十字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR80Type[81]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR84Type是一个八十四字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR84Type[85]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR255Type是一个二五五字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR255Type[256]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcVCHAR1024Type是一个一零二四字节VCHAR类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcVCHAR1024Type[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcREAL8P3Type是一个八点三实型类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcREAL8P3Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcREAL9P3Type是一个九点三实型类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcREAL9P3Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcREAL9P6Type是一个九点六实型类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcREAL9P6Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcREAL10P4Type是一个十点四实型类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcREAL10P4Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcREAL16P2Type是一个十六点二实型类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcREAL16P2Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcREAL16P8Type是一个十六点八实型类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcREAL16P8Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcREAL22P2Type是一个二十二点二实型类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcREAL22P2Type; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommandNoType是一个DB命令序号类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcCommandNoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCommandTypeType是一个DB命令类型类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCommandTypeType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettlementGroupIDType是一个结算组代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcSettlementGroupIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFieldNameType是一个字段名类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcFieldNameType[2049]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFieldContentType是一个字段内容类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcFieldContentType[2049]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankIDType是一个银行代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcBankIDType[4]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankNameType是一个银行名称类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcBankNameType[101]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankBrchIDType是一个银行分中心代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcBankBrchIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLiberSerialType是一个Liber系统流水号类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcLiberSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRoleIDType是一个角色编号类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcRoleIDType[11]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRoleNameType是一个角色名称类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcRoleNameType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDescriptionType是一个描述类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcDescriptionType[401]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionIDType是一个功能代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcFunctionIDType[25]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBillNoType是一个票据号类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcBillNoType[15]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundIOTypeType是一个出入金类型类型 +///////////////////////////////////////////////////////////////////////// +///出入金 +#define SECURITY_FTDC_FIOT_FundIO '1' +///银期转帐 +#define SECURITY_FTDC_FIOT_Transfer '2' + +typedef char TSecurityFtdcFundIOTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundTypeType是一个资金类型类型 +///////////////////////////////////////////////////////////////////////// +///银行存款 +#define SECURITY_FTDC_FT_Deposite '1' +///分项资金 +#define SECURITY_FTDC_FT_ItemFund '2' +///公司调整 +#define SECURITY_FTDC_FT_Company '3' + +typedef char TSecurityFtdcFundTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundDirectionType是一个出入金方向类型 +///////////////////////////////////////////////////////////////////////// +///入金 +#define SECURITY_FTDC_FD_In '1' +///出金 +#define SECURITY_FTDC_FD_Out '2' + +typedef char TSecurityFtdcFundDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankFlagType是一个银行统一标识类型类型 +///////////////////////////////////////////////////////////////////////// +///工商银行 +#define SECURITY_FTDC_BF_ICBC '1' +///农业银行 +#define SECURITY_FTDC_BF_ABC '2' +///中国银行 +#define SECURITY_FTDC_BF_BC '3' +///建设银行 +#define SECURITY_FTDC_BF_CBC '4' +///交通银行 +#define SECURITY_FTDC_BF_BOC '5' +///其他银行 +#define SECURITY_FTDC_BF_Other 'Z' + +typedef char TSecurityFtdcBankFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperationMemoType是一个操作摘要类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcOperationMemoType[1025]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundStatusType是一个资金状态类型 +///////////////////////////////////////////////////////////////////////// +///已录入 +#define SECURITY_FTDC_FS_Record '1' +///已复核 +#define SECURITY_FTDC_FS_Check '2' +///已冲销 +#define SECURITY_FTDC_FS_Charge '3' + +typedef char TSecurityFtdcFundStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundProjectIDType是一个资金项目编号类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcFundProjectIDType[5]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperatorIDType是一个操作员代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcOperatorIDType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCounterIDType是一个计数器代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcCounterIDType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFunctionNameType是一个功能名称类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcFunctionNameType[65]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeCodeType是一个交易代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcTradeCodeType[7]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerBranchIDType是一个经纪公司分支机构代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcBrokerBranchIDType[31]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeDateType是一个交易日期类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcTradeDateType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeTimeType是一个交易时间类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcTradeTimeType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankSerialType是一个银行流水号类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcBankSerialType[13]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSerialType是一个流水号类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLastFragmentType是一个最后分片标志类型 +///////////////////////////////////////////////////////////////////////// +///是最后分片 +#define SECURITY_FTDC_LF_Yes '0' +///不是最后分片 +#define SECURITY_FTDC_LF_No '1' + +typedef char TSecurityFtdcLastFragmentType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcIndividualNameType是一个个人姓名类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcIndividualNameType[51]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCustTypeType是一个客户类型类型 +///////////////////////////////////////////////////////////////////////// +///自然人 +#define SECURITY_FTDC_CUSTT_Person '0' +///机构户 +#define SECURITY_FTDC_CUSTT_Institution '1' + +typedef char TSecurityFtdcCustTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccountType是一个银行账户类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcBankAccountType[41]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcYesNoIndicatorType是一个是或否标识类型 +///////////////////////////////////////////////////////////////////////// +///是 +#define SECURITY_FTDC_YNI_Yes '0' +///否 +#define SECURITY_FTDC_YNI_No '1' + +typedef char TSecurityFtdcYesNoIndicatorType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeAmountType是一个交易金额(元)类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcTradeAmountType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCustFeeType是一个应收客户费用(元)类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcCustFeeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBrokerFeeType是一个应收经纪公司费用(元)类型 +///////////////////////////////////////////////////////////////////////// +typedef double TSecurityFtdcBrokerFeeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFeePayFlagType是一个费用支付标志类型 +///////////////////////////////////////////////////////////////////////// +///由受益方支付费用 +#define SECURITY_FTDC_FPF_BEN '0' +///由发送方支付费用 +#define SECURITY_FTDC_FPF_OUR '1' +///由发送方支付发起的费用,受益方支付接受的费用 +#define SECURITY_FTDC_FPF_SHA '2' + +typedef char TSecurityFtdcFeePayFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAddInfoType是一个附加信息类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcAddInfoType[129]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDigestType是一个摘要类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcDigestType[36]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankAccTypeType是一个银行帐号类型类型 +///////////////////////////////////////////////////////////////////////// +///银行存折 +#define SECURITY_FTDC_BAT_BankBook '1' +///储蓄卡 +#define SECURITY_FTDC_BAT_SavingCard '2' +///信用卡 +#define SECURITY_FTDC_BAT_CreditCard '3' + +typedef char TSecurityFtdcBankAccTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDeviceIDType是一个渠道标志类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcDeviceIDType[3]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPwdFlagType是一个密码核对标志类型 +///////////////////////////////////////////////////////////////////////// +///不核对 +#define SECURITY_FTDC_BPWDF_NoCheck '0' +///明文核对 +#define SECURITY_FTDC_BPWDF_BlankCheck '1' +///密文核对 +#define SECURITY_FTDC_BPWDF_EncryptCheck '2' + +typedef char TSecurityFtdcPwdFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcBankCodingForBrokerType是一个银行对经纪公司的编码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcBankCodingForBrokerType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperNoType是一个交易柜员类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcOperNoType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTIDType是一个交易ID类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcTIDType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTransferStatusType是一个转账交易状态类型 +///////////////////////////////////////////////////////////////////////// +///正常 +#define SECURITY_FTDC_TRFS_Normal '0' +///被冲正 +#define SECURITY_FTDC_TRFS_Repealed '1' + +typedef char TSecurityFtdcTransferStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcPlateSerialType是一个平台流水号类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcPlateSerialType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcAvailabilityFlagType是一个有效标志类型 +///////////////////////////////////////////////////////////////////////// +///未确认 +#define SECURITY_FTDC_AVAF_Invalid '0' +///有效 +#define SECURITY_FTDC_AVAF_Valid '1' +///冲正 +#define SECURITY_FTDC_AVAF_Repeal '2' + +typedef char TSecurityFtdcAvailabilityFlagType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcOperatorCodeType是一个操作员类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcOperatorCodeType[17]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcRepayStockAlgoType是一个买券还券算法类型 +///////////////////////////////////////////////////////////////////////// +///默认算法 +#define SECURITY_FTDC_RSA_Original '0' +///按还券比例计算 +#define SECURITY_FTDC_RSA_Ratio '1' +///Min[1,2] +#define SECURITY_FTDC_RSA_Min '2' + +typedef char TSecurityFtdcRepayStockAlgoType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeSpanType是一个交易时间段类型类型 +///////////////////////////////////////////////////////////////////////// +///普通业务 +#define SECURITY_FTDC_TS_Common '1' +///个股期权 +#define SECURITY_FTDC_TS_Options '2' + +typedef char TSecurityFtdcTradeSpanType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSettleSystemTypeType是一个所属结算系统类型类型 +///////////////////////////////////////////////////////////////////////// +///顶点系统 +#define SECURITY_FTDC_SST_Aboss '1' +///恒生系统 +#define SECURITY_FTDC_SST_HS '2' + +typedef char TSecurityFtdcSettleSystemTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcLogLevelType是一个日志级别类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcLogLevelType[33]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcProcessNameType是一个存储过程名称类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcProcessNameType[257]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTemplateIDType是一个模板代码类型 +///////////////////////////////////////////////////////////////////////// +typedef char TSecurityFtdcTemplateIDType[9]; + +///////////////////////////////////////////////////////////////////////// +///TFtdcTradeIndexType是一个成交序号类型 +///////////////////////////////////////////////////////////////////////// +typedef int TSecurityFtdcTradeIndexType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcSplitMergeStatusType是一个基金当天拆分合并状态类型 +///////////////////////////////////////////////////////////////////////// +///表示允许拆分和合并 +#define SECURITY_FTDC_SMS_Allow '0' +///允许拆分、不允许合并 +#define SECURITY_FTDC_SMS_OnlySplit '1' +///不允许拆分、允许合并 +#define SECURITY_FTDC_SMS_OnlyMerge '2' +///不允许拆分和合并 +#define SECURITY_FTDC_SMS_Forbidden '3' + +typedef char TSecurityFtdcSplitMergeStatusType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcFundInterTransferTypeType是一个资金内转类型类型 +///////////////////////////////////////////////////////////////////////// +///转入 +#define SECURITY_FTDC_FITT_TransferIn '0' +///转出 +#define SECURITY_FTDC_FITT_TransferOut '1' + +typedef char TSecurityFtdcFundInterTransferTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInstrumentTypeType是一个合约类型类型 +///////////////////////////////////////////////////////////////////////// +///普通 +#define SECURITY_FTDC_IT_Normal '0' +///看涨期权 +#define SECURITY_FTDC_IT_CallOptions '1' +///看跌期权 +#define SECURITY_FTDC_IT_PutOptions '2' +///普通(STEP) +#define SECURITY_FTDC_IT_Normal_STEP '3' + +typedef char TSecurityFtdcInstrumentTypeType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcInvestorLevelType是一个投资者期权交易等级类型 +///////////////////////////////////////////////////////////////////////// +///一级 +#define SECURITY_FTDC_IL_Level_1 '0' +///二级 +#define SECURITY_FTDC_IL_Level_2 '1' +///三级 +#define SECURITY_FTDC_IL_Level_3 '2' + +typedef char TSecurityFtdcInvestorLevelType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcCloseDirectionType是一个平仓方向类型 +///////////////////////////////////////////////////////////////////////// +///买平仓 +#define SECURITY_FTDC_CD_CloseBuy '!' +///卖平仓 +#define SECURITY_FTDC_CD_CloseSell '@' +///备兑平仓 +#define SECURITY_FTDC_CD_CloseCover '#' + +typedef char TSecurityFtdcCloseDirectionType; + +///////////////////////////////////////////////////////////////////////// +///TFtdcDelivTypeType是一个交割类型类型 +///////////////////////////////////////////////////////////////////////// +///看涨期权执行 +#define SECURITY_FTDC_DT_ExecCallOptions '0' +///看跌期权执行 +#define SECURITY_FTDC_DT_ExecPutOptions '1' +///在途证券 +#define SECURITY_FTDC_DT_UnavailStock '2' + +typedef char TSecurityFtdcDelivTypeType; + +#endif diff --git a/include/HLAPI/SecurityFtdcUserApiStruct.h b/include/HLAPI/SecurityFtdcUserApiStruct.h new file mode 100644 index 0000000..1b993ec --- /dev/null +++ b/include/HLAPI/SecurityFtdcUserApiStruct.h @@ -0,0 +1,2580 @@ +///////////////////////////////////////////////////////////////////////// +///@company shanghai liber information Technology Co.,Ltd +///@file SecurityFtdcUserApiStruct.h +///@brief 定义业务数据结构 +///////////////////////////////////////////////////////////////////////// + +#if !defined(SECURITY_FTDCSTRUCT_H) +#define SECURITY_FTDCSTRUCT_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "SecurityFtdcUserApiDataType.h" + +///响应信息 +struct CSecurityFtdcRspInfoField +{ + ///错误代码 + TSecurityFtdcErrorIDType ErrorID; + ///错误信息 + TSecurityFtdcErrorMsgType ErrorMsg; +}; + +///交易所 +struct CSecurityFtdcExchangeField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///交易所名称 + TSecurityFtdcExchangeNameType ExchangeName; + ///交易所属性 + TSecurityFtdcExchangePropertyType ExchangeProperty; +}; + +///产品 +struct CSecurityFtdcProductField +{ + ///产品代码 + TSecurityFtdcInstrumentIDType ProductID; + ///产品名称 + TSecurityFtdcProductNameType ProductName; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///产品类型 + TSecurityFtdcProductClassType ProductClass; + ///合约数量乘数 + TSecurityFtdcVolumeMultipleType VolumeMultiple; + ///最小变动价位 + TSecurityFtdcPriceType PriceTick; + ///市价单最大下单量 + TSecurityFtdcVolumeType MaxMarketOrderVolume; + ///市价单最小下单量 + TSecurityFtdcVolumeType MinMarketOrderVolume; + ///限价单最大下单量 + TSecurityFtdcVolumeType MaxLimitOrderVolume; + ///限价单最小下单量 + TSecurityFtdcVolumeType MinLimitOrderVolume; + ///持仓类型 + TSecurityFtdcPositionTypeType PositionType; + ///持仓日期类型 + TSecurityFtdcPositionDateTypeType PositionDateType; + ///ETF最小交易单位 + TSecurityFtdcVolumeType EFTMinTradeVolume; +}; + +///合约 +struct CSecurityFtdcInstrumentField +{ + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约名称 + TSecurityFtdcInstrumentNameType InstrumentName; + ///合约在交易所的代码 + TSecurityFtdcExchangeInstIDType ExchangeInstID; + ///产品代码 + TSecurityFtdcInstrumentIDType ProductID; + ///产品类型 + TSecurityFtdcProductClassType ProductClass; + ///交割年份 + TSecurityFtdcYearType DeliveryYear; + ///交割月 + TSecurityFtdcMonthType DeliveryMonth; + ///市价单最大下单量 + TSecurityFtdcVolumeType MaxMarketOrderVolume; + ///市价单最小下单量 + TSecurityFtdcVolumeType MinMarketOrderVolume; + ///限价单最大下单量 + TSecurityFtdcVolumeType MaxLimitOrderVolume; + ///限价单最小下单量 + TSecurityFtdcVolumeType MinLimitOrderVolume; + ///合约数量乘数 + TSecurityFtdcVolumeMultipleType VolumeMultiple; + ///最小变动价位 + TSecurityFtdcPriceType PriceTick; + ///创建日 + TSecurityFtdcDateType CreateDate; + ///上市日 + TSecurityFtdcDateType OpenDate; + ///到期日 + TSecurityFtdcDateType ExpireDate; + ///开始交割日 + TSecurityFtdcDateType StartDelivDate; + ///结束交割日 + TSecurityFtdcDateType EndDelivDate; + ///合约生命周期状态 + TSecurityFtdcInstLifePhaseType InstLifePhase; + ///当前是否交易 + TSecurityFtdcBoolType IsTrading; + ///持仓类型 + TSecurityFtdcPositionTypeType PositionType; + ///报单能否撤单 + TSecurityFtdcBoolType OrderCanBeWithdraw; + ///最小买下单单位 + TSecurityFtdcVolumeType MinBuyVolume; + ///最小卖下单单位 + TSecurityFtdcVolumeType MinSellVolume; + ///股票权限模版代码 + TSecurityFtdcRightModelIDType RightModelID; + ///持仓交易类型 + TSecurityFtdcPosTradeTypeType PosTradeType; + ///市场代码 + TSecurityFtdcInstrumentIDType MarketID; + ///期权执行价格 + TSecurityFtdcPriceType ExecPrice; + ///期权单手保证金 + TSecurityFtdcMoneyType UnitMargin; + ///合约类型 + TSecurityFtdcInstrumentTypeType InstrumentType; + ///期权保证金参数1 + TSecurityFtdcRatioType OptionsMarginParam1; + ///期权保证金参数2 + TSecurityFtdcRatioType OptionsMarginParam2; +}; + +///经纪公司 +struct CSecurityFtdcBrokerField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///经纪公司简称 + TSecurityFtdcBrokerAbbrType BrokerAbbr; + ///经纪公司名称 + TSecurityFtdcBrokerNameType BrokerName; + ///是否活跃 + TSecurityFtdcBoolType IsActive; +}; + +///会员编码和经纪公司编码对照表 +struct CSecurityFtdcPartBrokerField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///会员代码 + TSecurityFtdcParticipantIDType ParticipantID; + ///是否活跃 + TSecurityFtdcBoolType IsActive; +}; + +///投资者 +struct CSecurityFtdcInvestorField +{ + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者分组代码 + TSecurityFtdcInvestorIDType InvestorGroupID; + ///投资者名称 + TSecurityFtdcPartyNameType InvestorName; + ///证件类型 + TSecurityFtdcIdCardTypeType IdentifiedCardType; + ///证件号码 + TSecurityFtdcIdentifiedCardNoType IdentifiedCardNo; + ///是否活跃 + TSecurityFtdcBoolType IsActive; + ///上海营业部编号 + TSecurityFtdcTraderIDType SHBranchID; + ///深圳营业部编号 + TSecurityFtdcTraderIDType SZBranchID; + ///所属结算系统类型 + TSecurityFtdcSettleSystemTypeType SettleSystemType; + ///投资者期权交易等级 + TSecurityFtdcInvestorLevelType InvestorLevel; +}; + +///交易编码 +struct CSecurityFtdcTradingCodeField +{ + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///客户代码 + TSecurityFtdcClientIDType ClientID; + ///是否活跃 + TSecurityFtdcBoolType IsActive; + ///AccountID + TSecurityFtdcAccountIDType AccountID; + ///交易单元号 + TSecurityFtdcTraderIDType PBU; + ///ClientType + TSecurityFtdcClientTypeType ClientType; +}; + +///管理用户 +struct CSecurityFtdcSuperUserField +{ + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///用户名称 + TSecurityFtdcUserNameType UserName; + ///密码 + TSecurityFtdcPasswordType Password; + ///是否活跃 + TSecurityFtdcBoolType IsActive; +}; + +///管理用户功能权限 +struct CSecurityFtdcSuperUserFunctionField +{ + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///功能代码 + TSecurityFtdcFunctionCodeType FunctionCode; +}; + +///经纪公司用户 +struct CSecurityFtdcBrokerUserField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///用户名称 + TSecurityFtdcUserNameType UserName; + ///用户类型 + TSecurityFtdcUserTypeType UserType; + ///是否活跃 + TSecurityFtdcBoolType IsActive; + ///是否使用令牌 + TSecurityFtdcBoolType IsUsingOTP; +}; + +///经纪公司用户功能权限 +struct CSecurityFtdcBrokerUserFunctionField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///经纪公司功能代码 + TSecurityFtdcBrokerFunctionCodeType BrokerFunctionCode; +}; + +///资金账户 +struct CSecurityFtdcTradingAccountField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者帐号 + TSecurityFtdcAccountIDType AccountID; + ///上次质押金额 + TSecurityFtdcMoneyType PreMortgage; + ///上次信用额度 + TSecurityFtdcMoneyType PreCredit; + ///上次存款额 + TSecurityFtdcMoneyType PreDeposit; + ///上次结算准备金 + TSecurityFtdcMoneyType PreBalance; + ///上次占用的保证金 + TSecurityFtdcMoneyType PreMargin; + ///利息基数 + TSecurityFtdcMoneyType InterestBase; + ///利息收入 + TSecurityFtdcMoneyType Interest; + ///入金金额 + TSecurityFtdcMoneyType Deposit; + ///出金金额 + TSecurityFtdcMoneyType Withdraw; + ///冻结的保证金 + TSecurityFtdcMoneyType FrozenMargin; + ///冻结的资金 + TSecurityFtdcMoneyType FrozenCash; + ///冻结的手续费 + TSecurityFtdcMoneyType FrozenCommission; + ///当前保证金总额 + TSecurityFtdcMoneyType CurrMargin; + ///资金差额 + TSecurityFtdcMoneyType CashIn; + ///手续费 + TSecurityFtdcMoneyType Commission; + ///结算准备金 + TSecurityFtdcMoneyType Balance; + ///现金 + TSecurityFtdcMoneyType Available; + ///可取资金 + TSecurityFtdcMoneyType WithdrawQuota; + ///基本准备金 + TSecurityFtdcMoneyType Reserve; + ///交易日 + TSecurityFtdcDateType TradingDay; + ///保证金可用余额 + TSecurityFtdcMoneyType Credit; + ///质押金额 + TSecurityFtdcMoneyType Mortgage; + ///交易所保证金 + TSecurityFtdcMoneyType ExchangeMargin; + ///投资者交割保证金 + TSecurityFtdcMoneyType DeliveryMargin; + ///交易所交割保证金 + TSecurityFtdcMoneyType ExchangeDeliveryMargin; + ///冻结的过户费 + TSecurityFtdcMoneyType FrozenTransferFee; + ///冻结的印花税 + TSecurityFtdcMoneyType FrozenStampTax; + ///过户费 + TSecurityFtdcMoneyType TransferFee; + ///印花税 + TSecurityFtdcMoneyType StampTax; + ///折算金额 + TSecurityFtdcMoneyType ConversionAmount; + ///授信额度 + TSecurityFtdcMoneyType CreditAmount; + ///证券总价值 + TSecurityFtdcMoneyType StockValue; + ///国债回购占用资金 + TSecurityFtdcMoneyType BondRepurchaseAmount; + ///国债逆回购占用资金 + TSecurityFtdcMoneyType ReverseRepurchaseAmount; + ///币种 + TSecurityFtdcCurrencyCodeType CurrencyCode; + ///账户类型 + TSecurityFtdcAccountTypeType AccountType; + ///融资买入金额 + TSecurityFtdcMoneyType MarginTradeAmount; + ///融券卖出金额 + TSecurityFtdcMoneyType ShortSellAmount; + ///融资持仓盈亏 + TSecurityFtdcMoneyType MarginTradeProfit; + ///融券持仓盈亏 + TSecurityFtdcMoneyType ShortSellProfit; + ///融券总市值 + TSecurityFtdcMoneyType SSStockValue; + ///维持担保比例 + TSecurityFtdcRatioType CreditRatio; + ///行权冻结资金 + TSecurityFtdcMoneyType FrozenExecCash; + ///期权买入资金(SSE) + TSecurityFtdcMoneyType SSEOptionsBuyAmount; + ///期权买入冻结资金(SSE) + TSecurityFtdcMoneyType SSEOptionsBuyFrozenAmount; + ///结算保证金总额 + TSecurityFtdcMoneyType SettleMargin; +}; + +///禁止登录用户 +struct CSecurityFtdcLoginForbiddenUserField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; +}; + +///深度行情 +struct CSecurityFtdcDepthMarketDataField +{ + ///交易日 + TSecurityFtdcDateType TradingDay; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约在交易所的代码 + TSecurityFtdcExchangeInstIDType ExchangeInstID; + ///最新价 + TSecurityFtdcPriceType LastPrice; + ///上次结算价 + TSecurityFtdcPriceType PreSettlementPrice; + ///昨收盘 + TSecurityFtdcPriceType PreClosePrice; + ///昨持仓量 + TSecurityFtdcLargeVolumeType PreOpenInterest; + ///今开盘 + TSecurityFtdcPriceType OpenPrice; + ///最高价 + TSecurityFtdcPriceType HighestPrice; + ///最低价 + TSecurityFtdcPriceType LowestPrice; + ///数量 + TSecurityFtdcVolumeType Volume; + ///成交金额 + TSecurityFtdcMoneyType Turnover; + ///持仓量 + TSecurityFtdcLargeVolumeType OpenInterest; + ///今收盘 + TSecurityFtdcPriceType ClosePrice; + ///本次结算价 + TSecurityFtdcPriceType SettlementPrice; + ///涨停板价 + TSecurityFtdcPriceType UpperLimitPrice; + ///跌停板价 + TSecurityFtdcPriceType LowerLimitPrice; + ///昨虚实度 + TSecurityFtdcRatioType PreDelta; + ///今虚实度 + TSecurityFtdcRatioType CurrDelta; + ///最后修改时间 + TSecurityFtdcTimeType UpdateTime; + ///最后修改毫秒 + TSecurityFtdcMillisecType UpdateMillisec; + ///申买价一 + TSecurityFtdcPriceType BidPrice1; + ///申买量一 + TSecurityFtdcVolumeType BidVolume1; + ///申卖价一 + TSecurityFtdcPriceType AskPrice1; + ///申卖量一 + TSecurityFtdcVolumeType AskVolume1; + ///申买价二 + TSecurityFtdcPriceType BidPrice2; + ///申买量二 + TSecurityFtdcVolumeType BidVolume2; + ///申卖价二 + TSecurityFtdcPriceType AskPrice2; + ///申卖量二 + TSecurityFtdcVolumeType AskVolume2; + ///申买价三 + TSecurityFtdcPriceType BidPrice3; + ///申买量三 + TSecurityFtdcVolumeType BidVolume3; + ///申卖价三 + TSecurityFtdcPriceType AskPrice3; + ///申卖量三 + TSecurityFtdcVolumeType AskVolume3; + ///申买价四 + TSecurityFtdcPriceType BidPrice4; + ///申买量四 + TSecurityFtdcVolumeType BidVolume4; + ///申卖价四 + TSecurityFtdcPriceType AskPrice4; + ///申卖量四 + TSecurityFtdcVolumeType AskVolume4; + ///申买价五 + TSecurityFtdcPriceType BidPrice5; + ///申买量五 + TSecurityFtdcVolumeType BidVolume5; + ///申卖价五 + TSecurityFtdcPriceType AskPrice5; + ///申卖量五 + TSecurityFtdcVolumeType AskVolume5; + ///当日均价 + TSecurityFtdcPriceType AveragePrice; + ///业务日期 + TSecurityFtdcDateType ActionDay; + ///数量(新) + TSecurityFtdcLargeVolumeType Volume_New; +}; + +///投资者合约交易权限 +struct CSecurityFtdcInstrumentTradingRightField +{ + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///投资者范围 + TSecurityFtdcInvestorRangeType InvestorRange; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///买卖 + TSecurityFtdcDirectionType Direction; + ///交易权限 + TSecurityFtdcTradingRightType TradingRight; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///股票权限分类 + TSecurityFtdcInstrumentRangeType InstrumentRange; +}; + +///投资者持仓明细 +struct CSecurityFtdcInvestorPositionDetailField +{ + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///投机套保标志 + TSecurityFtdcHedgeFlagType HedgeFlag; + ///买卖 + TSecurityFtdcDirectionType Direction; + ///开仓日期 + TSecurityFtdcDateType OpenDate; + ///成交编号 + TSecurityFtdcTradeIDType TradeID; + ///数量 + TSecurityFtdcVolumeType Volume; + ///开仓价 + TSecurityFtdcPriceType OpenPrice; + ///交易日 + TSecurityFtdcDateType TradingDay; + ///成交类型 + TSecurityFtdcTradeTypeType TradeType; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///投资者保证金 + TSecurityFtdcMoneyType Margin; + ///交易所保证金 + TSecurityFtdcMoneyType ExchMargin; + ///昨结算价 + TSecurityFtdcPriceType LastSettlementPrice; + ///结算价 + TSecurityFtdcPriceType SettlementPrice; + ///平仓量 + TSecurityFtdcVolumeType CloseVolume; + ///平仓金额 + TSecurityFtdcMoneyType CloseAmount; + ///过户费 + TSecurityFtdcMoneyType TransferFee; + ///印花税 + TSecurityFtdcMoneyType StampTax; + ///手续费 + TSecurityFtdcMoneyType Commission; + ///AccountID + TSecurityFtdcAccountIDType AccountID; + ///质押入库数量 + TSecurityFtdcVolumeType PledgeInPosition; + ///质押入库冻结数量 + TSecurityFtdcVolumeType PledgeInFrozenPosition; + ///正回购使用的标准券数量 + TSecurityFtdcVolumeType RepurchasePosition; + ///融资融券金额 + TSecurityFtdcMoneyType Amount; + ///标的合约代码 + TSecurityFtdcInstrumentIDType UnderlyingInstrumentID; +}; + +///债券利息 +struct CSecurityFtdcBondInterestField +{ + ///交易日 + TSecurityFtdcDateType TradingDay; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///利息 + TSecurityFtdcInterestType Interest; +}; + +///市值配售信息 +struct CSecurityFtdcMarketRationInfoField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///可配售手数 + TSecurityFtdcVolumeType RationVolume; +}; + +///合约手续费率 +struct CSecurityFtdcInstrumentCommissionRateField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///投资者范围 + TSecurityFtdcInvestorRangeType InvestorRange; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///买卖方向 + TSecurityFtdcDirectionType Direction; + ///印花税率 + TSecurityFtdcRatioType StampTaxRateByMoney; + ///印花税率(按手数) + TSecurityFtdcRatioType StampTaxRateByVolume; + ///过户费率 + TSecurityFtdcRatioType TransferFeeRateByMoney; + ///过户费率(按手数) + TSecurityFtdcRatioType TransferFeeRateByVolume; + ///交易费 + TSecurityFtdcRatioType TradeFeeByMoney; + ///交易费(按手数) + TSecurityFtdcRatioType TradeFeeByVolume; + ///交易附加费率 + TSecurityFtdcRatioType MarginByMoney; + ///最小交易费 + TSecurityFtdcPriceType MinTradeFee; +}; + +///余券信息 +struct CSecurityFtdcExcessStockInfoField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///余券数量 + TSecurityFtdcVolumeType ExcessVolume; + ///余券冻结数量 + TSecurityFtdcVolumeType ExcessFrozenVolume; +}; + +///ETF合约 +struct CSecurityFtdcETFInstrumentField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///ETF证券代码 + TSecurityFtdcInstrumentIDType ETFInstrumentID; + ///ETF对应申赎代码 + TSecurityFtdcInstrumentIDType ETFPurRedInstrumentID; + ///最小申购赎回单位对应的ETF份数 + TSecurityFtdcVolumeType CreationRedemptionUnit; + ///最大现金替代比例 + TSecurityFtdcRatioType Maxcashratio; + ///基金当天申购赎回状态 + TSecurityFtdcCreationredemptionStatusType Creationredemption; + ///预估金额 + TSecurityFtdcMoneyType EstimateCashComponent; +}; + +///ETF股票篮 +struct CSecurityFtdcETFBasketField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///ETF证券代码 + TSecurityFtdcInstrumentIDType ETFInstrumentID; + ///股票证券代码 + TSecurityFtdcInstrumentIDType StockInstrumentID; + ///股票证券名称 + TSecurityFtdcInstrumentNameType StockInstrumentName; + ///股票数量 + TSecurityFtdcVolumeType Volume; + ///替代标志 + TSecurityFtdcETFCurrenceReplaceStatusType CurrenceReplaceStatus; + ///溢价比例 + TSecurityFtdcRatioType Premium; + ///总金额 + TSecurityFtdcMoneyType Amount; +}; + +///OF合约 +struct CSecurityFtdcOFInstrumentField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///OF基金代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///基金当天申购赎回状态 + TSecurityFtdcCreationredemptionStatusType Creationredemption; + ///基金净值 + TSecurityFtdcPriceType NetPrice; +}; + +///SF合约 +struct CSecurityFtdcSFInstrumentField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///基金代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///SF基金代码 + TSecurityFtdcInstrumentIDType SFInstrumentID; + ///基金当天拆分合并状态 + TSecurityFtdcSplitMergeStatusType SplitMergeStatus; + ///最小拆分数量 + TSecurityFtdcVolumeType MinSplitVolume; + ///最小合并数量 + TSecurityFtdcVolumeType MinMergeVolume; + ///拆分/合并比例 + TSecurityFtdcVolumeType VolumeRatio; + ///基金净值 + TSecurityFtdcPriceType NetPrice; +}; + +///合约单手保证金 +struct CSecurityFtdcInstrumentUnitMarginField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///合约单手保证金 + TSecurityFtdcMoneyType UnitMargin; +}; + +///期权资金限制参数 +struct CSecurityFtdcOptionsFundLimitParamField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///最大可买金额 + TSecurityFtdcMoneyType MaxBuyAmount; +}; + +///投资者期权持仓 +struct CSecurityFtdcInvestorOptionsPositionField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者范围 + TSecurityFtdcInvestorRangeType InvestorRange; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///InstrumentID + TSecurityFtdcInstrumentIDType InstrumentID; + ///最大多头仓位限制 + TSecurityFtdcVolumeType MaxLongPositionLimit; + ///最大买开量限制 + TSecurityFtdcVolumeType MaxBuyVolLimit; + ///最大总仓位限制 + TSecurityFtdcVolumeType MaxPositionLimit; + ///多头持仓 + TSecurityFtdcVolumeType LongPosition; + ///空头持仓 + TSecurityFtdcVolumeType ShortPosition; + ///买开量 + TSecurityFtdcVolumeType BuyVolume; + ///买开冻结量 + TSecurityFtdcVolumeType BuyFrozenVolume; + ///多头冻结持仓 + TSecurityFtdcVolumeType LongFrozenPosition; + ///空头冻结持仓 + TSecurityFtdcVolumeType ShortFrozenPosition; +}; + +///预交割信息 +struct CSecurityFtdcPreDelivInfoField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///交割类型 + TSecurityFtdcDelivTypeType DelivType; + ///标的合约代码 + TSecurityFtdcInstrumentIDType UnderlyingInstrumentID; + ///交割数量 + TSecurityFtdcVolumeType DelivVolume; + ///交割金额 + TSecurityFtdcMoneyType DelivAmount; + ///期权执行数量 + TSecurityFtdcVolumeType ExecVolume; + ///买卖方向 + TSecurityFtdcDirectionType Direction; +}; + +///可融券分配信息 +struct CSecurityFtdcCreditStockAssignInfoField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///融券限量 + TSecurityFtdcVolumeType LimitVolume; + ///上日融券数量 + TSecurityFtdcVolumeType YDVolume; + ///剩余可融券数量 + TSecurityFtdcVolumeType LeftVolume; + ///冻结融券数量 + TSecurityFtdcVolumeType FrozenVolume; +}; + +///可融资分配信息 +struct CSecurityFtdcCreditCashAssignInfoField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///融资限额 + TSecurityFtdcMoneyType LimitAmount; + ///上日融资金额 + TSecurityFtdcMoneyType YDAmount; +}; + +///证券折算率 +struct CSecurityFtdcConversionRateField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///折算比率 + TSecurityFtdcRatioType ConversionRate; + ///当前是否支持融资交易 + TSecurityFtdcBoolType IsTradingForMargin; + ///当前是否支持融券交易 + TSecurityFtdcBoolType IsTradingForShort; +}; + +///历史信用负债信息 +struct CSecurityFtdcHisCreditDebtInfoField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///开仓日期 + TSecurityFtdcDateType OpenDate; + ///负债类型 + TSecurityFtdcDirectionType Direction; + ///开仓价 + TSecurityFtdcPriceType OpenPrice; + ///数量 + TSecurityFtdcVolumeType Volume; + ///融资融券金额 + TSecurityFtdcMoneyType Amount; +}; + +///交易所交易员报盘机 +struct CSecurityFtdcTraderOfferField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///交易所交易员代码 + TSecurityFtdcTraderIDType BranchPBU; + ///会员代码 + TSecurityFtdcParticipantIDType ParticipantID; + ///密码 + TSecurityFtdcPasswordType Password; + ///安装编号 + TSecurityFtdcInstallIDType InstallID; + ///本地报单编号 + TSecurityFtdcOrderLocalIDType OrderLocalID; + ///交易所交易员连接状态 + TSecurityFtdcTraderConnectStatusType TraderConnectStatus; + ///发出连接请求的日期 + TSecurityFtdcDateType ConnectRequestDate; + ///发出连接请求的时间 + TSecurityFtdcTimeType ConnectRequestTime; + ///上次报告日期 + TSecurityFtdcDateType LastReportDate; + ///上次报告时间 + TSecurityFtdcTimeType LastReportTime; + ///完成连接日期 + TSecurityFtdcDateType ConnectDate; + ///完成连接时间 + TSecurityFtdcTimeType ConnectTime; + ///启动日期 + TSecurityFtdcDateType StartDate; + ///启动时间 + TSecurityFtdcTimeType StartTime; + ///交易日 + TSecurityFtdcDateType TradingDay; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; +}; + +///交易所行情报盘机 +struct CSecurityFtdcMDTraderOfferField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///交易所交易员代码 + TSecurityFtdcTraderIDType BranchPBU; + ///会员代码 + TSecurityFtdcParticipantIDType ParticipantID; + ///密码 + TSecurityFtdcPasswordType Password; + ///安装编号 + TSecurityFtdcInstallIDType InstallID; + ///本地报单编号 + TSecurityFtdcOrderLocalIDType OrderLocalID; + ///交易所交易员连接状态 + TSecurityFtdcTraderConnectStatusType TraderConnectStatus; + ///发出连接请求的日期 + TSecurityFtdcDateType ConnectRequestDate; + ///发出连接请求的时间 + TSecurityFtdcTimeType ConnectRequestTime; + ///上次报告日期 + TSecurityFtdcDateType LastReportDate; + ///上次报告时间 + TSecurityFtdcTimeType LastReportTime; + ///完成连接日期 + TSecurityFtdcDateType ConnectDate; + ///完成连接时间 + TSecurityFtdcTimeType ConnectTime; + ///启动日期 + TSecurityFtdcDateType StartDate; + ///启动时间 + TSecurityFtdcTimeType StartTime; + ///交易日 + TSecurityFtdcDateType TradingDay; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; +}; + +///前置状态 +struct CSecurityFtdcFrontStatusField +{ + ///前置编号 + TSecurityFtdcFrontIDType FrontID; + ///上次报告日期 + TSecurityFtdcDateType LastReportDate; + ///上次报告时间 + TSecurityFtdcTimeType LastReportTime; + ///是否活跃 + TSecurityFtdcBoolType IsActive; +}; + +///用户会话 +struct CSecurityFtdcUserSessionField +{ + ///前置编号 + TSecurityFtdcFrontIDType FrontID; + ///会话编号 + TSecurityFtdcSessionIDType SessionID; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///登录日期 + TSecurityFtdcDateType LoginDate; + ///登录时间 + TSecurityFtdcTimeType LoginTime; + ///IP地址 + TSecurityFtdcIPAddressType IPAddress; + ///用户端产品信息 + TSecurityFtdcProductInfoType UserProductInfo; + ///接口端产品信息 + TSecurityFtdcProductInfoType InterfaceProductInfo; + ///协议信息 + TSecurityFtdcProtocolInfoType ProtocolInfo; + ///Mac地址 + TSecurityFtdcMacAddressType MacAddress; +}; + +///报单 +struct CSecurityFtdcOrderField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///报单引用 + TSecurityFtdcOrderRefType OrderRef; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///报单价格条件 + TSecurityFtdcOrderPriceTypeType OrderPriceType; + ///买卖方向 + TSecurityFtdcDirectionType Direction; + ///组合开平标志 + TSecurityFtdcCombOffsetFlagType CombOffsetFlag; + ///组合投机套保标志 + TSecurityFtdcCombHedgeFlagType CombHedgeFlag; + ///价格 + TSecurityFtdcStockPriceType LimitPrice; + ///数量 + TSecurityFtdcVolumeType VolumeTotalOriginal; + ///有效期类型 + TSecurityFtdcTimeConditionType TimeCondition; + ///GTD日期 + TSecurityFtdcDateType GTDDate; + ///成交量类型 + TSecurityFtdcVolumeConditionType VolumeCondition; + ///最小成交量 + TSecurityFtdcVolumeType MinVolume; + ///触发条件 + TSecurityFtdcContingentConditionType ContingentCondition; + ///止损价 + TSecurityFtdcPriceType StopPrice; + ///强平原因 + TSecurityFtdcForceCloseReasonType ForceCloseReason; + ///自动挂起标志 + TSecurityFtdcBoolType IsAutoSuspend; + ///业务单元 + TSecurityFtdcBusinessUnitType BusinessUnit; + ///请求编号 + TSecurityFtdcRequestIDType RequestID; + ///本地报单编号 + TSecurityFtdcOrderLocalIDType OrderLocalID; + ///会员代码 + TSecurityFtdcParticipantIDType ParticipantID; + ///客户代码 + TSecurityFtdcClientIDType ClientID; + ///合约在交易所的代码 + TSecurityFtdcExchangeInstIDType ExchangeInstID; + ///交易所交易员代码 + TSecurityFtdcTraderIDType BranchPBU; + ///安装编号 + TSecurityFtdcInstallIDType InstallID; + ///报单提交状态 + TSecurityFtdcOrderSubmitStatusType OrderSubmitStatus; + ///账户代码 + TSecurityFtdcAccountIDType AccountID; + ///报单提示序号 + TSecurityFtdcSequenceNoType NotifySequence; + ///交易日 + TSecurityFtdcDateType TradingDay; + ///报单编号 + TSecurityFtdcOrderSysIDType OrderSysID; + ///报单来源 + TSecurityFtdcOrderSourceType OrderSource; + ///报单状态 + TSecurityFtdcOrderStatusType OrderStatus; + ///报单类型 + TSecurityFtdcOrderTypeType OrderType; + ///今成交数量 + TSecurityFtdcVolumeType VolumeTraded; + ///剩余数量 + TSecurityFtdcVolumeType VolumeTotal; + ///报单日期 + TSecurityFtdcDateType InsertDate; + ///委托时间 + TSecurityFtdcTimeType InsertTime; + ///激活时间 + TSecurityFtdcTimeType ActiveTime; + ///挂起时间 + TSecurityFtdcTimeType SuspendTime; + ///最后修改时间 + TSecurityFtdcTimeType UpdateTime; + ///撤销时间 + TSecurityFtdcTimeType CancelTime; + ///最后修改交易所交易员代码 + TSecurityFtdcTraderIDType ActiveTraderID; + ///结算会员编号 + TSecurityFtdcParticipantIDType ClearingPartID; + ///序号 + TSecurityFtdcSequenceNoType SequenceNo; + ///前置编号 + TSecurityFtdcFrontIDType FrontID; + ///会话编号 + TSecurityFtdcSessionIDType SessionID; + ///用户端产品信息 + TSecurityFtdcProductInfoType UserProductInfo; + ///状态信息 + TSecurityFtdcErrorMsgType StatusMsg; + ///用户强评标志 + TSecurityFtdcBoolType UserForceClose; + ///操作用户代码 + TSecurityFtdcUserIDType ActiveUserID; + ///经纪公司报单编号 + TSecurityFtdcSequenceNoType BrokerOrderSeq; + ///相关报单 + TSecurityFtdcOrderSysIDType RelativeOrderSysID; + ///营业部编号 + TSecurityFtdcBranchIDType BranchID; + ///成交数量 + TSecurityFtdcMoneyType TradeAmount; + ///是否ETF + TSecurityFtdcBoolType IsETF; + ///合约类型 + TSecurityFtdcInstrumentTypeType InstrumentType; +}; + +///报单操作 +struct CSecurityFtdcOrderActionField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///报单操作引用 + TSecurityFtdcOrderActionRefType OrderActionRef; + ///报单引用 + TSecurityFtdcOrderRefType OrderRef; + ///请求编号 + TSecurityFtdcRequestIDType RequestID; + ///前置编号 + TSecurityFtdcFrontIDType FrontID; + ///会话编号 + TSecurityFtdcSessionIDType SessionID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///操作标志 + TSecurityFtdcActionFlagType ActionFlag; + ///价格 + TSecurityFtdcPriceType LimitPrice; + ///数量变化 + TSecurityFtdcVolumeType VolumeChange; + ///操作日期 + TSecurityFtdcDateType ActionDate; + ///操作时间 + TSecurityFtdcTimeType ActionTime; + ///交易所交易员代码 + TSecurityFtdcTraderIDType BranchPBU; + ///安装编号 + TSecurityFtdcInstallIDType InstallID; + ///本地报单编号 + TSecurityFtdcOrderLocalIDType OrderLocalID; + ///操作本地编号 + TSecurityFtdcOrderLocalIDType ActionLocalID; + ///会员代码 + TSecurityFtdcParticipantIDType ParticipantID; + ///客户代码 + TSecurityFtdcClientIDType ClientID; + ///业务单元 + TSecurityFtdcBusinessUnitType BusinessUnit; + ///报单操作状态 + TSecurityFtdcOrderActionStatusType OrderActionStatus; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///营业部编号 + TSecurityFtdcBranchIDType BranchID; + ///状态信息 + TSecurityFtdcErrorMsgType StatusMsg; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///合约类型 + TSecurityFtdcInstrumentTypeType InstrumentType; +}; + +///错误报单 +struct CSecurityFtdcErrOrderField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///报单引用 + TSecurityFtdcOrderRefType OrderRef; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///报单价格条件 + TSecurityFtdcOrderPriceTypeType OrderPriceType; + ///买卖方向 + TSecurityFtdcDirectionType Direction; + ///组合开平标志 + TSecurityFtdcCombOffsetFlagType CombOffsetFlag; + ///组合投机套保标志 + TSecurityFtdcCombHedgeFlagType CombHedgeFlag; + ///价格 + TSecurityFtdcStockPriceType LimitPrice; + ///数量 + TSecurityFtdcVolumeType VolumeTotalOriginal; + ///有效期类型 + TSecurityFtdcTimeConditionType TimeCondition; + ///GTD日期 + TSecurityFtdcDateType GTDDate; + ///成交量类型 + TSecurityFtdcVolumeConditionType VolumeCondition; + ///最小成交量 + TSecurityFtdcVolumeType MinVolume; + ///触发条件 + TSecurityFtdcContingentConditionType ContingentCondition; + ///止损价 + TSecurityFtdcPriceType StopPrice; + ///强平原因 + TSecurityFtdcForceCloseReasonType ForceCloseReason; + ///自动挂起标志 + TSecurityFtdcBoolType IsAutoSuspend; + ///业务单元 + TSecurityFtdcBusinessUnitType BusinessUnit; + ///请求编号 + TSecurityFtdcRequestIDType RequestID; + ///用户强评标志 + TSecurityFtdcBoolType UserForceClose; + ///错误代码 + TSecurityFtdcErrorIDType ErrorID; + ///错误信息 + TSecurityFtdcErrorMsgType ErrorMsg; +}; + +///错误报单操作 +struct CSecurityFtdcErrOrderActionField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///报单操作引用 + TSecurityFtdcOrderActionRefType OrderActionRef; + ///报单引用 + TSecurityFtdcOrderRefType OrderRef; + ///请求编号 + TSecurityFtdcRequestIDType RequestID; + ///前置编号 + TSecurityFtdcFrontIDType FrontID; + ///会话编号 + TSecurityFtdcSessionIDType SessionID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///操作标志 + TSecurityFtdcActionFlagType ActionFlag; + ///价格 + TSecurityFtdcPriceType LimitPrice; + ///数量变化 + TSecurityFtdcVolumeType VolumeChange; + ///操作日期 + TSecurityFtdcDateType ActionDate; + ///操作时间 + TSecurityFtdcTimeType ActionTime; + ///交易所交易员代码 + TSecurityFtdcTraderIDType BranchPBU; + ///安装编号 + TSecurityFtdcInstallIDType InstallID; + ///本地报单编号 + TSecurityFtdcOrderLocalIDType OrderLocalID; + ///操作本地编号 + TSecurityFtdcOrderLocalIDType ActionLocalID; + ///会员代码 + TSecurityFtdcParticipantIDType ParticipantID; + ///客户代码 + TSecurityFtdcClientIDType ClientID; + ///业务单元 + TSecurityFtdcBusinessUnitType BusinessUnit; + ///报单操作状态 + TSecurityFtdcOrderActionStatusType OrderActionStatus; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///营业部编号 + TSecurityFtdcBranchIDType BranchID; + ///状态信息 + TSecurityFtdcErrorMsgType StatusMsg; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///错误代码 + TSecurityFtdcErrorIDType ErrorID; + ///错误信息 + TSecurityFtdcErrorMsgType ErrorMsg; + ///合约类型 + TSecurityFtdcInstrumentTypeType InstrumentType; +}; + +///成交 +struct CSecurityFtdcTradeField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///报单引用 + TSecurityFtdcOrderRefType OrderRef; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///成交编号 + TSecurityFtdcTradeIDType TradeID; + ///买卖方向 + TSecurityFtdcDirectionType Direction; + ///报单编号 + TSecurityFtdcOrderSysIDType OrderSysID; + ///会员代码 + TSecurityFtdcParticipantIDType ParticipantID; + ///客户代码 + TSecurityFtdcClientIDType ClientID; + ///交易角色 + TSecurityFtdcTradingRoleType TradingRole; + ///合约在交易所的代码 + TSecurityFtdcExchangeInstIDType ExchangeInstID; + ///开平标志 + TSecurityFtdcOffsetFlagType OffsetFlag; + ///投机套保标志 + TSecurityFtdcHedgeFlagType HedgeFlag; + ///价格 + TSecurityFtdcStockPriceType Price; + ///数量 + TSecurityFtdcVolumeType Volume; + ///成交时期 + TSecurityFtdcDateType TradeDate; + ///成交时间 + TSecurityFtdcTimeType TradeTime; + ///成交类型 + TSecurityFtdcTradeTypeType TradeType; + ///成交价来源 + TSecurityFtdcPriceSourceType PriceSource; + ///交易所交易员代码 + TSecurityFtdcTraderIDType BranchPBU; + ///本地报单编号 + TSecurityFtdcOrderLocalIDType OrderLocalID; + ///结算会员编号 + TSecurityFtdcParticipantIDType ClearingPartID; + ///业务单元 + TSecurityFtdcBusinessUnitType BusinessUnit; + ///序号 + TSecurityFtdcSequenceNoType SequenceNo; + ///成交来源 + TSecurityFtdcTradeSourceType TradeSource; + ///交易日 + TSecurityFtdcDateType TradingDay; + ///经纪公司报单编号 + TSecurityFtdcSequenceNoType BrokerOrderSeq; + ///成交金额 + TSecurityFtdcMoneyType TradeAmount; + ///成交序号 + TSecurityFtdcTradeIndexType TradeIndex; +}; + +///投资者持仓 +struct CSecurityFtdcInvestorPositionField +{ + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///持仓多空方向 + TSecurityFtdcPosiDirectionType PosiDirection; + ///投机套保标志 + TSecurityFtdcHedgeFlagType HedgeFlag; + ///持仓日期 + TSecurityFtdcPositionDateType PositionDate; + ///上日持仓 + TSecurityFtdcVolumeType YdPosition; + ///总持仓 + TSecurityFtdcVolumeType Position; + ///多头冻结 + TSecurityFtdcVolumeType LongFrozen; + ///空头冻结 + TSecurityFtdcVolumeType ShortFrozen; + ///开仓冻结金额 + TSecurityFtdcMoneyType LongFrozenAmount; + ///开仓冻结金额 + TSecurityFtdcMoneyType ShortFrozenAmount; + ///开仓量 + TSecurityFtdcVolumeType OpenVolume; + ///平仓量 + TSecurityFtdcVolumeType CloseVolume; + ///开仓金额 + TSecurityFtdcMoneyType OpenAmount; + ///平仓金额 + TSecurityFtdcMoneyType CloseAmount; + ///持仓成本 + TSecurityFtdcMoneyType PositionCost; + ///冻结的资金 + TSecurityFtdcMoneyType FrozenCash; + ///资金差额 + TSecurityFtdcMoneyType CashIn; + ///手续费 + TSecurityFtdcMoneyType Commission; + ///上次结算价 + TSecurityFtdcPriceType PreSettlementPrice; + ///本次结算价 + TSecurityFtdcPriceType SettlementPrice; + ///交易日 + TSecurityFtdcDateType TradingDay; + ///开仓成本 + TSecurityFtdcMoneyType OpenCost; + ///交易所保证金 + TSecurityFtdcMoneyType ExchangeMargin; + ///今日持仓 + TSecurityFtdcVolumeType TodayPosition; + ///过户费 + TSecurityFtdcMoneyType TransferFee; + ///印花税 + TSecurityFtdcMoneyType StampTax; + ///今日申购赎回数量 + TSecurityFtdcVolumeType TodayPurRedVolume; + ///折算率 + TSecurityFtdcRatioType ConversionRate; + ///折算金额 + TSecurityFtdcMoneyType ConversionAmount; + ///证券价值 + TSecurityFtdcMoneyType StockValue; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///AccountID + TSecurityFtdcAccountIDType AccountID; + ///质押入库数量 + TSecurityFtdcVolumeType PledgeInPosition; + ///正回购使用的标准券数量 + TSecurityFtdcVolumeType RepurchasePosition; + ///ETF申赎空头冻结 + TSecurityFtdcVolumeType PurRedShortFrozen; + ///融资买入数量 + TSecurityFtdcVolumeType MarginTradeVolume; + ///融资买入金额 + TSecurityFtdcMoneyType MarginTradeAmount; + ///融资买入冻结数量 + TSecurityFtdcVolumeType MarginTradeFrozenVolume; + ///融资买入冻结金额 + TSecurityFtdcMoneyType MarginTradeFrozenAmount; + ///融资买入盈亏 + TSecurityFtdcMoneyType MarginTradeConversionProfit; + ///融券卖出数量 + TSecurityFtdcVolumeType ShortSellVolume; + ///融券卖出金额 + TSecurityFtdcMoneyType ShortSellAmount; + ///融券卖出冻结数量 + TSecurityFtdcVolumeType ShortSellFrozenVolume; + ///融券卖出冻结金额 + TSecurityFtdcMoneyType ShortSellFrozenAmount; + ///融券卖出盈亏 + TSecurityFtdcMoneyType ShortSellConversionProfit; + ///融券总市值 + TSecurityFtdcMoneyType SSStockValue; + ///今日融资持仓 + TSecurityFtdcVolumeType TodayMTPosition; + ///今日融券持仓 + TSecurityFtdcVolumeType TodaySSPosition; + ///历史持仓开仓成本 + TSecurityFtdcMoneyType YdOpenCost; + ///锁定仓位 + TSecurityFtdcVolumeType LockPosition; + ///备兑仓位 + TSecurityFtdcVolumeType CoverPosition; + ///锁定冻结仓位 + TSecurityFtdcVolumeType LockFrozenPosition; + ///解锁冻结仓位 + TSecurityFtdcVolumeType UnlockFrozenPosition; + ///备兑冻结仓位 + TSecurityFtdcVolumeType CoverFrozenPosition; + ///行权冻结仓位 + TSecurityFtdcVolumeType ExecFrozenPosition; + ///上日备兑仓位 + TSecurityFtdcVolumeType YDCoverPosition; +}; + +///出入金同步 +struct CSecurityFtdcSyncDepositField +{ + ///出入金流水号 + TSecurityFtdcDepositSeqNoType DepositSeqNo; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///入金金额 + TSecurityFtdcMoneyType Deposit; + ///是否强制进行 + TSecurityFtdcBoolType IsForce; + ///账户代 + TSecurityFtdcAccountIDType AccountID; +}; + +///查询交易所 +struct CSecurityFtdcQryExchangeField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; +}; + +///查询产品 +struct CSecurityFtdcQryProductField +{ + ///产品代码 + TSecurityFtdcInstrumentIDType ProductID; +}; + +///查询合约 +struct CSecurityFtdcQryInstrumentField +{ + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约在交易所的代码 + TSecurityFtdcExchangeInstIDType ExchangeInstID; + ///产品代码 + TSecurityFtdcInstrumentIDType ProductID; +}; + +///查询经纪公司 +struct CSecurityFtdcQryBrokerField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; +}; + +///查询经纪公司会员代码 +struct CSecurityFtdcQryPartBrokerField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///会员代码 + TSecurityFtdcParticipantIDType ParticipantID; +}; + +///查询投资者 +struct CSecurityFtdcQryInvestorField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; +}; + +///查询交易编码 +struct CSecurityFtdcQryTradingCodeField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///客户代码 + TSecurityFtdcClientIDType ClientID; +}; + +///查询管理用户 +struct CSecurityFtdcQrySuperUserField +{ + ///用户代码 + TSecurityFtdcUserIDType UserID; +}; + +///查询管理用户功能权限 +struct CSecurityFtdcQrySuperUserFunctionField +{ + ///用户代码 + TSecurityFtdcUserIDType UserID; +}; + +///查询经纪公司用户 +struct CSecurityFtdcQryBrokerUserField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; +}; + +///查询经纪公司用户权限 +struct CSecurityFtdcQryBrokerUserFunctionField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; +}; + +///查询资金账户 +struct CSecurityFtdcQryTradingAccountField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; +}; + +///查询禁止登录用户 +struct CSecurityFtdcQryLoginForbiddenUserField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; +}; + +///查询行情 +struct CSecurityFtdcQryDepthMarketDataField +{ + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; +}; + +///查询合约交易权限 +struct CSecurityFtdcQryInstrumentTradingRightField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; +}; + +///查询投资者持仓明细 +struct CSecurityFtdcQryInvestorPositionDetailField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; +}; + +///查询债券利息 +struct CSecurityFtdcQryBondInterestField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; +}; + +///查询市值配售信息 +struct CSecurityFtdcQryMarketRationInfoField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者帐号 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; +}; + +///查询合约手续费率 +struct CSecurityFtdcQryInstrumentCommissionRateField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///买卖方向 + TSecurityFtdcDirectionType Direction; + ///开平标志 + TSecurityFtdcOffsetFlagType OffsetFlag; +}; + +///查询余券信息 +struct CSecurityFtdcQryExcessStockInfoField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; +}; + +///查询投资者帐户关系 +struct CSecurityFtdcQryInvestorAccountField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; +}; + +///查询ETF合约 +struct CSecurityFtdcQryETFInstrumentField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///ETF证券代码 + TSecurityFtdcInstrumentIDType ETFInstrumentID; +}; + +///查询ETF股票篮 +struct CSecurityFtdcQryETFBasketField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///ETF证券代码 + TSecurityFtdcInstrumentIDType ETFInstrumentID; +}; + +///查询OF合约 +struct CSecurityFtdcQryOFInstrumentField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///ETF证券代码 + TSecurityFtdcInstrumentIDType OFInstrumentID; +}; + +///查询SF合约 +struct CSecurityFtdcQrySFInstrumentField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///ETF证券代码 + TSecurityFtdcInstrumentIDType SFInstrumentID; +}; + +///查询合约单手保证金 +struct CSecurityFtdcQryInstrumentUnitMarginField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; +}; + +///查询期权资金限制参数 +struct CSecurityFtdcQryOptionsFundLimitParamField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; +}; + +///查询投资者期权持仓 +struct CSecurityFtdcQryInvestorOptionsPositionField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///标的合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; +}; + +///查询预交割信息 +struct CSecurityFtdcQryPreDelivInfoField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; +}; + +///查询可融券分配信息 +struct CSecurityFtdcQryCreditStockAssignInfoField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; +}; + +///查询可融资分配信息 +struct CSecurityFtdcQryCreditCashAssignInfoField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; +}; + +///查询证券折算率 +struct CSecurityFtdcQryConversionRateField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; +}; + +///查询历史信用负债信息 +struct CSecurityFtdcQryHisCreditDebtInfoField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; +}; + +///查询交易员报盘机 +struct CSecurityFtdcQryTraderOfferField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///会员代码 + TSecurityFtdcParticipantIDType ParticipantID; + ///交易所交易员代码 + TSecurityFtdcTraderIDType BranchPBU; +}; + +///查询行情报盘机 +struct CSecurityFtdcQryMDTraderOfferField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///会员代码 + TSecurityFtdcParticipantIDType ParticipantID; + ///交易所交易员代码 + TSecurityFtdcTraderIDType BranchPBU; +}; + +///查询前置状态 +struct CSecurityFtdcQryFrontStatusField +{ + ///前置编号 + TSecurityFtdcFrontIDType FrontID; +}; + +///查询用户会话 +struct CSecurityFtdcQryUserSessionField +{ + ///前置编号 + TSecurityFtdcFrontIDType FrontID; + ///会话编号 + TSecurityFtdcSessionIDType SessionID; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; +}; + +///查询报单 +struct CSecurityFtdcQryOrderField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///报单编号 + TSecurityFtdcOrderSysIDType OrderSysID; + ///开始时间 + TSecurityFtdcTimeType InsertTimeStart; + ///结束时间 + TSecurityFtdcTimeType InsertTimeEnd; +}; + +///查询报单操作 +struct CSecurityFtdcQryOrderActionField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; +}; + +///查询错误报单 +struct CSecurityFtdcQryErrOrderField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; +}; + +///查询错误报单操作 +struct CSecurityFtdcQryErrOrderActionField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; +}; + +///查询成交 +struct CSecurityFtdcQryTradeField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///成交编号 + TSecurityFtdcTradeIDType TradeID; + ///开始时间 + TSecurityFtdcTimeType TradeTimeStart; + ///结束时间 + TSecurityFtdcTimeType TradeTimeEnd; +}; + +///查询投资者持仓 +struct CSecurityFtdcQryInvestorPositionField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; +}; + +///查询出入金流水 +struct CSecurityFtdcQrySyncDepositField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///出入金流水号 + TSecurityFtdcDepositSeqNoType DepositSeqNo; +}; + +///用户口令变更 +struct CSecurityFtdcUserPasswordUpdateField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///原来的口令 + TSecurityFtdcPasswordType OldPassword; + ///新的口令 + TSecurityFtdcPasswordType NewPassword; +}; + +///资金账户口令变更域 +struct CSecurityFtdcTradingAccountPasswordUpdateField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者帐号 + TSecurityFtdcAccountIDType AccountID; + ///原来的口令 + TSecurityFtdcPasswordType OldPassword; + ///新的口令 + TSecurityFtdcPasswordType NewPassword; +}; + +///手工同步用户动态令牌 +struct CSecurityFtdcManualSyncBrokerUserOTPField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///动态令牌类型 + TSecurityFtdcOTPTypeType OTPType; + ///第一个动态密码 + TSecurityFtdcPasswordType FirstOTP; + ///第二个动态密码 + TSecurityFtdcPasswordType SecondOTP; +}; + +///经纪公司用户口令 +struct CSecurityFtdcBrokerUserPasswordField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///密码 + TSecurityFtdcPasswordType Password; +}; + +///资金账户口令域 +struct CSecurityFtdcTradingAccountPasswordField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者帐号 + TSecurityFtdcAccountIDType AccountID; + ///密码 + TSecurityFtdcPasswordType Password; +}; + +///用户权限 +struct CSecurityFtdcUserRightField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///客户权限类型 + TSecurityFtdcUserRightTypeType UserRightType; + ///是否禁止 + TSecurityFtdcBoolType IsForbidden; +}; + +///投资者账户 +struct CSecurityFtdcInvestorAccountField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///投资者帐号 + TSecurityFtdcAccountIDType AccountID; + ///是否主账户 + TSecurityFtdcBoolType IsDefault; + ///账户类型 + TSecurityFtdcAccountTypeType AccountType; + ///是否活跃 + TSecurityFtdcBoolType IsActive; + ///上交所交易单元号 + TSecurityFtdcTraderIDType SHBranchPBU; + ///深交所交易单元号 + TSecurityFtdcTraderIDType SZBranchPBU; +}; + +///用户IP +struct CSecurityFtdcUserIPField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///IP地址 + TSecurityFtdcIPAddressType IPAddress; + ///IP地址掩码 + TSecurityFtdcIPAddressType IPMask; + ///Mac地址 + TSecurityFtdcMacAddressType MacAddress; +}; + +///用户动态令牌参数 +struct CSecurityFtdcBrokerUserOTPParamField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///动态令牌提供商 + TSecurityFtdcOTPVendorsIDType OTPVendorsID; + ///动态令牌序列号 + TSecurityFtdcSerialNumberType SerialNumber; + ///令牌密钥 + TSecurityFtdcAuthKeyType AuthKey; + ///漂移值 + TSecurityFtdcLastDriftType LastDrift; + ///成功值 + TSecurityFtdcLastSuccessType LastSuccess; + ///动态令牌类型 + TSecurityFtdcOTPTypeType OTPType; +}; + +///用户登录请求 +struct CSecurityFtdcReqUserLoginField +{ + ///交易日 + TSecurityFtdcDateType TradingDay; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///密码 + TSecurityFtdcPasswordType Password; + ///用户端产品信息 + TSecurityFtdcProductInfoType UserProductInfo; + ///接口端产品信息 + TSecurityFtdcProductInfoType InterfaceProductInfo; + ///协议信息 + TSecurityFtdcProtocolInfoType ProtocolInfo; + ///Mac地址 + TSecurityFtdcMacAddressType MacAddress; + ///动态密码 + TSecurityFtdcPasswordType OneTimePassword; + ///终端IP地址 + TSecurityFtdcIPAddressType ClientIPAddress; + ///客户端认证码 + TSecurityFtdcAuthCodeType AuthCode; +}; + +///用户登录应答 +struct CSecurityFtdcRspUserLoginField +{ + ///交易日 + TSecurityFtdcDateType TradingDay; + ///登录成功时间 + TSecurityFtdcTimeType LoginTime; + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///交易系统名称 + TSecurityFtdcSystemNameType SystemName; + ///前置编号 + TSecurityFtdcFrontIDType FrontID; + ///会话编号 + TSecurityFtdcSessionIDType SessionID; + ///最大报单引用 + TSecurityFtdcOrderRefType MaxOrderRef; +}; + +///用户登出请求 +struct CSecurityFtdcUserLogoutField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; +}; + +///全部登出信息 +struct CSecurityFtdcLogoutAllField +{ + ///前置编号 + TSecurityFtdcFrontIDType FrontID; + ///会话编号 + TSecurityFtdcSessionIDType SessionID; + ///系统名称 + TSecurityFtdcSystemNameType SystemName; +}; + +///强制交易员退出 +struct CSecurityFtdcForceUserLogoutField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; +}; + +///经纪公司用户激活 +struct CSecurityFtdcActivateBrokerUserField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; +}; + +///输入报单 +struct CSecurityFtdcInputOrderField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///报单引用 + TSecurityFtdcOrderRefType OrderRef; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///报单价格条件 + TSecurityFtdcOrderPriceTypeType OrderPriceType; + ///买卖方向 + TSecurityFtdcDirectionType Direction; + ///组合开平标志 + TSecurityFtdcCombOffsetFlagType CombOffsetFlag; + ///组合投机套保标志 + TSecurityFtdcCombHedgeFlagType CombHedgeFlag; + ///价格 + TSecurityFtdcStockPriceType LimitPrice; + ///数量 + TSecurityFtdcVolumeType VolumeTotalOriginal; + ///有效期类型 + TSecurityFtdcTimeConditionType TimeCondition; + ///GTD日期 + TSecurityFtdcDateType GTDDate; + ///成交量类型 + TSecurityFtdcVolumeConditionType VolumeCondition; + ///最小成交量 + TSecurityFtdcVolumeType MinVolume; + ///触发条件 + TSecurityFtdcContingentConditionType ContingentCondition; + ///止损价 + TSecurityFtdcPriceType StopPrice; + ///强平原因 + TSecurityFtdcForceCloseReasonType ForceCloseReason; + ///自动挂起标志 + TSecurityFtdcBoolType IsAutoSuspend; + ///业务单元 + TSecurityFtdcBusinessUnitType BusinessUnit; + ///请求编号 + TSecurityFtdcRequestIDType RequestID; + ///用户强评标志 + TSecurityFtdcBoolType UserForceClose; +}; + +///输入报单操作 +struct CSecurityFtdcInputOrderActionField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///报单操作引用 + TSecurityFtdcOrderActionRefType OrderActionRef; + ///报单引用 + TSecurityFtdcOrderRefType OrderRef; + ///请求编号 + TSecurityFtdcRequestIDType RequestID; + ///前置编号 + TSecurityFtdcFrontIDType FrontID; + ///会话编号 + TSecurityFtdcSessionIDType SessionID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; + ///操作标志 + TSecurityFtdcActionFlagType ActionFlag; + ///价格 + TSecurityFtdcPriceType LimitPrice; + ///数量变化 + TSecurityFtdcVolumeType VolumeChange; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///交易所交易员代码 + TSecurityFtdcTraderIDType BranchPBU; + ///本地报单编号 + TSecurityFtdcOrderLocalIDType OrderLocalID; +}; + +///指定的合约 +struct CSecurityFtdcSpecificInstrumentField +{ + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; +}; + +///指定的交易所 +struct CSecurityFtdcSpecificExchangeField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; +}; + +///行情基础属性 +struct CSecurityFtdcMarketDataBaseField +{ + ///交易日 + TSecurityFtdcDateType TradingDay; + ///上次结算价 + TSecurityFtdcPriceType PreSettlementPrice; + ///昨收盘 + TSecurityFtdcPriceType PreClosePrice; + ///昨持仓量 + TSecurityFtdcLargeVolumeType PreOpenInterest; + ///昨虚实度 + TSecurityFtdcRatioType PreDelta; +}; + +///行情静态属性 +struct CSecurityFtdcMarketDataStaticField +{ + ///今开盘 + TSecurityFtdcPriceType OpenPrice; + ///最高价 + TSecurityFtdcPriceType HighestPrice; + ///最低价 + TSecurityFtdcPriceType LowestPrice; + ///今收盘 + TSecurityFtdcPriceType ClosePrice; + ///涨停板价 + TSecurityFtdcPriceType UpperLimitPrice; + ///跌停板价 + TSecurityFtdcPriceType LowerLimitPrice; + ///本次结算价 + TSecurityFtdcPriceType SettlementPrice; + ///今虚实度 + TSecurityFtdcRatioType CurrDelta; +}; + +///行情最新成交属性 +struct CSecurityFtdcMarketDataLastMatchField +{ + ///最新价 + TSecurityFtdcPriceType LastPrice; + ///数量 + TSecurityFtdcVolumeType Volume; + ///成交金额 + TSecurityFtdcMoneyType Turnover; + ///持仓量 + TSecurityFtdcLargeVolumeType OpenInterest; + ///数量(新) + TSecurityFtdcLargeVolumeType Volume_New; +}; + +///行情最优价属性 +struct CSecurityFtdcMarketDataBestPriceField +{ + ///申买价一 + TSecurityFtdcPriceType BidPrice1; + ///申买量一 + TSecurityFtdcVolumeType BidVolume1; + ///申卖价一 + TSecurityFtdcPriceType AskPrice1; + ///申卖量一 + TSecurityFtdcVolumeType AskVolume1; +}; + +///行情申买二、三属性 +struct CSecurityFtdcMarketDataBid23Field +{ + ///申买价二 + TSecurityFtdcPriceType BidPrice2; + ///申买量二 + TSecurityFtdcVolumeType BidVolume2; + ///申买价三 + TSecurityFtdcPriceType BidPrice3; + ///申买量三 + TSecurityFtdcVolumeType BidVolume3; +}; + +///行情申卖二、三属性 +struct CSecurityFtdcMarketDataAsk23Field +{ + ///申卖价二 + TSecurityFtdcPriceType AskPrice2; + ///申卖量二 + TSecurityFtdcVolumeType AskVolume2; + ///申卖价三 + TSecurityFtdcPriceType AskPrice3; + ///申卖量三 + TSecurityFtdcVolumeType AskVolume3; +}; + +///行情申买四、五属性 +struct CSecurityFtdcMarketDataBid45Field +{ + ///申买价四 + TSecurityFtdcPriceType BidPrice4; + ///申买量四 + TSecurityFtdcVolumeType BidVolume4; + ///申买价五 + TSecurityFtdcPriceType BidPrice5; + ///申买量五 + TSecurityFtdcVolumeType BidVolume5; +}; + +///行情申卖四、五属性 +struct CSecurityFtdcMarketDataAsk45Field +{ + ///申卖价四 + TSecurityFtdcPriceType AskPrice4; + ///申卖量四 + TSecurityFtdcVolumeType AskVolume4; + ///申卖价五 + TSecurityFtdcPriceType AskPrice5; + ///申卖量五 + TSecurityFtdcVolumeType AskVolume5; +}; + +///行情更新时间属性 +struct CSecurityFtdcMarketDataUpdateTimeField +{ + ///合约代码 + TSecurityFtdcInstrumentIDType InstrumentID; + ///最后修改时间 + TSecurityFtdcTimeType UpdateTime; + ///最后修改毫秒 + TSecurityFtdcMillisecType UpdateMillisec; + ///业务日期 + TSecurityFtdcDateType ActionDay; +}; + +///成交均价 +struct CSecurityFtdcMarketDataAveragePriceField +{ + ///当日均价 + TSecurityFtdcPriceType AveragePrice; +}; + +///行情交易所代码属性 +struct CSecurityFtdcMarketDataExchangeField +{ + ///交易所代码 + TSecurityFtdcExchangeIDType ExchangeID; +}; + +///信息分发 +struct CSecurityFtdcDisseminationField +{ + ///序列系列号 + TSecurityFtdcSequenceSeriesType SequenceSeries; + ///序列号 + TSecurityFtdcSequenceNoType SequenceNo; +}; + +///资金转账输入 +struct CSecurityFtdcInputFundTransferField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///投资者资金帐号 + TSecurityFtdcAccountIDType AccountID; + ///资金帐户密码 + TSecurityFtdcPasswordType Password; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///交易金额 + TSecurityFtdcTradeAmountType TradeAmount; + ///摘要 + TSecurityFtdcDigestType Digest; + ///账户类型 + TSecurityFtdcAccountTypeType AccountType; +}; + +///资金转账 +struct CSecurityFtdcFundTransferField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///投资者资金帐号 + TSecurityFtdcAccountIDType AccountID; + ///资金帐户密码 + TSecurityFtdcPasswordType Password; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///交易金额 + TSecurityFtdcTradeAmountType TradeAmount; + ///摘要 + TSecurityFtdcDigestType Digest; + ///会话编号 + TSecurityFtdcSessionIDType SessionID; + ///Liber核心流水号 + TSecurityFtdcLiberSerialType LiberSerial; + ///转账平台流水号 + TSecurityFtdcPlateSerialType PlateSerial; + ///第三方流水号 + TSecurityFtdcBankSerialType TransferSerial; + ///交易日 + TSecurityFtdcDateType TradingDay; + ///转账时间 + TSecurityFtdcTimeType TradeTime; + ///出入金方向 + TSecurityFtdcFundDirectionType FundDirection; + ///错误代码 + TSecurityFtdcErrorIDType ErrorID; + ///错误信息 + TSecurityFtdcErrorMsgType ErrorMsg; +}; + +///资金转账查询请求 +struct CSecurityFtdcQryFundTransferSerialField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者资金帐号 + TSecurityFtdcAccountIDType AccountID; + ///账户类型 + TSecurityFtdcAccountTypeType AccountType; +}; + +///资金内转 +struct CSecurityFtdcFundInterTransferField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///资金账户代码 + TSecurityFtdcAccountIDType AccountID; + ///资金账户密码 + TSecurityFtdcPasswordType Password; + ///金额 + TSecurityFtdcTradeAmountType TradeAmount; + ///内转类型 + TSecurityFtdcFundInterTransferTypeType TransferType; + ///资金内转编号 + TSecurityFtdcLiberSerialType SerialID; +}; + +///资金内转流水 +struct CSecurityFtdcFundInterTransferSerialField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///资金账户代码 + TSecurityFtdcAccountIDType AccountID; + ///资金账户密码 + TSecurityFtdcPasswordType Password; + ///金额 + TSecurityFtdcTradeAmountType TradeAmount; + ///内转类型 + TSecurityFtdcFundInterTransferTypeType TransferType; + ///资金内转编号 + TSecurityFtdcLiberSerialType SerialID; + ///转账时间 + TSecurityFtdcTimeType TransferTime; + ///错误代码 + TSecurityFtdcErrorIDType ErrorID; + ///错误信息 + TSecurityFtdcErrorMsgType ErrorMsg; +}; + +///资金内转流水查询请求 +struct CSecurityFtdcQryFundInterTransferSerialField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///投资者代码 + TSecurityFtdcInvestorIDType InvestorID; +}; + +///获取数据库信息 +struct CSecurityFtdcFetchDBInfoField +{ + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///密码 + TSecurityFtdcPasswordType Password; + ///数据库索引 + TSecurityFtdcUserNameType DBIndex; + ///数据库IP地址 + TSecurityFtdcIPAddressType IPAddress; + ///数据库IP端口 + TSecurityFtdcIPPortType IPPort; + ///数据库名称 + TSecurityFtdcUserNameType DBName; + ///数据库用户名 + TSecurityFtdcUserIDType DBUserID; + ///数据库密码 + TSecurityFtdcPasswordType DBPassword; +}; + +///MD用户信息 +struct CSecurityFtdcMDUserInfoField +{ + ///经纪公司代码 + TSecurityFtdcBrokerIDType BrokerID; + ///用户代码 + TSecurityFtdcUserIDType UserID; + ///用户名称 + TSecurityFtdcUserNameType UserName; + ///密码 + TSecurityFtdcPasswordType Password; + ///行情系统编号 + TSecurityFtdcSequenceNoType MDSysID; + ///股票最大订阅数量 + TSecurityFtdcVolumeType MaxStockCount; + ///期权最大订阅数量 + TSecurityFtdcVolumeType MaxOptionsCount; +}; + + +#endif