-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
639 lines (520 loc) · 20.7 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
// NOTE: This is not part of the library, this file holds examples and tests
#include "uWS.h"
#include <string>
#include <iostream>
#include <chrono>
#include <cmath>
#include <thread>
#include <fstream>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <vector>
#include <atomic>
#include <iomanip>
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include "exchange/huobipro.h"
#include "exchange/binance.h"
#include "exchange/okex.h"
#include "exchange/exg58coin.h"
#include "exchange/zb.h"
#include "exchange/deribit.h"
#include "exchange/gateio.h"
#include "exchange/bitmex.h"
#include "exchange/poloniex.h"
#include "exchange/bitfinex.h"
#include "utils/httprequest.h"
#include "utils/misc.h"
#include "utils/trade.h"
#include "mail.h"
#include "SmtpMail.h"
#include "service/zmqservice.h"
using namespace rapidjson;
using namespace std;
void testWSS() {
uWS::Hub h;
h.onError([](void *user) {
switch ((long) user) {
case 1:
std::cout << "Client emitted error on invalid URI" << std::endl;
break;
case 2:
std::cout << "Client emitted error on resolve failure" << std::endl;
break;
case 3:
std::cout << "Client emitted error on connection timeout (non-SSL)" << std::endl;
break;
case 5:
std::cout << "Client emitted error on connection timeout (SSL)" << std::endl;
break;
case 6:
std::cout << "Client emitted error on HTTP response without upgrade (non-SSL)" << std::endl;
break;
case 7:
std::cout << "Client emitted error on HTTP response without upgrade (SSL)" << std::endl;
break;
case 10:
std::cout << "Client emitted error on poll error" << std::endl;
break;
case 11:
static int protocolErrorCount = 0;
protocolErrorCount++;
std::cout << "Client emitted error on invalid protocol" << std::endl;
if (protocolErrorCount > 1) {
std::cout << "FAILURE: " << protocolErrorCount << " errors emitted for one connection!" << std::endl;
exit(-1);
}
break;
default:
std::cout << "FAILURE: " << user << " should not emit error!" << std::endl;
exit(-1);
}
});
h.onConnection([](uWS::WebSocket<uWS::CLIENT> *ws, uWS::HttpRequest req) {
//wsc = ws;
switch ((long) ws->getUserData()) {
case 8:
std::cout << "Client established a remote connection over non-SSL" << std::endl;
//ws->close(1000);
break;
case 9:
cout << "Client established a remote connection over SSL" << endl;
//string subststr = "{\'event\':\'addChannel\',\'channel\':\'ok_sub_spot_ada_btc_depth\'}";
//ws->send(subststr.c_str());
ws->send("{\'event\':\'addChannel\',\'channel\':\'ok_sub_spot_eos_usdt_depth\'}");
break;
default:
std::cout << "FAILURE: " << ws->getUserData() << " should not connect!" << std::endl;
exit(-1);
}
});
h.onMessage([](uWS::WebSocket<uWS::CLIENT> *ws, char *message, size_t length, uWS::OpCode opCode) {
//cout << string(message, length) << endl;
string msg = string(message, length);
msg.pop_back();
msg.erase(0,1);
cout<<msg<<endl;
});
h.onDisconnection([](uWS::WebSocket<uWS::CLIENT> *ws, int code, char *message, size_t length) {
std::cout << "Client got disconnected with data: " << ws->getUserData() << ", code: " << code << ", message: <" << std::string(message, length) << ">" << std::endl;
});
string wssdomain = "wss://real.okex.com:10441/websocket";
h.connect(wssdomain.c_str(), (void *) 9);
/* h.connect("invalid URI", (void *) 1);
h.connect("invalid://validButUnknown.yolo", (void *) 11);
h.connect("ws://validButUnknown.yolo", (void *) 2);
h.connect("ws://echo.websocket.org", (void *) 3, {}, 10);
h.connect("ws://echo.websocket.org", (void *) 8);
h.connect("wss://echo.websocket.org", (void *) 5, {}, 10);
h.connect("wss://echo.websocket.org", (void *) 9);
h.connect("ws://google.com", (void *) 6);
h.connect("wss://google.com", (void *) 7);
h.connect("ws://127.0.0.1:6000", (void *) 10, {}, 60000); */
h.run();
std::cout << "Falling through testConnections" << std::endl;
}
//
void sendmailtest()
{
string smtpserver = "smtp.qq.com";
string username = "[email protected]";
string password = "bcvtbjbknlgsbdeb";
string toaddr = "[email protected]";
//sendmail();
SmtpMail smtpmail = SmtpMail("utf-8");
smtpmail.SetSmtpServer(username,password,smtpserver,"465");
smtpmail.SetSendName("holyshit");
smtpmail.SetSendMail(username);
smtpmail.AddRecvMail(toaddr);
smtpmail.SetSubject("Buy signal...Go!!!");
smtpmail.SetBodyContent("just doe it~");
smtpmail.SendMail();
}
void bitmextrade(){
cout<<"--------BITMEX TRADE MONITOR---------"<<endl;
int time=1000*60*5;
bitmex * bm = new bitmex();
bm->init_table();
bm->start_stream();
//bm->subscribe_depth("xx"); //sub string not correct
bm->subscribe_trade("xx");
//this_thread::sleep_until(chrono::system_clock::now() + chrono::hours(numeric_limits<int>::max()));
cout<<"sleep 5s.."<<endl;
chrono::milliseconds dura(5000);
this_thread::sleep_for(dura);
zmq::socket_t socket (zmqservice::context, ZMQ_DEALER);
cout<<"connect to inproc tunneltrade..."<<endl;
socket.connect("inproc:///tmp/tunneltrade");
while(true){
chrono::milliseconds dura(time);
this_thread::sleep_for(dura);
char data[200]={0};
zmq::message_t msg(128);
memset(msg.data(),0,128);
cout<<"-----Bitmex TRADE------ "<<getCurrentSystemTime()<<" ----------------"<<endl;
cout<<"ask_amt: "<<bm->ask_amount<<" bid_amt: "<<bm->bid_amount<<endl;
cout<<"ask sum: "<<bm->ask_sum<<" bid sum: "<<bm->bid_sum<<endl;
if( bm->ask_sum==0 ){
bm->ask_sum=1;
}
if( bm->bid_sum==0 ){
bm->bid_sum=1;
}
double askbid = bm->ask_sum/bm->bid_sum;
double bidask = bm->bid_sum/bm->ask_sum;
cout<<"ask/bid: "<<askbid<<endl;
cout<<"bid/ask: "<<bidask<<endl;
int t = unix_timestamp();
sprintf(data,"tradedata %f %f %f %f %.2f %.2f %d end",bm->ask_amount,bm->bid_amount,bm->ask_sum,bm->bid_sum,askbid,bidask,t);
memcpy(msg.data(),data,strlen(data));
socket.send(msg);
bm->ask_amount=0;
bm->ask_sum=0;
bm->bid_amount=0;
bm->bid_sum=0;
if(askbid>3.0){
cout<<"####### signal----->sell-----sell/buy ####### "<<askbid<<endl;
}
if(bidask>3.0){
cout<<"####### signal----->buy------buy/sell ####### "<<bidask<<endl;
}
}
}
void bitmexbook(){
cout<<"--------BITMEX BOOK MONITOR---------"<<endl;
int time =1000;
bitmex * bm = new bitmex();
bm->init_table();
bm->start_stream();
bm->subscribe_depth("xx"); //sub string not correct
cout<<"wait 5s..."<<endl;
chrono::milliseconds dura(5000);
this_thread::sleep_for(dura);
//bm->select_askamount("XBTUSDSell");
zmq::socket_t socket (zmqservice::context, ZMQ_DEALER);
cout<<"connect to inproc tunnelbook..."<<endl;
socket.connect("inproc:///tmp/tunnelbook");
while(true){
chrono::milliseconds dura(time); //100ms is the best for bitmex orderbook display . 3000ms is the best for sum amount
this_thread::sleep_for(dura);
char data[200]={0};
zmq::message_t msg(128);
memset(msg.data(),0,128);
//bm->select_price("XBTUSDSell","asc",10);
//bm->select_price("XBTUSDBuy","desc",10);
//bm->select_minsellprice("XBTUSDSell");
bm->select_askamount("XBTUSDSell");
bm->select_bidamount("XBTUSDBuy");
double a_b = bm->m_ask/bm->m_bid;
double b_a = bm->m_bid/bm->m_ask;
int t = unix_timestamp();
cout<<"------Bitmex BOOK----------- "<<getCurrentSystemTime()<<" ---------------"<<endl;
//cout<<"ask book amt:"<<bm->m_ask<<endl;
//cout<<"bid book amt:"<<bm->m_bid<<endl;
cout<<"sell/buy----"<<a_b<<endl;
cout<<"buy/sell----"<<b_a<<endl;
sprintf(data,"bookdata %.1f %.1f %.2f %.2f %d end",bm->m_ask,bm->m_bid,a_b,b_a,t); //must %.1f
memcpy(msg.data(),data,strlen(data));
socket.send(msg);
if(a_b>6.0){
cout<<"####### signal----->sell-----sell/buy ####### "<<a_b<<endl;
}
if(b_a>6.0){
cout<<"####### signal----->buy------buy/sell ####### "<<b_a<<endl;
}
}
//bm->selectprice("XBTUSDSell");
//bm->selectprice("XBTUSDBuy");
}
void bitfinexbook(){
bitfinex *bf = new bitfinex();
bf->start_stream();
bf->subscribe_depth("tBTCUSD");
// this_thread::sleep_until(chrono::system_clock::now() + chrono::hours(numeric_limits<int>::max()));
while(true){
// cout<<"sleep 60 sec"<<endl;
chrono::milliseconds dura(1000);
this_thread::sleep_for(dura);
cout<<"-----Bitfinex Book------ "<<getCurrentSystemTime()<<" -----------"<<endl;
int cnt_ask=0;
map<double,double>::reverse_iterator rit_ask;
for(rit_ask=bf->symbol_askbid_table["tBTCUSD"].ask_table.rbegin();rit_ask!=bf->symbol_askbid_table["tBTCUSD"].ask_table.rend();rit_ask++){
// cout<<"ask-----"<<rit->first<<" "<<rit->second<<endl;
bf->book_asksum += rit_ask->first * rit_ask->second;
if(cnt_ask>15){
break;
}
cnt_ask++;
}
int cnt_bid = 0;
map<double,double>::reverse_iterator rit_bid;
for(rit_bid=bf->symbol_askbid_table["tBTCUSD"].bid_table.rbegin();rit_bid!=bf->symbol_askbid_table["tBTCUSD"].bid_table.rend();rit_bid++){
// cout<<"bid-----"<<rit->first<<" "<<rit->second<<endl;
bf->book_bidsum += rit_bid->first * rit_bid->second;
if(cnt_bid>15){
break;
}
cnt_bid++;
}
double askbid = bf->book_asksum/bf->book_bidsum;
double bidask = bf->book_bidsum/bf->book_asksum;
cout<<"askbid --- "<<abs(askbid)<<endl;
cout<<"bidask --- "<<abs(bidask)<<endl;
bf->book_asksum = 0;
bf->book_bidsum = 0;
}
}
void bitfinextrade(){
bitfinex *bf = new bitfinex();
bf->start_stream();
bf->subscribe_trade("tBTCUSD");
while(true){
// cout<<"sleep 60 sec"<<endl;
chrono::milliseconds dura(1000*60*5);
this_thread::sleep_for(dura);
cout<<"-----Bitfinex Trade------ "<<getCurrentSystemTime()<<" -----------"<<endl;
/* cout<<"ask amount "<<"bid amount"<<endl;
cout<<bf->ask_amount<<" "<<bf->bid_amount<<endl;
cout<<"ask sum "<<"bid sum"<<endl;
cout<<bf->ask_sum<<" "<<bf->bid_sum<<endl;*/
cout<<"ask/bid "<<bf->ask_sum/bf->bid_sum<<endl;
cout<<"bid/ask "<<bf->bid_sum/bf->ask_sum<<endl;
bf->ask_amount=0;
bf->ask_sum=0;
bf->bid_amount=0;
bf->bid_sum=0;
}
}
int main(int argc, char *argv[])
{
//serveEventSource();
//serveHttp();
//serveBenchmark();
#ifdef UWS_THREADSAFE
// testThreadSafety();
#endif
//need thread start
/*
testWSS();
thread t(testWSS);
t.join(); */
//zmqservice::start();
bitmexbook();
//bitmextrade();
//bitfinexbook();
//bitfinextrade();
this_thread::sleep_until(chrono::system_clock::now() + chrono::hours(numeric_limits<int>::max()));
while(true){
// cout<<"sleep 60 sec"<<endl;
cout<<"-----1s-----"<<endl;
chrono::milliseconds dura(1000);
this_thread::sleep_for(dura);
/*
//print the book table
map<double,double>::reverse_iterator rit;
cout<<bf->symbol_askbid_table["tBTCUSD"].ask_table.size()<<endl;
for(rit=bf->symbol_askbid_table["tBTCUSD"].ask_table.rbegin();rit!=bf->symbol_askbid_table["tBTCUSD"].ask_table.rend();rit++){
cout<<"ask-----"<<rit->first<<" "<<rit->second<<endl;
}
int cnt = 0;
map<double,double>::reverse_iterator rit;
for(rit=bf->symbol_askbid_table["tBTCUSD"].bid_table.rbegin();rit!=bf->symbol_askbid_table["tBTCUSD"].bid_table.rend();rit++){
cout<<"bid-----"<<rit->first<<" "<<rit->second<<endl;
if(cnt>10){
break;
}
cnt++;
} */
}
/*
zmq::socket_t socket (zmqservice::context, ZMQ_DEALER);
chrono::milliseconds dura(5*1000);
this_thread::sleep_for(dura);
cout<<"after 5s,connect to myinprctunnel..."<<endl;
socket.connect("inproc:///tmp/xxxxx11111");
cout<<"send msg..."<<endl;
zmq::message_t msg(10);
memcpy(msg.data(),"xxxxx",10);
socket.send(msg);
//zmq_send(msg); */
this_thread::sleep_until(chrono::system_clock::now() + chrono::hours(numeric_limits<int>::max()));
/*
string uri = genuri_byparm();
string domain = "https://api.huobi.pro";
string url = domain + "/v1/account/accounts?" + uri;
string header = "Content-Type:application/x-www-form-urlencoded";
https_get(url,header);
*/
/*
huobipro *hb = new huobipro();
//string hbstr = hb->get_balance();
//cout <<hbstr<<endl;
hb->start_stream();
//hb->subscribe_depth("btcusdt");
hb->subscribe_trade_detail("btcusdt");
// this_thread::sleep_until(chrono::system_clock::now() + chrono::hours(numeric_limits<int>::max()));
while(true){
// cout<<"sleep 60 sec"<<endl;
cout<<"-----60s-----"<<endl;
chrono::milliseconds dura(300000);
this_thread::sleep_for(dura);
cout<<getCurrentSystemTime()<<endl;
cout<<"ask amount "<<"bid amount"<<endl;
cout<<hb->ask_amount<<" "<<hb->bid_amount<<endl;
cout<<"ask sum "<<"bid sum"<<endl;
cout<<hb->ask_sum<<" "<<hb->bid_sum<<endl;
cout<<"ask/bid "<<hb->ask_sum/hb->bid_sum<<endl;
cout<<"bid/ask "<<hb->bid_sum/hb->ask_sum<<endl;
hb->ask_amount=0;
hb->ask_sum=0;
hb->bid_amount=0;
hb->bid_sum=0;
} */
/*
bitmex * bm = new bitmex();
bm->start_stream();
bm->subscribe_depth("xx"); //sub string not correct
string exg58smb = "btc_usdt";
string type = "SWAPS_ORDER"; //ORDER_BOOK
exg58coin *exg58 = new exg58coin();
exg58->start_stream();
exg58->subscribe_depth(exg58smb,type);
string exg58smb = "btc_usdt";
string type = "SWAPS_MARKET";
exg58coin *exg58 = new exg58coin();
exg58->start_stream();
exg58->subscribe_depth(exg58smb,type);
bitfinex *bf = new bitfinex();
bf->start_stream();
poloniex *pln = new poloniex();
pln->start_stream();
pln->subscribe_depth("xx");
gateio *gate = new gateio();
gate->start_stream();
gate->server_sign();
gate->subscribe_depth("xx");
deribit *db = new deribit();
db->start_stream();
db->subscribe_depth("d");
zb *exgzb =new zb();
exgzb->start_stream();
exgzb->subscribe_depth("btcusdt_depth");
huobipro *hb = new huobipro();
//string hbstr = hb->get_balance();
//cout <<hbstr<<endl;
hb->start_stream();
hb->subscribe_depth("market.btcusdt.depth.step5");
*/
//string hb = hb.create_limit_buyorder();
//string hbb = hb.create_limit_sellorder();
//huobipro *hb = new huobipro();
//string result = hb->get_balance();
//string result = hb->create_limit_sell_order("xrpusdt",1.58,0.6);
//cout<<result<<endl;
/*
string bnsym = "xlmbtc";
binance *bn = new binance();
//string result = bn->create_limit_sell_order("ethusdt",0.17910,480);
//cout<< result <<endl;
//bn->start_stream(); //don't run this useless code
bn->subscribe_depth(bnsym); */
//string result = bn->get_snapshot_depth("EOSUSDT",10);
//bn->parse_snapshot_to_map(result,"eosusdt");
//cout<<"sleep 10 sec"<<endl;
//chrono::milliseconds dura(10000);
//cout<<"subscribe btcusdt"<<endl;
//bn->subscribe_depth("btcusdt");
/* string oksym = "ok_sub_spot_xrp_usdt_depth";
okex *ok = new okex();
ok->start_stream();
ok->subscribe_depth(oksym); */
//cout<<"all wss is ok ....."<<endl;
//string result = ok->create_limit_sell_order("eos_usdt",2.1965,8.0);
//cout <<result<<endl;
/* string oksym = "ok_sub_spot_xlm_btc_depth";
okex *ok = new okex();
ok->start_stream();
ok->subscribe_depth(oksym); */
/* while(true){
// cout<<"sleep 0.5 sec"<<endl;
chrono::milliseconds dura(500);
this_thread::sleep_for(dura);
map<double,double>::reverse_iterator rit;
for(rit=bm->symbol_askbid_table["XBTUSD"].ask_table.rbegin();rit!=bm->symbol_askbid_table["XBTUSD"].ask_table.rend();rit++){
cout<<"ask-----"<<rit->first<<" "<<rit->second<<endl;
}
int cnt = 0;
map<double,double>::reverse_iterator rit;
for(rit=exg58->symbol_askbid_table[exg58smb].bid_table.rbegin();rit!=exg58->symbol_askbid_table[exg58smb].bid_table.rend();rit++){
cout<<"ask-----"<<rit->first<<" "<<rit->second<<endl;
if(cnt>10){
break;
}
cnt++;
}
} */
//this_thread::sleep_until(chrono::system_clock::now() + chrono::hours(numeric_limits<int>::max()));
/* while(true){
cout<<"sleep 1 sec------------"<<endl;
chrono::milliseconds dura(1000);
this_thread::sleep_for(dura);
map<double,double>::reverse_iterator rit;
for(rit=ok->symbol_askbid_table[oksym].ask_table.rbegin();rit!=ok->symbol_askbid_table[oksym].ask_table.rend();rit++){
cout<<"ask-----"<<rit->first<<" "<<rit->second<<endl;
}
int cnt = 0;
map<double,double>::reverse_iterator rit;
for(rit=ok->symbol_askbid_table[oksym].bid_table.rbegin();rit!=ok->symbol_askbid_table[oksym].bid_table.rend();rit++){
cout<<"bid-----"<<rit->first<<" "<<rit->second<<endl;
if(cnt>10){
break;
}
cnt++;
}
} */
//this_thread::sleep_for(dura);
cout<<"loop..."<<endl;
//need to check two exchange wss state
while(true){
//cout<<"sleep 0.5 sec"<<endl;
chrono::milliseconds dura(500);
this_thread::sleep_for(dura);
/* double bnprice1 = bn->symbol_askbid_table[bnsym].ask_table.begin()->first;
double bnquantity1 = bn->symbol_askbid_table[bnsym].ask_table.begin()->second;
double okprice1 = ok->symbol_askbid_table[oksym].bid_table.rbegin()->first;
double okquantity1 = ok->symbol_askbid_table[oksym].bid_table.rbegin()->second;
double profit1 = profitcalc(bnprice1,bnquantity1,0.001,okprice1,okquantity1,0.002); */
//need to put into a iterator
/* double bnprice2 = bn->symbol_askbid_table[bnsym].bid_table.rbegin()->first;
double bnquantity2 = bn->symbol_askbid_table[bnsym].bid_table.rbegin()->second;
double okprice2 = ok->symbol_askbid_table[oksym].ask_table.begin()->first;
double okquantity2 = ok->symbol_askbid_table[oksym].ask_table.begin()->second;
double profit2 = profitcalc(okprice2,okquantity2,0.002,bnprice2,bnquantity2,0.001); */
/* double tradeqtt = (bnquantity>okquantity)?okquantity:bnquantity;
string sy = "eosusdt";
thread tbuy(buy,bn,sy,tradeqtt,bnprice);
string sellby = "ok_sub_spot_eos_usdt_depth";
thread tsell(sell,ok,sellby,tradeqtt,okprice);
tbuy.join();
tsell.join();
cout<<"buy and sell is complete.."<<endl; */
// this_thread::sleep_until(chrono::system_clock::now() + chrono::hours(numeric_limits<int>::max()));
}
/*
while(true){
//cout<<"sleep 1 sec"<<endl;
chrono::milliseconds dura(500);
this_thread::sleep_for(dura);
double bnprice = bn->symbol_askbid_table["eosusdt"].bid_table.begin()->first;
double bnquantity = bn->symbol_askbid_table["eosusdt"].bid_table.begin()->second;
double okprice = ok->symbol_askbid_table["ok_sub_spot_eos_usdt_depth"].ask_table.rbegin()->first;
double okquantity = ok->symbol_askbid_table["ok_sub_spot_eos_usdt_depth"].ask_table.rbegin()->second;
profitcalc(okprice,okquantity,0.002,bnprice,bnquantity,0.001);
}*/
//start the zeroMQ pub-sub server
// json parse
}