Skip to content

Commit 10f05e0

Browse files
authored
VER: Release 0.37.0
2 parents 84a307e + 8747cad commit 10f05e0

26 files changed

+184
-153
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## 0.37.0 - 2025-06-03
4+
5+
### Breaking changes
6+
- Changed the type of the `output_dir` parameter in ` HistoricalClient::BatchDownload()`
7+
to a `std::filesystem::path` and the return type to `std::filesystem::path`
8+
- Changed the type of the `file_path` parameter in
9+
`HistoricalClient::TimeseriesGetRangeToFile()` to a `std::filesystem::path`
10+
- Changed the type of the `file_path` parameter in the `DbnFileStore`, `InFileStream`,
11+
and `OutFileStream` constructors to a `std::filesystem::path`
12+
- Made `stype_in` and `schema` optionals in `Metadata` to align with how
13+
`Metadata` is represented in other languages and removed the boolean
14+
`has_mixed_stype_in` and `has_mixed_schema` fields
15+
16+
### Bug fixes
17+
- Fixed behavior where encoding metadata could lower the `version`
18+
319
## 0.36.0 - 2025-05-27
420

521
This version marks the release of DBN version 3 (DBNv3), which is the new default.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.24..4.0)
66

77
project(
88
databento
9-
VERSION 0.36.0
9+
VERSION 0.37.0
1010
LANGUAGES CXX
1111
DESCRIPTION "Official Databento client library"
1212
)

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,17 @@ Here is a simple program that fetches 10 seconds of trades for all ES mini futur
9595
#include <databento/live.hpp>
9696
#include <databento/symbol_map.hpp>
9797
#include <iostream>
98-
#include <string>
9998
#include <thread>
10099

101100
using namespace databento;
102101

103102
int main() {
104103
PitSymbolMap symbol_mappings;
105104

106-
auto client =
107-
LiveBuilder{}.SetKeyFromEnv().SetDataset("GLBX.MDP3").BuildThreaded();
105+
auto client = LiveBuilder{}
106+
.SetKeyFromEnv()
107+
.SetDataset(Dataset::GlbxMdp3)
108+
.BuildThreaded();
108109

109110
auto handler = [&symbol_mappings](const Record& rec) {
110111
symbol_mappings.OnRecord(rec);

examples/live/readme.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
#include <databento/live.hpp>
66
#include <databento/symbol_map.hpp>
77
#include <iostream>
8-
#include <string>
98
#include <thread>
109

1110
using namespace databento;
1211

1312
int main() {
1413
PitSymbolMap symbol_mappings;
1514

16-
auto client =
17-
LiveBuilder{}.SetKeyFromEnv().SetDataset("GLBX.MDP3").BuildThreaded();
15+
auto client = LiveBuilder{}
16+
.SetKeyFromEnv()
17+
.SetDataset(Dataset::GlbxMdp3)
18+
.BuildThreaded();
1819

1920
auto handler = [&symbol_mappings](const Record& rec) {
2021
symbol_mappings.OnRecord(rec);

examples/live/simple.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ int main() {
2323
.SetLogReceiver(log_receiver.get())
2424
.SetSendTsOut(true)
2525
.SetKeyFromEnv()
26-
.SetDataset(databento::dataset::kGlbxMdp3)
26+
.SetDataset(databento::Dataset::GlbxMdp3)
2727
.BuildThreaded();
2828

2929
// Set up signal handler for Ctrl+C
3030
std::signal(SIGINT, [](int signal) { gSignal = signal; });
3131

32-
std::vector<std::string> symbols{"ESZ4", "ESZ4 C4200", "ESZ4 P4100"};
32+
std::vector<std::string> symbols{"ESZ5", "ESZ5 C6200", "ESZ5 P5500"};
3333
client.Subscribe(symbols, databento::Schema::Definition,
3434
databento::SType::RawSymbol);
3535
client.Subscribe(symbols, databento::Schema::Mbo,

include/databento/dbn.hpp

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <date/date.h>
44

55
#include <cstdint>
6+
#include <optional>
67
#include <ostream>
78
#include <string>
89
#include <vector>
@@ -37,12 +38,10 @@ struct Metadata {
3738
std::uint8_t version;
3839
// The dataset code.
3940
std::string dataset;
40-
// Indicates the DBN stream may contain multiple record types and data
41-
// schemas. If true, the schema field should be ignored.
42-
bool has_mixed_schema;
43-
// The data record schema which affects the type record of present. If
44-
// has_mixed_schema is true, this field should be ignored.
45-
Schema schema;
41+
// The data record schema which affects the type record of present. Will be
42+
// nullopt for live where there can be a mix of `schema`s across
43+
// subscriptions.
44+
std::optional<Schema> schema;
4645
// The UNIX timestamp of the query start, or the first record if the file was
4746
// split.
4847
UnixNanos start;
@@ -51,12 +50,9 @@ struct Metadata {
5150
UnixNanos end;
5251
// The maximum number of records for the query.
5352
std::uint64_t limit;
54-
// Indicates the DBN stream may been create with a mix of stype_in. This
55-
// will always be the case for live data where stype_in is specified per
56-
// subscription.
57-
bool has_mixed_stype_in;
58-
// The input symbology type. Should be ignored if has_mixed_schemas is true.
59-
SType stype_in;
53+
// The input symbology type. Will be nullopt for live data where there can be
54+
// a mix of `stype_in`s across subscriptions.
55+
std::optional<SType> stype_in;
6056
// The output symbology type.
6157
SType stype_out;
6258
// Whether the records contain an appended send timestamp.
@@ -105,13 +101,10 @@ inline bool operator!=(const SymbolMapping& lhs, const SymbolMapping& rhs) {
105101

106102
inline bool operator==(const Metadata& lhs, const Metadata& rhs) {
107103
return lhs.version == rhs.version && lhs.dataset == rhs.dataset &&
108-
(lhs.has_mixed_schema ? rhs.has_mixed_schema
109-
: lhs.schema == rhs.schema) &&
110-
lhs.start == rhs.start && lhs.end == rhs.end &&
111-
lhs.limit == rhs.limit &&
112-
(lhs.has_mixed_stype_in ? rhs.has_mixed_stype_in
113-
: lhs.stype_in == rhs.stype_in) &&
114-
lhs.stype_out == rhs.stype_out && lhs.ts_out == rhs.ts_out &&
104+
lhs.schema == rhs.schema && lhs.start == rhs.start &&
105+
lhs.end == rhs.end && lhs.limit == rhs.limit &&
106+
lhs.stype_in == rhs.stype_in && lhs.stype_out == rhs.stype_out &&
107+
lhs.ts_out == rhs.ts_out &&
115108
lhs.symbol_cstr_len == rhs.symbol_cstr_len &&
116109
lhs.symbols == rhs.symbols && lhs.partial == rhs.partial &&
117110
lhs.not_found == rhs.not_found && lhs.mappings == rhs.mappings;

include/databento/dbn_file_store.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include <string>
3+
#include <filesystem> // path
44

55
#include "databento/dbn.hpp" // DecodeMetadata
66
#include "databento/dbn_decoder.hpp" // DbnDecoder
@@ -16,8 +16,9 @@ namespace databento {
1616
// used on a given instance.
1717
class DbnFileStore {
1818
public:
19-
explicit DbnFileStore(const std::string& file_path);
20-
DbnFileStore(ILogReceiver* log_receiver, const std::string& file_path,
19+
explicit DbnFileStore(const std::filesystem::path& file_path);
20+
DbnFileStore(ILogReceiver* log_receiver,
21+
const std::filesystem::path& file_path,
2122
VersionUpgradePolicy upgrade_policy);
2223

2324
// Callback API: calling Replay consumes the input.

include/databento/file_stream.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#pragma once
22

3-
#include <cstddef> // byte, size_t
4-
#include <fstream> // ifstream, ofstream
5-
#include <string>
3+
#include <cstddef> // byte, size_t
4+
#include <filesystem> // path
5+
#include <fstream> // ifstream, ofstream
66

77
#include "databento/ireadable.hpp"
88
#include "databento/iwritable.hpp"
99

1010
namespace databento {
1111
class InFileStream : public IReadable {
1212
public:
13-
explicit InFileStream(const std::string& file_path);
13+
explicit InFileStream(const std::filesystem::path& file_path);
1414

1515
// Read exactly `length` bytes into `buffer`.
1616
void ReadExact(std::byte* buffer, std::size_t length) override;
@@ -24,7 +24,7 @@ class InFileStream : public IReadable {
2424

2525
class OutFileStream : public IWritable {
2626
public:
27-
explicit OutFileStream(const std::string& file_path);
27+
explicit OutFileStream(const std::filesystem::path& file_path);
2828

2929
void WriteAll(const std::byte* buffer, std::size_t length) override;
3030

include/databento/historical.hpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include <cstdint>
4+
#include <filesystem>
45
#include <map> // multimap
56
#include <string>
67
#include <vector>
@@ -75,12 +76,12 @@ class Historical {
7576
// Lists all files associated with a batch job.
7677
std::vector<BatchFileDesc> BatchListFiles(const std::string& job_id);
7778
// Returns the paths of the downloaded files.
78-
std::vector<std::string> BatchDownload(const std::string& output_dir,
79-
const std::string& job_id);
79+
std::vector<std::filesystem::path> BatchDownload(
80+
const std::filesystem::path& output_dir, const std::string& job_id);
8081
// Returns the path of the downloaded file.
81-
std::string BatchDownload(const std::string& output_dir,
82-
const std::string& job_id,
83-
const std::string& filename_to_download);
82+
std::filesystem::path BatchDownload(const std::filesystem::path& output_dir,
83+
const std::string& job_id,
84+
const std::string& filename_to_download);
8485

8586
/*
8687
* Metadata API
@@ -206,30 +207,33 @@ class Historical {
206207
const std::string& dataset,
207208
const DateTimeRange<UnixNanos>& datetime_range,
208209
const std::vector<std::string>& symbols, Schema schema,
209-
const std::string& file_path);
210+
const std::filesystem::path& file_path);
210211
DbnFileStore TimeseriesGetRangeToFile(
211212
const std::string& dataset,
212213
const DateTimeRange<std::string>& datetime_range,
213214
const std::vector<std::string>& symbols, Schema schema,
214-
const std::string& file_path);
215+
const std::filesystem::path& file_path);
215216
DbnFileStore TimeseriesGetRangeToFile(
216217
const std::string& dataset,
217218
const DateTimeRange<UnixNanos>& datetime_range,
218219
const std::vector<std::string>& symbols, Schema schema, SType stype_in,
219-
SType stype_out, std::uint64_t limit, const std::string& file_path);
220+
SType stype_out, std::uint64_t limit,
221+
const std::filesystem::path& file_path);
220222
DbnFileStore TimeseriesGetRangeToFile(
221223
const std::string& dataset,
222224
const DateTimeRange<std::string>& datetime_range,
223225
const std::vector<std::string>& symbols, Schema schema, SType stype_in,
224-
SType stype_out, std::uint64_t limit, const std::string& file_path);
226+
SType stype_out, std::uint64_t limit,
227+
const std::filesystem::path& file_path);
225228

226229
private:
227230
using HttplibParams = std::multimap<std::string, std::string>;
228231

229232
BatchJob BatchSubmitJob(const HttplibParams& params);
230233
void StreamToFile(const std::string& url_path, const HttplibParams& params,
231-
const std::string& file_path);
232-
void DownloadFile(const std::string& url, const std::string& output_path);
234+
const std::filesystem::path& file_path);
235+
void DownloadFile(const std::string& url,
236+
const std::filesystem::path& output_path);
233237
std::vector<BatchJob> BatchListJobs(const HttplibParams& params);
234238
std::vector<DatasetConditionDetail> MetadataGetDatasetCondition(
235239
const HttplibParams& params);
@@ -240,7 +244,7 @@ class Historical {
240244
const MetadataCallback& metadata_callback,
241245
const RecordCallback& record_callback);
242246
DbnFileStore TimeseriesGetRangeToFile(const HttplibParams& params,
243-
const std::string& file_path);
247+
const std::filesystem::path& file_path);
244248

245249
ILogReceiver* log_receiver_;
246250
const std::string key_;

pkg/PKGBUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Maintainer: Databento <support@databento.com>
22
_pkgname=databento-cpp
33
pkgname=databento-cpp-git
4-
pkgver=0.36.0
4+
pkgver=0.37.0
55
pkgrel=1
66
pkgdesc="Official C++ client for Databento"
77
arch=('any')

0 commit comments

Comments
 (0)