-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest4.cpp
More file actions
46 lines (34 loc) · 958 Bytes
/
test4.cpp
File metadata and controls
46 lines (34 loc) · 958 Bytes
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
#include "bookmanager_new.hpp"
#include <iostream>
#include <csignal>
#include <chrono>
static bool RUNNING = true;
void signal_handler(int) {
RUNNING = false;
}
int main() {
std::signal(SIGINT, signal_handler);
BookManager bm;
bm.AddExchange(
"https://api.exchange.coinbase.com/products/BTC-USD/book?level=2",
"coinbase",
200
);
// this is gemini top level book
bm.AddExchange(
"https://api.gemini.com/v1/book/BTCUSD",
"gemini",
300
);
//std::cout << "Starting BookManager worker thread…" << std::endl;
bm.Start();
while (RUNNING) {
std::cout << "================ ORDER BOOKS ================\n";
bm.PrintBooksTop5();
std::cout << "=============================================\n";
std::this_thread::sleep_for(std::chrono::seconds(1));
}
std::cout << "Stopping…" << std::endl;
bm.Stop();
return 0;
}