当前位置:网站首页>Hello CTP (III) - CTP quotation API
Hello CTP (III) - CTP quotation API
2022-06-25 04:03:00 【Tianshan old demon】
One 、 Futures market data
Tick Data generally refers to the data on the market one by one , For example, a commission will produce a market , A transaction will also produce a market . At present, domestic futures exchanges do not support pushing data one by one , Just push slices ( snapshot ) data .
Slice data refers to the statistics of each piece of data in a certain period of time into a snapshot , It's usually 1 second 2 pen .CTP The exchange quotation forwarded by the quotation ,500ms One snapshot .
Two 、CTP The market
1、CTP The market API brief introduction
CThostFtdcMdApi The market API The interface contains CThostFtdcMdApi and CThostFtdcMdSpi, adopt CThostFtdcMdApiApi towards CTP dispatch orders , adopt CThostFtdcMdSpi receive CTP Respond to .
(1) establish CTP API example
CThostFtdcMdApi *pMarketDataApi = CThostFtdcMdApi::CreateFtdcMdApi(dirName);
call CreateFtdcMdApi() establish API example ,pMarketDataApi, adopt API Instance initiates various requests , Such as connecting to the server 、 The user login 、 Subscription contracts 、 Cancel the contract, etc .
(2) establish CTP API Callback instance
MarketDataSource *pDataSource = new MarketDataSource(pMarketDataApi, this);
Developers need to inherit the technology provided in the previous issue CThostFtdcMdSpi class , Override class methods , To process all kinds of data sent by the server .
(3) register CTP API Callback instance
pMarketDataApi->RegisterSpi(pDataSource);
(4) Connect to the front-end server
pMarketDataApi_->RegisterFront((char *)serverAddr_.c_str());
pMarketDataApi_->Init();
After the connection request is sent ,OnFrontConnected() Will respond to the request , Usually in OnFrontConnected() Function for user login .
(5) The user login
stay OnFrontConnected() Function for user login .
CThostFtdcReqUserLoginField loginReq;
std::string BrokerID, InvestorID, Password;
memset(&loginReq, 0, sizeof(loginReq));
strcpy(loginReq.BrokerID, BrokerID.c_str());
strcpy(loginReq.UserID, InvestorID.c_str());
strcpy(loginReq.Password, Password.c_str());
static int requestID = 0;
int rt = pMarketDataApi->ReqUserLogin(&loginReq, requestID++);
After the login request OnRspUserLogin() Return response , If login is successful , You can subscribe to the contract .
(6) Subscribe to futures contracts
stay OnRspUserLogin() Function to subscribe to futures contracts .
const size_t count = contracts.size();
char *instruments[count];
pMarketDataApi_->SubscribeMarketData(instruments, (int)count);
(7) Contract subscription response
stay OnRspSubMarketData Return contract subscription result in function , If the client's request to subscribe to the market is illegal , Return the error information given by the server (pRspInfo); Even if the subscription request sent by the client is legal , The function will also be called back , The information returned is CTP:No Error.
(8) Receive quotes
void CTPMarketDataSource::OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData);
After the contract subscription is successful , During the trading period , The subscription contract market data will be pushed continuously . During non trading periods , Often receive dirty data , Dirty data is usually the maximum value of floating point numbers .
When the market data falls to the ground , If you are directly in OnRtnDepthMarketData Write the market data to CSV in , once IO More disk write operations will be associated with API The bottom layer receives market data and interferes with each other , At least, the data written to the file lags behind the real-time data , More importantly, it directly leads to the downtime of the subscription process .
There are two solutions , One is to SPI Thread receives data and market data and writes them on the ground CSV The two operations are isolated ,SPI The thread writes the received quotation data to the queue , Another thread reads data from the queue and writes it CSV; The other is to collect all the contract market data of the completed slice on the line , Then land the market data , There are hundreds of problems from the collection of slice Market data to the push of the next slice ms Time interval of , It can be used for data processing .
Some fields in the market data are invalid values ,CTP Unified use double The upper limit of 1.7976931348623157e+308 Express , Such as futures contract PreDelta、CurrDelta、ClosePrice、SettlementPrice.
2、CTP Market push rules
CTP The market push rule is :
(1)1 second 2 Snapshot market .
(2) Push only when there are updates , No updated contract push .
(3) Push the initial market after the first connection .
CTP The basic principle of pushing the market is to push twice per second , But push time ( millisecond ) Not strictly 000、500, That is, it is possible that the push time is 300、800.
adopt CTP API Even on CTP After the system ,CTP Will routinely push a recent market data , Used to remind the client whether there is a market in the current market .
The matching stage of call auction before opening , The exchange will also push the market . The time stamp of the market at the opening time may be greater than or equal to 500, It may also be less than 500.
In the Internet Environment , After opening CTP Will push the status of the contract ( If after opening , The contract status is updated to continuous transaction ), The news push time almost coincides with the time of the first market after the opening .
3、CTP Market acceptance
CTPMarketDataSource.h file :
#ifndef CTPMARKETDATASOURCE_H
#define CTPMARKETDATASOURCE_H
#include <vector>
#include <iostream>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <string.h>
#include <stdio.h>
#include "ThostFtdcMdApi.h"
class CTPMarketDataSource : public CThostFtdcMdSpi
{
public:
explicit CTPMarketDataSource(const char* yml);
void startMarketDataSource();
~CTPMarketDataSource();
public:
/// When the client establishes a communication connection with the transaction background ( Before logging in ) Called .
void OnFrontConnected();
/// It is called when the communication connection between the client and the transaction background is disconnected . When this happens ,API Will automatically reconnect , The client doesn't have to deal with it .
///@param nReason The reason for the error
/// 0x1001 Network read failed
/// 0x1002 Network writing failed
/// 0x2001 Receive heartbeat timeout
/// 0x2002 Sending heartbeat failed
/// 0x2003 Received error message
void OnFrontDisconnected(int nReason);
/// Heartbeat timeout warning . When the message is not received for a long time , The method is called .
///@param nTimeLapse The time from the last message received
void OnHeartBeatWarning(int nTimeLapse);
/// Login request response
void OnRspUserLogin(CThostFtdcRspUserLoginField *pRspUserLogin, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
/// Logout request response
void OnRspUserLogout(CThostFtdcUserLogoutField *pUserLogout, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
/// Error response
void OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
/// Subscribe to market response
void OnRspSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
/// Unsubscribe from
void OnRspUnSubMarketData(CThostFtdcSpecificInstrumentField *pSpecificInstrument, CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast);
/// Deep market notice
void OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData);
private:
CThostFtdcMdApi *m_pMdUserApi;
};
#endif // CTPMARKETDATASOURCE_H
CTPMarketDataSource.cpp file :
#include "CTPMarketDataSource.h"
CTPMarketDataSource::CTPMarketDataSource(const char *yml)
{
// Create a market API example
m_pMdUserApi = CThostFtdcMdApi::CreateFtdcMdApi();
}
void CTPMarketDataSource::startMarketDataSource()
{
// Register event class
m_pMdUserApi->RegisterSpi(this);
// Set the front address of the market
std::string FrontAddr;
m_pMdUserApi->RegisterFront(const_cast<char *>(FrontAddr.c_str()));
m_pMdUserApi->Init();
// Wait until the thread exits
m_pMdUserApi->Join();
}
CTPMarketDataSource::~CTPMarketDataSource()
{
}
void CTPMarketDataSource::OnFrontConnected()
{
CThostFtdcReqUserLoginField loginReq;
std::string BrokerID, InvestorID, Password;
memset(&loginReq, 0, sizeof(loginReq));
strcpy(loginReq.BrokerID, BrokerID.c_str());
strcpy(loginReq.UserID, InvestorID.c_str());
strcpy(loginReq.Password, Password.c_str());
static int requestID = 0;
int rt = m_pMdUserApi->ReqUserLogin(&loginReq, requestID++);
}
void CTPMarketDataSource::OnFrontDisconnected(int nReason)
{
}
void CTPMarketDataSource::OnHeartBeatWarning(int nTimeLapse)
{
}
void CTPMarketDataSource::OnRspUserLogin(
CThostFtdcRspUserLoginField *pRspUserLogin,
CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
bool bIsLast)
{
bool bResult = pRspInfo && (pRspInfo->ErrorID != 0);
if (bIsLast && !bResult)
{
printf(" Account login succeeded \n");
printf(" Trading day : %s", pRspUserLogin->TradingDay);
printf(" The login time : %s", pRspUserLogin->LoginTime);
printf(" Brokers : %s", pRspUserLogin->BrokerID);
printf(" Account name : %s", pRspUserLogin->UserID);
printf("SystemName: %s", pRspUserLogin->SystemName);
printf("ApiVersion: %s", m_pMdUserApi->GetApiVersion());
// Read contract configuration
int instrumentNum = 6;
char *instruments[instrumentNum];
int i = 0;
// Start subscribing to quotes
int rt = m_pMdUserApi->SubscribeMarketData(instruments, instrumentNum);
}
}
void CTPMarketDataSource::OnRspUserLogout(
CThostFtdcUserLogoutField *pUserLogout,
CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
bool bIsLast)
{
bool bResult = pRspInfo && (pRspInfo->ErrorID != 0);
}
void CTPMarketDataSource::OnRspError(CThostFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast)
{
bool bResult = pRspInfo && (pRspInfo->ErrorID != 0);
}
void CTPMarketDataSource::OnRspSubMarketData(
CThostFtdcSpecificInstrumentField *pSpecificInstrument,
CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
bool bIsLast)
{
bool bResult = pRspInfo && (pRspInfo->ErrorID != 0);
if (!bResult)
{
// Subscription succeeded
}
}
void CTPMarketDataSource::OnRspUnSubMarketData(
CThostFtdcSpecificInstrumentField *pSpecificInstrument,
CThostFtdcRspInfoField *pRspInfo,
int nRequestID,
bool bIsLast)
{
bool bResult = pRspInfo && (pRspInfo->ErrorID != 0);
}
void CTPMarketDataSource::OnRtnDepthMarketData(CThostFtdcDepthMarketDataField *pDepthMarketData)
{
// Receive market data
// Processing subscription contract market data
}
main.cpp file :
#include "CTPMarketDataSource.h"
#include "Logger.h"
int main(int argc, char *argv[])
{
CTPMarketDataSource *pMdSource = new CTPMarketDataSource("config.yml");
pMdSource->startMarketDataSource();
return 0;
}
CMakeLists.txt file :
cmake_minimum_required(VERSION 3.17)
PROJECT(CTPMarketDataSource)
set(CMAKE_CXX_FLAGS "-fPIC -O3")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Default output debug edition
#SET(CMAKE_BUILD_TYPE "Release")
SET(CMAKE_BUILD_TYPE "debug")
set(CMAKE_CXX_STANDARD 11)
set(CTP_INCLUDE ${CMAKE_SOURCE_DIR}/CTPLib/include)
include_directories(${CTP_INCLUDE})
set(CTP_LIB ${CMAKE_SOURCE_DIR}/CTPLib/lib)
link_directories(${CTP_LIB})
set(SOURCES main.cpp CTPMarketDataSource.cpp)
add_executable(${PROJECT_NAME} main.cpp CTPMarketDataSource.cpp)
target_link_libraries(${PROJECT_NAME} thostmduserapi_se pthread)
3、 ... and 、Sina The market
1、Sina Market introduction
Sina Finance provides real-time market data API The interface can be used to obtain the stock and index spot market , But there are usually delays . By visiting http://hq.sinajs.cn/list=sz002307,sh600928 Can get sz002307,sh600928 Market data of .
var hq_str_sz002307=" Beixin road and bridge ,8.700,8.820,9.080,9.310,8.630,9.080,9.100,108452484,968707402.800,42300,9.080,91100,9.070,17500,9.060,42200,9.050,19200,9.040,7048,9.100,16600,9.110,47300,9.120,20460,9.130,21400,9.140,2019-03-27,14:33:03,00";
var hq_str_sh600928=" Bank of Xi'an ,11.470,11.550,11.560,11.890,11.280,11.560,11.570,101874307,1186320558.000,46300,11.560,82562,11.550,57300,11.540,64300,11.530,27000,11.520,1100,11.570,6100,11.580,12700,11.590,27727,11.600,40600,11.610,2019-03-27,14:33:02,00";
2、Sina Market access
SinaMarketDataSource.h file :
#include <unistd.h>
#include <string>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <hpsocket/HPSocket4C.h>
class SinaMarketDataSource
{
public:
SinaMarketDataSource(){}
void StartMarketDataSource(const char* yml);
void Stop();
virtual ~SinaMarketDataSource();
private:
bool SendHTTPRequest(const char *data);
protected:
static EnHandleResult __HP_CALL OnConnect(HP_HttpClient pSender, CONNID dwConnID);
static EnHandleResult __HP_CALL OnHandShake(HP_HttpClient pSender, CONNID dwConnID);
static EnHandleResult __HP_CALL OnSend(HP_HttpClient pSender, CONNID dwConnID, const BYTE *pData, int iLength);
static EnHandleResult __HP_CALL OnReceive(HP_HttpClient pSender, CONNID dwConnID, const BYTE *pData, int iLength);
static EnHandleResult __HP_CALL OnClose(HP_HttpClient pSender, CONNID dwConnID, EnSocketOperation enOperation, int iErrorCode);
static EnHttpParseResult __HP_CALL OnMessageBegin(HP_HttpClient pSender, CONNID dwConnID);
static EnHttpParseResult __HP_CALL OnStatusLine(HP_HttpClient pSender, CONNID dwConnID, USHORT usStatusCode, LPCSTR lpszDesc);
static EnHttpParseResult __HP_CALL OnHeader(HP_HttpClient pSender, CONNID dwConnID, LPCSTR lpszName, LPCSTR lpszValue);
static EnHttpParseResult __HP_CALL OnHeadersComplete(HP_HttpClient pSender, CONNID dwConnID);
static EnHttpParseResult __HP_CALL OnBody(HP_HttpClient pSender, CONNID dwConnID, const BYTE *pData, int iLength);
static EnHttpParseResult __HP_CALL OnChunkHeader(HP_HttpClient pSender, CONNID dwConnID, int iLength);
static EnHttpParseResult __HP_CALL OnChunkComplete(HP_HttpClient pSender, CONNID dwConnID);
static EnHttpParseResult __HP_CALL OnMessageComplete(HP_HttpClient pSender, CONNID dwConnID);
static EnHttpParseResult __HP_CALL OnUpgrade(HP_HttpClient pSender, CONNID dwConnID, EnHttpUpgradeType enUpgradeType);
static EnHttpParseResult __HP_CALL OnParseError(HP_HttpClient pSender, CONNID dwConnID, int iErrorCode, LPCSTR lpszErrorDesc);
static EnHandleResult __HP_CALL OnWSMessageHeader(HP_HttpClient pSender, CONNID dwConnID, BOOL bFinal, BYTE iReserved, BYTE iOperationCode, const BYTE lpszMask[4], ULONGLONG ullBodyLen);
static EnHandleResult __HP_CALL OnWSMessageBody(HP_HttpClient pSender, CONNID dwConnID, const BYTE *pData, int iLength);
static EnHandleResult __HP_CALL OnWSMessageComplete(HP_HttpClient pSender, CONNID dwConnID);
private:
SinaMarketDataSource &operator=(const SinaMarketDataSource &);
SinaMarketDataSource(const SinaMarketDataSource &);
private:
HP_HttpClient m_pHTTPClient;
HP_HttpClientListener m_pHTTPClientListener;
static std::unordered_map<std::string, std::string> m_sTickerMarketData;
std::string m_URL;
};
SinaMarketDataSource.cpp file :
#include "SinaMarketDataSource.h"
std::unordered_map<std::string, std::string> SinaMarketDataSource::m_sTickerMarketData;
SinaMarketDataSource::SinaMarketDataSource()
{
m_URL = "http://hq.sinajs.cn?list=sh601003,sh601001";
m_pHTTPClientListener = ::Create_HP_HttpClientListener();
m_pHTTPClient = ::Create_HP_HttpClient(m_pHTTPClientListener);
::HP_Set_FN_HttpClient_OnConnect(m_pHTTPClientListener, OnConnect);
::HP_Set_FN_HttpClient_OnHandShake(m_pHTTPClientListener, OnHandShake);
::HP_Set_FN_HttpClient_OnReceive(m_pHTTPClientListener, OnReceive);
::HP_Set_FN_HttpClient_OnSend(m_pHTTPClientListener, OnSend);
::HP_Set_FN_HttpClient_OnClose(m_pHTTPClientListener, OnClose);
::HP_Set_FN_HttpClient_OnMessageBegin(m_pHTTPClientListener, OnMessageBegin);
::HP_Set_FN_HttpClient_OnStatusLine(m_pHTTPClientListener, OnStatusLine);
::HP_Set_FN_HttpClient_OnHeader(m_pHTTPClientListener, OnHeader);
::HP_Set_FN_HttpClient_OnHeadersComplete(m_pHTTPClientListener, OnHeadersComplete);
::HP_Set_FN_HttpClient_OnBody(m_pHTTPClientListener, OnBody);
::HP_Set_FN_HttpClient_OnChunkHeader(m_pHTTPClientListener, OnChunkHeader);
::HP_Set_FN_HttpClient_OnChunkComplete(m_pHTTPClientListener, OnChunkComplete);
::HP_Set_FN_HttpClient_OnMessageComplete(m_pHTTPClientListener, OnMessageComplete);
::HP_Set_FN_HttpClient_OnUpgrade(m_pHTTPClientListener, OnUpgrade);
::HP_Set_FN_HttpClient_OnParseError(m_pHTTPClientListener, OnParseError);
::HP_Set_FN_HttpClient_OnWSMessageHeader(m_pHTTPClientListener, OnWSMessageHeader);
::HP_Set_FN_HttpClient_OnWSMessageBody(m_pHTTPClientListener, OnWSMessageBody);
::HP_Set_FN_HttpClient_OnWSMessageComplete(m_pHTTPClientListener, OnWSMessageComplete);
::HP_HttpClient_SetUseCookie(m_pHTTPClient, true);
::HP_TcpClient_SetKeepAliveTime(m_pHTTPClient, 60000);
}
SinaMarketDataSource::~SinaMarketDataSource()
{
::Destroy_HP_HttpClient(m_pHTTPClient);
::Destroy_HP_HttpClientListener(m_pHTTPClientListener);
::HP_HttpCookie_MGR_SaveToFile("./cookie", TRUE);
}
void SinaMarketDataSource::StartMarketDataSource(const char *yml)
{
bool ret = ::HP_Client_StartWithBindAddress(m_pHTTPClient, "183.232.24.241", 80, false, NULL);
if (!ret)
{
printf("%s\n", ::HP_Client_GetLastErrorDesc(m_pHTTPClient));
}
while (true)
{
// Send quotation inquiry request
bool ok = SendHTTPRequest(m_URL.c_str());
if (!ok)
{
printf("%s\n", ::HP_Client_GetLastErrorDesc(m_pHTTPClient));
}
// Market data every 3 Push once a second
sleep(3);
}
}
void SinaMarketDataSource::Stop()
{
::HP_Client_Stop(m_pHTTPClient);
}
EnHandleResult __HP_CALL SinaMarketDataSource::OnConnect(HP_HttpClient pSender, CONNID dwConnID)
{
TCHAR szAddress[50];
int iAddressLen = sizeof(szAddress) / sizeof(TCHAR);
USHORT usPort;
::HP_Client_GetRemoteHost(pSender, szAddress, &iAddressLen, &usPort);
printf("connected to %s:%d successed\n", szAddress, usPort);
return HR_OK;
}
EnHandleResult __HP_CALL SinaMarketDataSource::OnHandShake(HP_HttpClient pSender, CONNID dwConnID)
{
return HR_OK;
}
EnHandleResult __HP_CALL SinaMarketDataSource::OnSend(HP_HttpClient pSender, CONNID dwConnID, const BYTE *pData, int iLength)
{
return HR_OK;
}
EnHandleResult __HP_CALL SinaMarketDataSource::OnReceive(HP_HttpClient pSender, CONNID dwConnID, const BYTE *pData, int iLength)
{
return HR_OK;
}
EnHandleResult __HP_CALL SinaMarketDataSource::OnClose(HP_HttpClient pSender, CONNID dwConnID, EnSocketOperation enOperation, int iErrorCode)
{
TCHAR szAddress[50];
int iAddressLen = sizeof(szAddress) / sizeof(TCHAR);
USHORT usPort;
::HP_Client_GetRemoteHost(pSender, szAddress, &iAddressLen, &usPort);
printf("{}:{} closed\n", szAddress, usPort);
return HR_OK;
}
EnHttpParseResult __HP_CALL SinaMarketDataSource::OnMessageBegin(HP_HttpClient pSender, CONNID dwConnID)
{
return HPR_OK;
}
EnHttpParseResult __HP_CALL SinaMarketDataSource::OnStatusLine(HP_HttpClient pSender, CONNID dwConnID, USHORT usStatusCode, LPCSTR lpszDesc)
{
return HPR_OK;
}
EnHttpParseResult __HP_CALL SinaMarketDataSource::OnHeader(HP_HttpClient pSender, CONNID dwConnID, LPCSTR lpszName, LPCSTR lpszValue)
{
return HPR_OK;
}
EnHttpParseResult __HP_CALL SinaMarketDataSource::OnHeadersComplete(HP_HttpClient pSender, CONNID dwConnID)
{
return HPR_OK;
}
EnHttpParseResult __HP_CALL SinaMarketDataSource::OnBody(HP_HttpClient pSender, CONNID dwConnID, const BYTE *pData, int iLength)
{
std::string response = (const char *)pData;
// Receive and process market data
return HPR_OK;
}
EnHttpParseResult __HP_CALL SinaMarketDataSource::OnChunkHeader(HP_HttpClient pSender, CONNID dwConnID, int iLength)
{
return HPR_OK;
}
EnHttpParseResult __HP_CALL SinaMarketDataSource::OnChunkComplete(HP_HttpClient pSender, CONNID dwConnID)
{
return HPR_OK;
}
EnHttpParseResult __HP_CALL SinaMarketDataSource::OnMessageComplete(HP_HttpClient pSender, CONNID dwConnID)
{
return HPR_OK;
}
EnHttpParseResult __HP_CALL SinaMarketDataSource::OnUpgrade(HP_HttpClient pSender, CONNID dwConnID, EnHttpUpgradeType enUpgradeType)
{
return HPR_OK;
}
EnHttpParseResult __HP_CALL SinaMarketDataSource::OnParseError(HP_HttpClient pSender, CONNID dwConnID, int iErrorCode, LPCSTR lpszErrorDesc)
{
return HPR_OK;
}
EnHandleResult __HP_CALL SinaMarketDataSource::OnWSMessageHeader(HP_HttpClient pSender, CONNID dwConnID, BOOL bFinal, BYTE iReserved, BYTE iOperationCode, const BYTE lpszMask[4], ULONGLONG ullBodyLen)
{
return HR_OK;
}
EnHandleResult __HP_CALL SinaMarketDataSource::OnWSMessageBody(HP_HttpClient pSender, CONNID dwConnID, const BYTE *pData, int iLength)
{
return HR_OK;
}
EnHandleResult __HP_CALL SinaMarketDataSource::OnWSMessageComplete(HP_HttpClient pSender, CONNID dwConnID)
{
BYTE iOperationCode;
::HP_HttpClient_GetWSMessageState(pSender, nullptr, nullptr, &iOperationCode, nullptr, nullptr, nullptr);
if (iOperationCode == 0x8)
return HR_ERROR;
return HR_OK;
}
bool SinaMarketDataSource::SendHTTPRequest(const char *url)
{
return HP_HttpClient_SendGet(m_pHTTPClient, url, NULL, 0);
}
main.cpp file :
#include "SinaMarketDataSource.h"
int main(int argc, char *argv[])
{
SinaMarketDataSource* source = new SinaMarketDataSource;
source->StartMarketDataSource("config.yml");
return 0;
}
CMakeLists.txt file :
cmake_minimum_required(VERSION 3.17)
PROJECT(SinaMarketDataSource)
set(CMAKE_CXX_FLAGS "-fPIC")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Default output debug edition
#SET(CMAKE_BUILD_TYPE "Release")
SET(CMAKE_BUILD_TYPE "debug")
set(CMAKE_CXX_STANDARD 11)
set(SOURCES main.cpp SinaMarketDataSource.cpp)
add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(${PROJECT_NAME} hpsocket4c pthread)
边栏推荐
- The programmer reality show is coming again! Hulan, as the host, carried the lamp to fill the knowledge. The SSS boss had a bachelor's degree in pharmacy. Zhu Jun and Zhang Min from Tsinghua joined th
- JS tool function, self encapsulating a throttling function
- How far is the memory computing integrated chip from popularization? Listen to what practitioners say | collision school x post friction intelligence
- DAP数据调度功能完善说明
- 太极图形60行代码实现经典论文,0.7秒搞定泊松盘采样,比Numpy实现快100倍
- Dr. Sun Jian was commemorated at the CVPR conference. The best student thesis was awarded to Tongji Ali. Lifeifei won the huangxutao Memorial Award
- 【Harmony OS】【ArkUI】ets开发 图形与动画绘制
- 俄罗斯AIRI研究院等 | SEMA:利用深度迁移学习进行抗原B细胞构象表征预测
- Windows 2003 64 bit system PHP running error: 1% is not a valid Win32 Application
- Jilin University 22 spring March "official document writing" assignment assessment-00029
猜你喜欢

Mobile mall project operation

(ultra detailed onenet TCP protocol access) arduino+esp8266-01s accesses the Internet of things platform, uploads real-time collected data /tcp transparent transmission (and how to obtain and write Lu

JSP cannot be resolved to a type error reporting solution

Break the memory wall with CPU scheme? Learn from PayPal stack to expand capacity, and the volume of missed fraud transactions can be reduced to 1/30

现在,耳朵也要进入元宇宙了

严重的PHP缺陷可导致QNAP NAS 设备遭RCE攻击

【Harmony OS】【ArkUI】ets开发 图形与动画绘制

Why can banana be a random number generator? Because it is the "king of radiation" in the fruit industry

Wuenda, the new course of machine learning is coming again! Free auditing, Xiaobai friendly

Dr. Sun Jian was commemorated at the CVPR conference. The best student thesis was awarded to Tongji Ali. Lifeifei won the huangxutao Memorial Award
随机推荐
Development of trading system (VI) -- HFT high frequency trading
Mobile mall project operation
DevEco Studio 3.0编辑器配置技巧篇
OpenSUSE environment variable settings
Development of trading system (I) -- Introduction to trading system
Does it count as staying up late to sleep at 2:00 and get up at 10:00? Unless you can do it every day
Sun Wu plays Warcraft? There is a picture and a truth
【Harmony OS】【ARK UI】ETS 上下文基本操作
ZABBIX installation pit avoidance Guide
JS tool function, self encapsulating a throttling function
Cesium 拖拽3D模型
Jilin University 22 spring March "official document writing" assignment assessment-00084
MySQL根据表前缀批量修改、删除表
Work assessment of Biopharmaceutics of Jilin University in March of the 22nd spring -00031
Teach you how to install win11 system in winpe
亚马逊在中国的另一面
Musk was sued for $258billion in MLM claims. TSMC announced the 2nm process. The Chinese Academy of Sciences found that the lunar soil contained water in the form of hydroxyl. Today, more big news is
Deveco studio 3.0 editor configuration tips
Jilin University 22 spring March document retrieval assignment assessment-00073
js工具函数,自己封装一个节流函数