79 if (type == AHType::ENTRUST) {
93 PrintSnapshot(snapshot);
111 << std::string_view(index->
MDStreamID, 4) <<
'\n'
115 << std::string_view(index->
SecurityID, 8) <<
'\n'
130 << std::string_view(index->
SecurityID, 8) <<
'\n'
143 index_.fetch_add(1, std::memory_order_relaxed);
160 << std::string_view(entrust->
MDStreamID, 4) <<
'\n'
162 << entrust->
Side <<
'\n'
165 << std::string_view(entrust->
SecurityID, 8) <<
'\n'
166 << entrust->
Price <<
'\n'
179 << std::string_view(entrust->
SecurityID, 8) <<
'\n'
186 entrust_.fetch_add(1, std::memory_order_relaxed);
203 << std::string_view(trade->
MDStreamID, 4) <<
'\n'
207 << std::string_view(trade->
SecurityID, 8) <<
'\n'
221 << std::string_view(trade->
SecurityID, 8) <<
'\n'
230 trade_.fetch_add(1, std::memory_order_relaxed);
247 << std::string_view(snapshot->
MDStreamID, 4) <<
'\n'
251 << std::string_view(snapshot->
SecurityID, 8) <<
'\n'
293 << snapshot->
OpenPx <<
'\n'
294 << snapshot->
HighPx <<
'\n'
295 << snapshot->
LowPx <<
'\n'
296 << snapshot->
LastPx <<
'\n'
305 << snapshot->
IOPV <<
'\n'
306 << snapshot->
LPV <<
'\n'
319 << std::string_view(snapshot->
SecurityID, 8) <<
'\n'
361 << snapshot->
OpenPx <<
'\n'
362 << snapshot->
HighPx <<
'\n'
363 << snapshot->
LowPx <<
'\n'
364 << snapshot->
LastPx <<
'\n'
373 << snapshot->
IOPV <<
'\n'
376 snapshot_.fetch_add(1, std::memory_order_relaxed);
409 std::atomic<int> index_{0};
410 std::atomic<int> entrust_{0};
411 std::atomic<int> trade_{0};
412 std::atomic<int> snapshot_{0};
413 std::atomic<bool> flag_{
true};
417 int main(
int argc,
char* argv[])
420 a.add<std::string>(
"config",
'c',
"config file",
false,
"../conf/config_annhoo_md_sdk.yaml");
421 a.add<std::string>(
"path",
'p',
"data path",
false,
"./data");
422 a.parse_check(argc, argv);
425 std::string config_file = a.get<std::string>(
"config");
426 std::string data_path = a.get<std::string>(
"path");
427 auto end = data_path.rend();
428 for (
auto it = data_path.rbegin(); it != end; ++it) {
430 data_path.pop_back();
442 std::vector<std::string> codes{
"000010 ",
"300002 ",
"600010 ",
"688002"};
This is the main interface to use library libAHQuotes.
This is the main interface to use library libAHQuotes.
virtual int SubscribeTick(const std::vector< std::string > &securityIDs)=0
Subscribe tick lists.
virtual void OnTickCB(AHTick *tick, uint16_t type) override
Callback for AHTick.
int main(int argc, char *argv[])
virtual void Join(void)=0
Join annhoo marketdata quotes end.
void PrintSnapshot(AHSnapshot *snapshot)
Callback for AHSnapshot print.
SubscribeAndPrint()
Constucts a SubscribeAndPrint.
virtual int Connect(bool master)=0
Connect udp server type.
virtual void UnRegisterSpi(IAHMdSpi *imp)=0
Unregister spi.
void Pause(void)
Pause callback(empty callback).
void PrintEntrus(AHTick *entrust)
Callback for AHTick SZ print.
void Reset(void)
Reset all count to zero.
virtual void OnSnapshotCB(AHSnapshot *snapshot) override
Callback for AHSnapshot.
virtual void RegisterSpi(IAHMdSpi *imp)=0
Register spi.
annhoo market data quotes api.
int64_t LastSubPrevLastPrice
annhoo::IAHMdApi * NewMdApi(const char *config_path)
Create a market data api.
virtual ~SubscribeAndPrint()
Frees the SubscribeAndPrint object.
Contains data defined for index.
void PrintIndex(AHIndex *index)
Callback for AHIndex print.
virtual void Start(void)=0
Start annhoo marketdata quotes.
void PrintTrade(AHTick *trade)
Callback for AHTrade print.
Contains data defined for snapshot.
int64_t LastSubPrevClosePrice
int64_t WeightedAvgOfferPx
annhoo markdata quotes api.
virtual void OnIndexCB(AHIndex *index) override
Callback for AHIndex.
Inheritance from IAHMdSpi.
void Resume(void)
Continue callback.