DbnStore::NextRecord
Returns the next record from the data source.
Returns
const Record*
The next record.
The particular record type will depend on the schema in the metadata.
Warning
The returned reference or pointer is only valid until the next call to NextRecord.
Copy the record or relevant fields to persist data across calls to NextRecord.
Returns nullptr when all records have been decoded.
API method
const Record* NextRecord(); Example usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <databento/historical.hpp>
#include <databento/record.hpp>
#include <iostream>
using namespace databento;
auto client =
Historical::Builder().SetKey("$YOUR_API_KEY").Build();
DbnStore dbn_store = client.TimeseriesGetRangeToFile(
"XNAS.ITCH", {"2024-06-24", "2024-06-29"}, {"META"},
Schema::Trades, "META_20240624-20240629.dbn.zst");
while (const Record* record = dbn_store.NextRecord()) {
const auto& trade_msg = record->Get<TradeMsg>();
if (trade_msg.size > 100) {
std::cout << trade_msg << '\n';
}
} Example response
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
TradeMsg {
hd = RecordHeader { length = 12, rtype = mbp-0, publisher_id = 2, instrument_id = 10451, ts_event = 2024-06-24T08:01:59.771923047Z },
price = 498.380000000,
size = 228,
action = Trade,
side = Ask,
flags = LAST | PUBLISHER_SPECIFIC (130),
depth = 0,
ts_recv = 2024-06-24T08:01:59.772093551Z,
ts_in_delta = 170504,
sequence = 383997
}
TradeMsg {
hd = RecordHeader { length = 12, rtype = mbp-0, publisher_id = 2, instrument_id = 10451, ts_event = 2024-06-24T08:02:10.254849369Z },
price = 498.380000000,
size = 120,
action = Trade,
side = Ask,
flags = LAST (128),
depth = 0,
ts_recv = 2024-06-24T08:02:10.255020595Z,
ts_in_delta = 171226,
sequence = 397630
}
...