Skip to content

Commit b7061b1

Browse files
authored
VER: Release 0.38.2
2 parents 356d1ed + 0fdd814 commit b7061b1

23 files changed

+278
-132
lines changed

CHANGELOG.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
# Changelog
22

3+
## 0.38.2 - 2025-07-01
4+
5+
### Enhancements
6+
- Added `LogPlatformInfo()` function which logs the client version, compiler, and
7+
operating system info to aid troubleshooting
8+
- Added compiler and operating system info to the user agent to aid troubleshooting
9+
- Standardized `client` info sent by live clients to match historical
10+
- Added methods to the client builders to extend the user agents with a custom string
11+
12+
### Bug fixes
13+
- Fixed missing implementation for `LiveBuilder::SetBufferSize()`
14+
- Fixed checking of warnings from server in Historical API in `TimeseriesGetRange()` and
15+
`TimeseriesGetRangeToFile()`
316

417
## 0.38.1 - 2025-06-25
518

619
### Enhancements
720
- Added `range_by_schema` field to `DatasetRange` struct
8-
- Changed historical `TimeseriesGetRange` and `TimeseriesGetRangeToFile` methods to use
9-
a `POST` request to allow for requesting supported maximum of 2000 symbols
21+
- Changed historical `TimeseriesGetRange()` and `TimeseriesGetRangeToFile()` methods to
22+
use a `POST` request to allow for requesting supported maximum of 2000 symbols
1023
- Added logging around `Historical::BatchDownload`
1124
- Changed the following Venue, Publisher, and Dataset descriptions:
1225
- "ICE Futures Europe (Financials)" renamed to "ICE Europe Financials"

CMakeLists.txt

Lines changed: 9 additions & 3 deletions
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.38.1
9+
VERSION 0.38.2
1010
LANGUAGES CXX
1111
DESCRIPTION "Official Databento client library"
1212
)
@@ -60,14 +60,19 @@ if(IS_BIG_ENDIAN)
6060
endif()
6161

6262
#
63-
# Add version header
63+
# Add templated headers
6464
#
6565

6666
configure_file(
6767
${CMAKE_CURRENT_LIST_DIR}/cmake/version.hpp.in
6868
include/${PROJECT_NAME}/version.hpp
6969
@ONLY
7070
)
71+
configure_file(
72+
${CMAKE_CURRENT_LIST_DIR}/cmake/system.hpp.in
73+
include/${PROJECT_NAME}/system.hpp
74+
@ONLY
75+
)
7176

7277
#
7378
# Find all headers and implementation files
@@ -237,7 +242,7 @@ target_include_directories(
237242
PUBLIC
238243
$<INSTALL_INTERFACE:include>
239244
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
240-
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> # for generated version.hpp
245+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> # for generated version.hpp and system.hpp
241246
PRIVATE
242247
${CMAKE_CURRENT_SOURCE_DIR}/src
243248
)
@@ -310,6 +315,7 @@ install(
310315
)
311316
install(
312317
FILES
318+
${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_NAME}/system.hpp
313319
${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_NAME}/version.hpp
314320
DESTINATION
315321
${INCLUDE_INSTALL_DIR}

cmake/system.hpp.in

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#pragma once
2+
3+
#define DATABENTO_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@"
4+
#define DATABENTO_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@"
5+
#define DATABENTO_SYSTEM_ID "@CMAKE_SYSTEM_NAME@"
6+
#define DATABENTO_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@"

cmake/version.hpp.in

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
#ifndef @PROJECT_NAME_UPPERCASE@_VERSION_H_
2-
#define @PROJECT_NAME_UPPERCASE@_VERSION_H_
1+
#pragma once
32

4-
#define @PROJECT_NAME_UPPERCASE@_VERSION "@PROJECT_VERSION@"
3+
#define DATABENTO_VERSION "@PROJECT_VERSION@"
54

6-
#define @PROJECT_NAME_UPPERCASE@_MAJOR_VERSION @PROJECT_VERSION_MAJOR@
7-
#define @PROJECT_NAME_UPPERCASE@_MINOR_VERSION @PROJECT_VERSION_MINOR@
8-
#define @PROJECT_NAME_UPPERCASE@_PATCH_VERSION @PROJECT_VERSION_PATCH@
9-
10-
#endif // @PROJECT_NAME_UPPERCASE@_VERSION_H_
5+
#define DATABENTO_MAJOR_VERSION @PROJECT_VERSION_MAJOR@
6+
#define DATABENTO_MINOR_VERSION @PROJECT_VERSION_MINOR@
7+
#define DATABENTO_PATCH_VERSION @PROJECT_VERSION_PATCH@

examples/historical/timeseries_get_range.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include <iostream> // setw
1+
#include <iostream>
22

33
#include "databento/constants.hpp"
44
#include "databento/enums.hpp"

include/databento/constants.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
#include <cstdint>
44
#include <limits>
55

6+
#include "databento/system.hpp" // DATABENTO_CXX_COMPILER_*, DATABENTO_SYSTEM_*
7+
#include "databento/version.hpp" // DATABENTO_VERSION
8+
69
namespace databento {
710
static constexpr auto kApiVersion = 0;
811
static constexpr auto kApiVersionStr = "0";
@@ -29,6 +32,11 @@ static constexpr auto kAssetCstrLen = 11;
2932
// The multiplier for converting the `length` field in `RecordHeader` to bytes.
3033
static constexpr std::size_t kRecordHeaderLengthMultiplier = 4;
3134

35+
static constexpr auto kUserAgent =
36+
"Databento/" DATABENTO_VERSION " C++/" DATABENTO_CXX_COMPILER_ID
37+
"/" DATABENTO_CXX_COMPILER_VERSION " " DATABENTO_SYSTEM_ID
38+
"/" DATABENTO_SYSTEM_VERSION;
39+
3240
// This is not a comprehensive list of datasets, for that see the `Dataset`
3341
// enum.
3442
namespace dataset {

include/databento/detail/dbn_buffer_decoder.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77

88
#include "databento/detail/buffer.hpp"
99
#include "databento/detail/zstd_stream.hpp"
10+
#include "databento/enums.hpp"
1011
#include "databento/record.hpp"
1112
#include "databento/timeseries.hpp"
1213

1314
namespace databento::detail {
1415
class DbnBufferDecoder {
1516
public:
1617
// The instance cannot outlive the lifetime of these references.
17-
DbnBufferDecoder(const MetadataCallback& metadata_callback,
18+
DbnBufferDecoder(VersionUpgradePolicy upgrade_policy,
19+
const MetadataCallback& metadata_callback,
1820
const RecordCallback& record_callback)
19-
: metadata_callback_{metadata_callback},
21+
: upgrade_policy_{upgrade_policy},
22+
metadata_callback_{metadata_callback},
2023
record_callback_{record_callback},
2124
zstd_stream_{std::make_unique<Buffer>()},
2225
zstd_buffer_{static_cast<Buffer*>(zstd_stream_.Input())} {}
@@ -49,6 +52,7 @@ class DbnBufferDecoder {
4952
return stream;
5053
}
5154

55+
const VersionUpgradePolicy upgrade_policy_;
5256
const MetadataCallback& metadata_callback_;
5357
const RecordCallback& record_callback_;
5458
ZstdDecodeStream zstd_stream_;

include/databento/detail/http_client.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ class HttpClient {
3333

3434
private:
3535
static bool IsErrorStatus(int status_code);
36-
static httplib::ResponseHandler MakeStreamResponseHandler(int& out_status);
3736
static void CheckStatusAndStreamRes(const std::string& path, int status_code,
3837
std::string&& err_body,
3938
const httplib::Result& res);
4039

40+
httplib::ResponseHandler MakeStreamResponseHandler(int& out_status);
4141
nlohmann::json CheckAndParseResponse(const std::string& path,
4242
httplib::Result&& res) const;
4343
void CheckWarnings(const httplib::Response& response) const;

include/databento/historical.hpp

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@
1010
#include "databento/datetime.hpp" // DateRange, DateTimeRange, UnixNanos
1111
#include "databento/dbn_file_store.hpp"
1212
#include "databento/detail/http_client.hpp" // HttpClient
13-
#include "databento/enums.hpp" // BatchState, Delivery, DurationInterval, Schema, SType
13+
#include "databento/enums.hpp" // BatchState, Delivery, DurationInterval, Schema, SType, VersionUpgradePolicy
1414
#include "databento/metadata.hpp" // DatasetConditionDetail, DatasetRange, FieldDetail, PublisherDetail, UnitPricesForMode
1515
#include "databento/symbology.hpp" // SymbologyResolution
1616
#include "databento/timeseries.hpp" // KeepGoing, MetadataCallback, RecordCallback
1717

1818
namespace databento {
19+
// Forward declarations
20+
class HistoricalBuilder;
1921
class ILogReceiver;
2022

2123
// A client for interfacing with Databento's historical market data API.
2224
class Historical {
2325
public:
26+
// WARNING: Will be deprecated in the future in favor of the builder
2427
Historical(ILogReceiver* log_receiver, std::string key,
2528
HistoricalGateway gateway);
26-
// Primarily for unit tests
27-
Historical(ILogReceiver* log_receiver, std::string key, std::string gateway,
28-
std::uint16_t port);
2929

3030
/*
3131
* Getters
@@ -227,8 +227,17 @@ class Historical {
227227
const std::filesystem::path& file_path);
228228

229229
private:
230+
friend HistoricalBuilder;
231+
230232
using HttplibParams = std::multimap<std::string, std::string>;
231233

234+
Historical(ILogReceiver* log_receiver, std::string key,
235+
HistoricalGateway gateway, VersionUpgradePolicy upgrade_policy,
236+
std::string user_agent_ext);
237+
Historical(ILogReceiver* log_receiver, std::string key, std::string gateway,
238+
std::uint16_t port, VersionUpgradePolicy upgrade_policy,
239+
std::string user_agent_ext);
240+
232241
BatchJob BatchSubmitJob(const HttplibParams& params);
233242
void DownloadFile(const std::string& url,
234243
const std::filesystem::path& output_path);
@@ -247,6 +256,8 @@ class Historical {
247256
ILogReceiver* log_receiver_;
248257
const std::string key_;
249258
const std::string gateway_;
259+
const std::string user_agent_ext_;
260+
const VersionUpgradePolicy upgrade_policy_;
250261
detail::HttpClient client_;
251262
};
252263

@@ -255,22 +266,43 @@ class HistoricalBuilder {
255266
public:
256267
HistoricalBuilder() = default;
257268

269+
/*
270+
* Required setters
271+
*/
272+
258273
// Sets `key_` based on the environment variable DATABENTO_API_KEY.
259274
//
260275
// NOTE: This is not thread-safe if `std::setenv` is used elsewhere in the
261276
// program.
262277
HistoricalBuilder& SetKeyFromEnv();
263278
HistoricalBuilder& SetKey(std::string key);
264-
HistoricalBuilder& SetGateway(HistoricalGateway gateway);
279+
280+
/*
281+
* Optional setters
282+
*/
283+
284+
// Set the version upgrade policy for when streaming DBN data from a prior
285+
// version. Defaults to upgrading to DBNv3 (if not already).
286+
HistoricalBuilder& SetUpgradePolicy(VersionUpgradePolicy upgrade_policy);
265287
// Sets the receiver of the logs to be used by the client.
266288
HistoricalBuilder& SetLogReceiver(ILogReceiver* log_receiver);
289+
HistoricalBuilder& SetGateway(HistoricalGateway gateway);
290+
// Overrides the gateway and port. This is an advanced method.
291+
HistoricalBuilder& SetAddress(std::string gateway, std::uint16_t port);
292+
// Appends to the default user agent.
293+
HistoricalBuilder& ExtendUserAgent(std::string extension);
294+
267295
// Attempts to construct an instance of Historical or throws an exception if
268296
// no key has been set.
269297
Historical Build();
270298

271299
private:
272300
ILogReceiver* log_receiver_{};
273-
std::string key_;
274301
HistoricalGateway gateway_{HistoricalGateway::Bo1};
302+
std::string gateway_override_{};
303+
std::uint16_t port_{};
304+
std::string key_;
305+
VersionUpgradePolicy upgrade_policy_{VersionUpgradePolicy::UpgradeToV3};
306+
std::string user_agent_ext_;
275307
};
276308
} // namespace databento

include/databento/live.hpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class LiveBuilder {
2020
LiveBuilder();
2121

2222
/*
23-
* Required settters
23+
* Required setters
2424
*/
2525

2626
// Sets `key_` based on the environment variable DATABENTO_API_KEY.
@@ -33,13 +33,13 @@ class LiveBuilder {
3333
LiveBuilder& SetDataset(std::string dataset);
3434

3535
/*
36-
* Optional settters
36+
* Optional setters
3737
*/
3838

3939
// Whether to append the gateway send timestamp after each DBN message.
4040
LiveBuilder& SetSendTsOut(bool send_ts_out);
4141
// Set the version upgrade policy for when receiving DBN data from a prior
42-
// version. Defaults to upgrading to DBNv2 (if not already).
42+
// version. Defaults to upgrading to DBNv3 (if not already).
4343
LiveBuilder& SetUpgradePolicy(VersionUpgradePolicy upgrade_policy);
4444
// Sets the receiver of the logs to be used by the client.
4545
LiveBuilder& SetLogReceiver(ILogReceiver* log_receiver);
@@ -49,13 +49,15 @@ class LiveBuilder {
4949
LiveBuilder& SetAddress(std::string gateway, std::uint16_t port);
5050
// Overrides the size of the buffer used for reading data from the TCP socket.
5151
LiveBuilder& SetBufferSize(std::size_t size);
52+
// Appends to the default user agent.
53+
LiveBuilder& ExtendUserAgent(std::string extension);
5254

5355
/*
5456
* Build a live client instance
5557
*/
5658

57-
// Attempts to construct an instance of a blocking live client or throws an
58-
// exception.
59+
// Attempts to construct an instance of a blocking live client or throws
60+
// an exception.
5961
LiveBlocking BuildBlocking();
6062
// Attempts to construct an instance of a threaded live client or throws an
6163
// exception.
@@ -74,5 +76,6 @@ class LiveBuilder {
7476
VersionUpgradePolicy upgrade_policy_{VersionUpgradePolicy::UpgradeToV3};
7577
std::optional<std::chrono::seconds> heartbeat_interval_{};
7678
std::size_t buffer_size_;
79+
std::string user_agent_ext_;
7780
};
7881
} // namespace databento

0 commit comments

Comments
 (0)