-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathreadme.cpp
More file actions
21 lines (19 loc) · 813 Bytes
/
readme.cpp
File metadata and controls
21 lines (19 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Duplicate of the example usage code from the README.md to ensure
// it compiles and to be able to clang-format it.
#include <databento/dbn.hpp>
#include <databento/historical.hpp>
#include <databento/symbol_map.hpp>
#include <iostream>
namespace db = databento;
int main() {
auto client = db::Historical::Builder().SetKey("$YOUR_API_KEY").Build();
auto store =
client.TimeseriesGetRange("GLBX.MDP3", {"2022-06-10T14:30", "2022-06-10T14:40"},
{"ESM2", "NQZ2"}, db::Schema::Trades);
auto symbol_map = store.GetMetadata().CreateSymbolMap();
while (const auto* record = store.NextRecord()) {
const auto& trade_msg = record->Get<db::TradeMsg>();
std::cout << "Received trade for " << symbol_map.At(trade_msg) << ": " << trade_msg
<< '\n';
}
}