-
Notifications
You must be signed in to change notification settings - Fork 1
/
example.cpp
33 lines (30 loc) · 1.31 KB
/
example.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
#include <iostream>
#include <string>
#include "parse.h"
#include "dump.h"
struct Printer
{
template<class Msg>
void operator()(const Msg& msg) const
{
std::cout << msg;
}
};
int main()
{
// An "Order Added" message
const char msg[] = {
'A', // messageType: OrderAdded
'\xFF', '\xEE', '\xDD', '\xCC', // timestamp: 4293844428
'\xFF', '\xEE', // tradeDate: 65518
'\xFF', '\xEE', '\xDD', '\xCC', // contractNumber: 4293844428
'B', // side: Buy
'\xFF', '\xEE', '\xDD', '\xCC', '\xBB', '\xAA', '\x99', '\x88', // orderNumber: 18441921395520346504
'\xFF', '\xEE', '\xDD', '\xCC', // orderBookPriority: 4293844428
'\xFF', '\xEE', '\xDD', '\xCC', // quantity: 4293844428
'\xFF', '\xEE', '\xDD', '\xCC' // price: -1122868
};
// Parse and print out a human-readable version of the message
auto status = asx24itch::parse(msg, sizeof msg, Printer());
return status == asx24itch::ParseStatus::OK ? 0 : 1;
}