-
Notifications
You must be signed in to change notification settings - Fork 230
Expand file tree
/
Copy pathmain.cpp
More file actions
33 lines (26 loc) · 981 Bytes
/
main.cpp
File metadata and controls
33 lines (26 loc) · 981 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
#include "ccapi_cpp/ccapi_session.h"
namespace ccapi {
class MyLogger final : public Logger {
public:
void logMessage(const std::string& severity, const std::string& threadId, const std::string& timeISO, const std::string& fileName,
const std::string& lineNumber, const std::string& message) override {
std::lock_guard<std::mutex> lock(m);
std::cout << threadId << ": [" << timeISO << "] {" << fileName << ":" << lineNumber << "} " << severity << std::string(8, ' ') << message << std::endl;
}
private:
std::mutex m;
};
MyLogger myLogger;
Logger* Logger::logger = &myLogger;
} /* namespace ccapi */
using ::ccapi::Session;
using ::ccapi::Subscription;
int main(int argc, char** argv) {
Session session;
Subscription subscription("bybit", "BTCUSDT", "MARKET_DEPTH");
session.subscribe(subscription);
std::this_thread::sleep_for(std::chrono::seconds(10));
session.stop();
std::cout << "Bye" << std::endl;
return EXIT_SUCCESS;
}