Skip to content

Commit 28f0a30

Browse files
authored
VER: Release 0.34.0
2 parents 9b06153 + b058949 commit 28f0a30

File tree

19 files changed

+182
-63
lines changed

19 files changed

+182
-63
lines changed

CHANGELOG.md

+22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# Changelog
22

3+
## 0.34.0 - 2025-04-22
4+
5+
### Enhancements
6+
- Added `SystemCode` and `ErrorCode` enums to indicate types of system and error
7+
messages
8+
- Converting a `v1::SystemMsg` to a `v2::SystemMsg` now sets to `code` to the heartbeat
9+
value
10+
- Introduced `kAssetCstrLen` constant containing the size of `asset` field in
11+
`InstrumentDefMsg`
12+
13+
### Breaking changes
14+
- Increased the size of `asset` field in `v3::InstrumentDefMsg` from 7 to 11. The
15+
`v3::InstrumentDefMsg` message size remains 520 bytes.
16+
- Set minimum CMake version to 3.24
17+
- Changed type of `code` field in `SystemMsg` to `SystemCode`
18+
- Changed type of `code` field in `ErrorMsg` to `ErrorCode`
19+
20+
### Bug fixes
21+
- Changed `TriState` to a regular enum to handle unexpected values
22+
- Fixed `ccache` support
23+
- Changed to explicitly only support being built as a static library
24+
325
## 0.33.0 - 2025-04-15
426

527
### Enhancements

CMakeLists.txt

+24-41
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
cmake_minimum_required(VERSION 3.14)
1+
cmake_minimum_required(VERSION 3.24..4.0)
22

33
#
44
# Project details
55
#
66

7-
project("databento" VERSION 0.33.0 LANGUAGES CXX)
7+
project(
8+
databento
9+
VERSION 0.34.0
10+
LANGUAGES CXX
11+
DESCRIPTION "Official Databento client library"
12+
)
813
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPERCASE)
914

1015
#
@@ -83,6 +88,7 @@ endif()
8388

8489
add_library(
8590
${PROJECT_NAME}
91+
STATIC
8692
${headers}
8793
${sources}
8894
)
@@ -101,6 +107,7 @@ message(STATUS "Added all header and implementation files.")
101107
#
102108

103109
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17)
110+
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_EXTENSIONS OFF)
104111
include(cmake/CompilerWarnings.cmake)
105112
set_target_warnings(${PROJECT_NAME})
106113
include(cmake/Sanitizers.cmake)
@@ -143,19 +150,11 @@ else()
143150
set(json_version 3.11.3)
144151
# Required to correctly install nlohmann_json
145152
set(JSON_Install ON)
146-
if(CMAKE_VERSION VERSION_LESS 3.24)
147-
FetchContent_Declare(
148-
json
149-
URL https://github.com/nlohmann/json/releases/download/v${json_version}/json.tar.xz
150-
)
151-
else()
152-
# DOWNLOAD_EXTRACT_TIMESTAMP added in 3.24
153-
FetchContent_Declare(
154-
json
155-
URL https://github.com/nlohmann/json/releases/download/v${json_version}/json.tar.xz
156-
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
157-
)
158-
endif()
153+
FetchContent_Declare(
154+
json
155+
URL https://github.com/nlohmann/json/releases/download/v${json_version}/json.tar.xz
156+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
157+
)
159158
FetchContent_MakeAvailable(json)
160159
# Ignore compiler warnings in headers
161160
add_system_include_property(nlohmann_json)
@@ -175,19 +174,11 @@ if(${PROJECT_NAME_UPPERCASE}_USE_EXTERNAL_HTTPLIB)
175174
endif()
176175
else()
177176
set(httplib_version 0.20.0)
178-
if(CMAKE_VERSION VERSION_LESS 3.24)
179-
FetchContent_Declare(
180-
httplib
181-
URL https://github.com/yhirose/cpp-httplib/archive/refs/tags/v${httplib_version}.tar.gz
182-
)
183-
else()
184-
# DOWNLOAD_EXTRACT_TIMESTAMP added in 3.24
185-
FetchContent_Declare(
186-
httplib
187-
URL https://github.com/yhirose/cpp-httplib/archive/refs/tags/v${httplib_version}.tar.gz
188-
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
189-
)
190-
endif()
177+
FetchContent_Declare(
178+
httplib
179+
URL https://github.com/yhirose/cpp-httplib/archive/refs/tags/v${httplib_version}.tar.gz
180+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
181+
)
191182
FetchContent_MakeAvailable(httplib)
192183
# Ignore compiler warnings in headers
193184
add_system_include_property(httplib)
@@ -207,19 +198,11 @@ if(${PROJECT_NAME_UPPERCASE}_USE_EXTERNAL_DATE)
207198
endif()
208199
else()
209200
set(date_version 3.0.3)
210-
if(CMAKE_VERSION VERSION_LESS 3.24)
211-
FetchContent_Declare(
212-
date_src
213-
URL https://github.com/HowardHinnant/date/archive/refs/tags/v${date_version}.tar.gz
214-
)
215-
else()
216-
# DOWNLOAD_EXTRACT_TIMESTAMP added in 3.24
217-
FetchContent_Declare(
218-
date_src
219-
URL https://github.com/HowardHinnant/date/archive/refs/tags/v${date_version}.tar.gz
220-
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
221-
)
222-
endif()
201+
FetchContent_Declare(
202+
date_src
203+
URL https://github.com/HowardHinnant/date/archive/refs/tags/v${date_version}.tar.gz
204+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
205+
)
223206
FetchContent_MakeAvailable(date_src)
224207
# Ignore compiler warnings in headers
225208
add_system_include_property(date)

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The client supports both streaming real-time and historical market data through
99

1010
## Usage
1111

12-
The minimum C++ standard is C++17 and the minimum CMake version is 3.14.
12+
The minimum C++ standard is C++17 and the minimum CMake version is 3.24.
1313

1414
### Integration
1515

@@ -18,7 +18,7 @@ Your `CMakeLists.txt` should look something like the following:
1818

1919
```cmake
2020
# CMakeLists.txt
21-
cmake_minimum_required(VERSION 3.14)
21+
cmake_minimum_required(VERSION 3.24)
2222
2323
project(databento_example)
2424
include(FetchContent)

cmake/StandardSettings.cmake

+1-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ if(${PROJECT_NAME_UPPERCASE}_ENABLE_CCACHE)
7575
find_program(CCACHE_FOUND ccache)
7676
if(CCACHE_FOUND)
7777
message(STATUS "Found and enabled ccache")
78-
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
79-
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
78+
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
8079
endif()
8180
endif()

examples/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.14)
1+
cmake_minimum_required(VERSION 3.24)
22

33
project(
44
${CMAKE_PROJECT_NAME}Examples

examples/historical/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.14)
1+
cmake_minimum_required(VERSION 3.24)
22

33
add_example_target(batch batch.cpp)
44
add_example_target(metadata metadata.cpp)

examples/live/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.14)
1+
cmake_minimum_required(VERSION 3.24)
22

33
add_example_target(live-readme readme.cpp)
44
add_example_target(simple simple.cpp)

include/databento/constants.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ static constexpr auto kUndefTimestamp =
2424
static constexpr auto kDbnVersion = 2;
2525
// The length of fixed-length symbol strings.
2626
static constexpr auto kSymbolCstrLen = 71;
27+
// The length of fixed-length asset string.
28+
static constexpr auto kAssetCstrLen = 7;
2729
// The multiplier for converting the `length` field in `RecordHeader` to bytes.
2830
static constexpr std::size_t kRecordHeaderLengthMultiplier = 4;
2931

include/databento/enums.hpp

+46-1
Original file line numberDiff line numberDiff line change
@@ -439,14 +439,55 @@ using trading_event::TradingEvent;
439439

440440
// An enum for representing unknown, true, or false values. Equivalent to a
441441
// std::optional<bool>.
442-
enum class TriState : char {
442+
namespace tri_state {
443+
enum TriState : char {
443444
// The value is not applicable or not known.
444445
NotAvailable = '~',
445446
// False
446447
No = 'N',
447448
// True
448449
Yes = 'Y',
449450
};
451+
} // namespace tri_state
452+
using tri_state::TriState;
453+
454+
namespace error_code {
455+
enum ErrorCode : std::uint8_t {
456+
// The authentication step failed.
457+
AuthFailed = 1,
458+
// The user account or API key were deactivated.
459+
ApiKeyDeactivated = 2,
460+
// The user has exceeded their open connection limit
461+
ConnectionLimitExceeded = 3,
462+
// One or more symbols failed to resolve.
463+
SymbolResolutionFailed = 4,
464+
// There was an issue with a subscription request (other than symbol
465+
// resolution).
466+
InvalidSubscription = 5,
467+
// An error occurred in the gateway.
468+
InternalError = 6,
469+
470+
Unset = 255,
471+
};
472+
} // namespace error_code
473+
using error_code::ErrorCode;
474+
475+
namespace system_code {
476+
enum SystemCode : std::uint8_t {
477+
// A message sent in the absence of other records to indicate the connection
478+
// remains open.
479+
Heartbeat = 0,
480+
// An acknowledgement of a subscription request.
481+
SubscriptionAck = 1,
482+
// The gateway has detected this session is falling behind real-time.
483+
SlowReaderWarning = 2,
484+
// Indicates a replay subscription has caught up with real-time data.
485+
ReplayCompleted = 3,
486+
487+
Unset = 255,
488+
};
489+
} // namespace system_code
490+
using system_code::SystemCode;
450491

451492
// Convert a HistoricalGateway to a URL.
452493
const char* UrlFromGateway(HistoricalGateway gateway);
@@ -474,6 +515,8 @@ const char* ToString(StatusReason status_reason);
474515
const char* ToString(TradingEvent trading_event);
475516
const char* ToString(TriState tri_state);
476517
const char* ToString(VersionUpgradePolicy upgrade_policy);
518+
const char* ToString(ErrorCode error_code);
519+
const char* ToString(SystemCode system_code);
477520

478521
std::ostream& operator<<(std::ostream& out, Schema schema);
479522
std::ostream& operator<<(std::ostream& out, Encoding encoding);
@@ -501,6 +544,8 @@ std::ostream& operator<<(std::ostream& out, TradingEvent trading_event);
501544
std::ostream& operator<<(std::ostream& out, TriState tri_state);
502545
std::ostream& operator<<(std::ostream& out,
503546
VersionUpgradePolicy upgrade_policy);
547+
std::ostream& operator<<(std::ostream& out, ErrorCode error_code);
548+
std::ostream& operator<<(std::ostream& out, SystemCode system_code);
504549

505550
template <>
506551
Schema FromString(const std::string& str);

include/databento/record.hpp

+10-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <cstddef>
55
#include <cstdint>
66
#include <cstring> // strncmp
7+
#include <limits>
78
#include <string>
89
#include <tuple> // tie
910
#include <type_traits>
@@ -433,7 +434,7 @@ struct InstrumentDefMsg {
433434
std::array<char, kSymbolCstrLen> raw_symbol;
434435
std::array<char, 21> group;
435436
std::array<char, 5> exchange;
436-
std::array<char, 7> asset;
437+
std::array<char, kAssetCstrLen> asset;
437438
std::array<char, 7> cfi;
438439
std::array<char, 7> security_type;
439440
std::array<char, 31> unit_of_measure;
@@ -528,7 +529,7 @@ struct ErrorMsg {
528529

529530
RecordHeader hd;
530531
std::array<char, 302> err;
531-
std::uint8_t code;
532+
ErrorCode code;
532533
std::uint8_t is_last;
533534
};
534535
static_assert(sizeof(ErrorMsg) == 320, "ErrorMsg size must match Rust");
@@ -560,12 +561,17 @@ struct SystemMsg {
560561
UnixNanos IndexTs() const { return hd.ts_event; }
561562
const char* Msg() const { return msg.data(); }
562563
bool IsHeartbeat() const {
563-
return std::strncmp(msg.data(), "Heartbeat", 9) == 0;
564+
// Check if code is unset
565+
if (static_cast<std::uint8_t>(code) ==
566+
std::numeric_limits<std::uint8_t>::max()) {
567+
return std::strncmp(msg.data(), "Heartbeat", 9) == 0;
568+
}
569+
return code == SystemCode::Heartbeat;
564570
}
565571

566572
RecordHeader hd;
567573
std::array<char, 303> msg;
568-
std::uint8_t code;
574+
SystemCode code;
569575
};
570576
static_assert(sizeof(SystemMsg) == 320, "SystemMsg size must match Rust");
571577
static_assert(alignof(SystemMsg) == 8, "Must have 8-byte alignment");

include/databento/v1.hpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

3-
#include "databento/datetime.hpp" // UnixNanos
3+
#include "databento/constants.hpp" // kSymbolCstrLen
4+
#include "databento/datetime.hpp" // UnixNanos
45
#include "databento/enums.hpp"
56
#include "databento/record.hpp"
67
#include "databento/v2.hpp"
@@ -13,6 +14,7 @@ struct InstrumentDefMsg;
1314

1415
namespace v1 {
1516
static constexpr std::size_t kSymbolCstrLen = 22;
17+
static constexpr std::size_t kAssetCstrLen = databento::kAssetCstrLen;
1618

1719
using MboMsg = databento::MboMsg;
1820
using TradeMsg = databento::TradeMsg;
@@ -92,7 +94,7 @@ struct InstrumentDefMsg {
9294
std::array<char, kSymbolCstrLen> raw_symbol;
9395
std::array<char, 21> group;
9496
std::array<char, 5> exchange;
95-
std::array<char, 7> asset;
97+
std::array<char, kAssetCstrLen> asset;
9698
std::array<char, 7> cfi;
9799
std::array<char, 7> security_type;
98100
std::array<char, 31> unit_of_measure;

include/databento/v2.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
namespace databento::v2 {
77
static constexpr std::size_t kSymbolCstrLen = databento::kSymbolCstrLen;
8+
static constexpr std::size_t kAssetCstrLen = databento::kAssetCstrLen;
89

910
using MboMsg = databento::MboMsg;
1011
using TradeMsg = databento::TradeMsg;

include/databento/v3.hpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace databento::v3 {
1212
static constexpr std::size_t kSymbolCstrLen = databento::kSymbolCstrLen;
13+
static constexpr std::size_t kAssetCstrLen = 11;
1314

1415
using MboMsg = databento::MboMsg;
1516
using TradeMsg = databento::TradeMsg;
@@ -100,7 +101,7 @@ struct InstrumentDefMsg {
100101
std::array<char, kSymbolCstrLen> raw_symbol;
101102
std::array<char, 21> group;
102103
std::array<char, 5> exchange;
103-
std::array<char, 7> asset;
104+
std::array<char, kAssetCstrLen> asset;
104105
std::array<char, 7> cfi;
105106
std::array<char, 7> security_type;
106107
std::array<char, 31> unit_of_measure;
@@ -124,7 +125,7 @@ struct InstrumentDefMsg {
124125
InstrumentClass leg_instrument_class;
125126
Side leg_side;
126127
// padding for alignment
127-
std::array<char, 21> reserved;
128+
std::array<char, 17> reserved;
128129
};
129130
static_assert(sizeof(InstrumentDefMsg) == 520,
130131
"InstrumentDefMsg size must match Rust");

pkg/PKGBUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Maintainer: Databento <[email protected]>
22
_pkgname=databento-cpp
33
pkgname=databento-cpp-git
4-
pkgver=0.33.0
4+
pkgver=0.34.0
55
pkgrel=1
66
pkgdesc="Official C++ client for Databento"
77
arch=('any')

0 commit comments

Comments
 (0)