Skip to content

Commit ac4e7ba

Browse files
authored
VER: Release 0.27.0
2 parents 5ad9b35 + dc40335 commit ac4e7ba

11 files changed

+535
-9
lines changed

CHANGELOG.md

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

3+
## 0.27.0 - 2025-01-07
4+
5+
### Breaking changes
6+
- Converted the `UserDefinedInstrument` enum class to an enum to safely allow handling
7+
invalid data and adding future variants
8+
- Updated the value of the `kMaxRecordLen` constant for the changes to
9+
`InstrumentDefMsg` in version 3
10+
11+
### Enhancements
12+
- Added `v3` namespace in preparation for future DBN version 3 release. DBN version 2
13+
remains the current and default version
14+
- Added `v3::InstrumentDefMsg` record with new fields to support normalizing multi-leg
15+
strategy definitions
16+
- Removal of statistics-schema related fields `trading_reference_price`,
17+
`trading_reference_date`, and `settl_price_type`
18+
- Removal of the status-schema related field `md_security_trading_status`
19+
320
## 0.26.0 - 2024-12-17
421

522
### Breaking changes
@@ -261,7 +278,8 @@ fields for `SymbolMappingMsg`, and extends the symbol field length for `SymbolMa
261278
Users who wish to convert DBN v1 files to v2 can use the `dbn-cli` tool available in the [databento-dbn](https://github.com/databento/dbn/) crate.
262279
On a future date, the Databento live and historical APIs will stop serving DBN v1.
263280

264-
This release is fully compatible with both DBN v1 and v2, and so should be seamless for most users.
281+
This release is fully compatible with both DBN v1 and v2, and so the change should be
282+
seamless for most users.
265283

266284
### Enhancements
267285

@@ -288,7 +306,7 @@ This release is fully compatible with both DBN v1 and v2, and so should be seaml
288306

289307
- The old `InstrumentDefMsg` is now `InstrumentDefMsgV1` in `compat.hpp`
290308
- The old `SymbolMappingMsg` is now `SymbolMappingMsgV1` in `compat.hpp`
291-
- Converted the following enums to enum classes to allow safely adding new variants:
309+
- Converted the following enum classes to enums to allow safely adding new variants:
292310
`SecurityUpdateAction` and `SType`
293311
- Renamed `dummy` to `reserved` in `InstrumentDefMsg`
294312
- Removed `reserved2`, `reserved3`, `reserved4`, and `reserved5` from `InstrumentDefMsg`

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.14)
44
# Project details
55
#
66

7-
project("databento" VERSION 0.26.0 LANGUAGES CXX)
7+
project("databento" VERSION 0.27.0 LANGUAGES CXX)
88
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPERCASE)
99

1010
#

cmake/SourcesAndHeaders.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ set(headers
3333
include/databento/timeseries.hpp
3434
include/databento/v1.hpp
3535
include/databento/v2.hpp
36+
include/databento/v3.hpp
3637
include/databento/with_ts_out.hpp
3738
src/stream_op_helper.hpp
3839
)
@@ -67,4 +68,5 @@ set(sources
6768
src/symbol_map.cpp
6869
src/symbology.cpp
6970
src/v1.cpp
71+
src/v3.cpp
7072
)

include/databento/enums.hpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,13 @@ enum SecurityUpdateAction : char {
220220
}
221221
using security_update_action::SecurityUpdateAction;
222222

223-
enum class UserDefinedInstrument : char {
223+
namespace user_defined_instrument {
224+
enum UserDefinedInstrument : char {
224225
No = 'N',
225226
Yes = 'Y',
226227
};
228+
}
229+
using user_defined_instrument::UserDefinedInstrument;
227230

228231
namespace stat_type {
229232
// The type of statistic contained in a StatMsg.

include/databento/record.hpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,13 @@
1414
#include "databento/exceptions.hpp" // InvalidArgumentError
1515
#include "databento/flag_set.hpp" // FlagSet
1616
#include "databento/publishers.hpp" // Publisher
17-
#include "databento/with_ts_out.hpp"
1817

1918
namespace databento {
19+
// Forward declare
20+
namespace v3 {
21+
struct InstrumentDefMsg;
22+
}
23+
2024
// Common data for all Databento Records.
2125
struct RecordHeader {
2226
static constexpr std::size_t kLengthMultiplier =
@@ -371,6 +375,7 @@ static_assert(alignof(StatusMsg) == 8, "Must have 8-byte alignment");
371375
struct InstrumentDefMsg {
372376
static bool HasRType(RType rtype) { return rtype == RType::InstrumentDef; }
373377

378+
v3::InstrumentDefMsg ToV3() const;
374379
UnixNanos IndexTs() const { return ts_recv; }
375380
const char* Currency() const { return currency.data(); }
376381
const char* SettlCurrency() const { return settl_currency.data(); }
@@ -780,6 +785,5 @@ std::ostream& operator<<(std::ostream& stream,
780785
const SymbolMappingMsg& symbol_mapping_msg);
781786

782787
// The length in bytes of the largest record type.
783-
static constexpr std::size_t kMaxRecordLen =
784-
sizeof(WithTsOut<InstrumentDefMsg>);
788+
static constexpr std::size_t kMaxRecordLen = 520 + 8;
785789
} // namespace databento

include/databento/v1.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
#include "databento/v2.hpp"
77

88
namespace databento {
9+
// Forward declare
10+
namespace v3 {
11+
struct InstrumentDefMsg;
12+
}
13+
914
namespace v1 {
1015
static constexpr std::size_t kSymbolCstrLen = 22;
1116

@@ -31,6 +36,7 @@ struct InstrumentDefMsg {
3136
static bool HasRType(RType rtype) { return rtype == RType::InstrumentDef; }
3237

3338
v2::InstrumentDefMsg ToV2() const;
39+
v3::InstrumentDefMsg ToV3() const;
3440
const char* Currency() const { return currency.data(); }
3541
const char* SettlCurrency() const { return settl_currency.data(); }
3642
const char* SecSubType() const { return secsubtype.data(); }

include/databento/v3.hpp

+146
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
#pragma once
2+
3+
#include <cstddef>
4+
#include <cstdint>
5+
6+
#include "databento/constants.hpp" // kSymbolCstrLen
7+
#include "databento/datetime.hpp" // UnixNanos
8+
#include "databento/enums.hpp" // InstrumentClass, MatchingAlgorithm, RType, SecurityUpdateAction, Side, UserDefinedInstrument
9+
#include "databento/record.hpp" // RecordHeader
10+
11+
namespace databento {
12+
namespace v3 {
13+
static constexpr std::size_t kSymbolCstrLen = databento::kSymbolCstrLen;
14+
15+
using MboMsg = databento::MboMsg;
16+
using TradeMsg = databento::TradeMsg;
17+
using Mbp1Msg = databento::Mbp1Msg;
18+
using TbboMsg = databento::TbboMsg;
19+
using Mbp10Msg = databento::Mbp10Msg;
20+
using BboMsg = databento::BboMsg;
21+
using Bbo1SMsg = databento::Bbo1SMsg;
22+
using Bbo1MMsg = databento::Bbo1MMsg;
23+
using Cmbp1Msg = databento::Cmbp1Msg;
24+
using TcbboMsg = databento::TcbboMsg;
25+
using CbboMsg = databento::CbboMsg;
26+
using Cbbo1SMsg = databento::Cbbo1SMsg;
27+
using Cbbo1MMsg = databento::Cbbo1MMsg;
28+
using OhlcvMsg = databento::OhlcvMsg;
29+
using StatusMsg = databento::StatusMsg;
30+
using ImbalanceMsg = databento::ImbalanceMsg;
31+
using StatMsg = databento::StatMsg;
32+
using ErrorMsg = databento::ErrorMsg;
33+
using SymbolMappingMsg = databento::SymbolMappingMsg;
34+
using SystemMsg = databento::SystemMsg;
35+
36+
// An instrument definition in DBN version 3.
37+
struct InstrumentDefMsg {
38+
static bool HasRType(RType rtype) { return rtype == RType::InstrumentDef; }
39+
40+
UnixNanos IndexTs() const { return ts_recv; }
41+
const char* Currency() const { return currency.data(); }
42+
const char* SettlCurrency() const { return settl_currency.data(); }
43+
const char* SecSubType() const { return secsubtype.data(); }
44+
const char* RawSymbol() const { return raw_symbol.data(); }
45+
const char* Group() const { return group.data(); }
46+
const char* Exchange() const { return exchange.data(); }
47+
const char* Asset() const { return asset.data(); }
48+
const char* Cfi() const { return cfi.data(); }
49+
const char* SecurityType() const { return security_type.data(); }
50+
const char* UnitOfMeasure() const { return unit_of_measure.data(); }
51+
const char* Underlying() const { return underlying.data(); }
52+
const char* StrikePriceCurrency() const {
53+
return strike_price_currency.data();
54+
}
55+
const char* LegRawSymbol() const { return leg_raw_symbol.data(); }
56+
57+
RecordHeader hd;
58+
UnixNanos ts_recv;
59+
std::int64_t min_price_increment;
60+
std::int64_t display_factor;
61+
UnixNanos expiration;
62+
UnixNanos activation;
63+
std::int64_t high_limit_price;
64+
std::int64_t low_limit_price;
65+
std::int64_t max_price_variation;
66+
std::int64_t unit_of_measure_qty;
67+
std::int64_t min_price_increment_amount;
68+
std::int64_t price_ratio;
69+
std::int64_t strike_price;
70+
std::uint64_t raw_instrument_id;
71+
std::int64_t leg_price;
72+
std::int64_t leg_delta;
73+
std::int32_t inst_attrib_value;
74+
std::uint32_t underlying_id;
75+
std::int32_t market_depth_implied;
76+
std::int32_t market_depth;
77+
std::uint32_t market_segment_id;
78+
std::uint32_t max_trade_vol;
79+
std::int32_t min_lot_size;
80+
std::int32_t min_lot_size_block;
81+
std::int32_t min_lot_size_round_lot;
82+
std::uint32_t min_trade_vol;
83+
std::int32_t contract_multiplier;
84+
std::int32_t decay_quantity;
85+
std::int32_t original_contract_size;
86+
std::uint32_t leg_instrument_id;
87+
std::int32_t leg_ratio_price_numerator;
88+
std::int32_t leg_ratio_price_denominator;
89+
std::int32_t leg_ratio_qty_numerator;
90+
std::int32_t leg_ratio_qty_denominator;
91+
std::uint32_t leg_underlying_id;
92+
std::int16_t appl_id;
93+
std::uint16_t maturity_year;
94+
std::uint16_t decay_start_date;
95+
std::uint16_t channel_id;
96+
std::uint16_t leg_count;
97+
std::uint16_t leg_index;
98+
std::array<char, 4> currency;
99+
std::array<char, 4> settl_currency;
100+
std::array<char, 6> secsubtype;
101+
std::array<char, kSymbolCstrLen> raw_symbol;
102+
std::array<char, 21> group;
103+
std::array<char, 5> exchange;
104+
std::array<char, 7> asset;
105+
std::array<char, 7> cfi;
106+
std::array<char, 7> security_type;
107+
std::array<char, 31> unit_of_measure;
108+
std::array<char, 21> underlying;
109+
std::array<char, 4> strike_price_currency;
110+
std::array<char, kSymbolCstrLen> leg_raw_symbol;
111+
InstrumentClass instrument_class;
112+
MatchAlgorithm match_algorithm;
113+
std::uint8_t main_fraction;
114+
std::uint8_t price_display_format;
115+
std::uint8_t sub_fraction;
116+
std::uint8_t underlying_product;
117+
SecurityUpdateAction security_update_action;
118+
std::uint8_t maturity_month;
119+
std::uint8_t maturity_day;
120+
std::uint8_t maturity_week;
121+
UserDefinedInstrument user_defined_instrument;
122+
std::int8_t contract_multiplier_unit;
123+
std::int8_t flow_schedule_type;
124+
std::uint8_t tick_rule;
125+
InstrumentClass leg_instrument_class;
126+
Side leg_side;
127+
// padding for alignment
128+
std::array<char, 21> reserved;
129+
};
130+
static_assert(sizeof(InstrumentDefMsg) == 520,
131+
"InstrumentDefMsg size must match Rust");
132+
static_assert(alignof(InstrumentDefMsg) == 8, "Must have 8-byte alignment");
133+
static_assert(kMaxRecordLen == sizeof(InstrumentDefMsg) + sizeof(UnixNanos),
134+
"v3 definition with ts_out should be the largest record");
135+
136+
bool operator==(const InstrumentDefMsg& lhs, const InstrumentDefMsg& rhs);
137+
inline bool operator!=(const InstrumentDefMsg& lhs,
138+
const InstrumentDefMsg& rhs) {
139+
return !(lhs == rhs);
140+
}
141+
142+
std::string ToString(const InstrumentDefMsg& instr_def_msg);
143+
std::ostream& operator<<(std::ostream& stream,
144+
const InstrumentDefMsg& instr_def_msg);
145+
} // namespace v3
146+
} // namespace databento

pkg/PKGBUILD

+1-1
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.26.0
4+
pkgver=0.27.0
55
pkgrel=1
66
pkgdesc="Official C++ client for Databento"
77
arch=('any')

src/record.cpp

+91
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "databento/enums.hpp"
66
#include "databento/exceptions.hpp" // InvalidArgumentError
77
#include "databento/fixed_price.hpp"
8+
#include "databento/v3.hpp"
89
#include "stream_op_helper.hpp"
910

1011
using databento::Record;
@@ -106,6 +107,96 @@ databento::RType Record::RTypeFromSchema(const Schema schema) {
106107

107108
using databento::InstrumentDefMsg;
108109

110+
databento::v3::InstrumentDefMsg InstrumentDefMsg::ToV3() const {
111+
v3::InstrumentDefMsg ret{
112+
RecordHeader{
113+
sizeof(v3::InstrumentDefMsg) / RecordHeader::kLengthMultiplier,
114+
RType::InstrumentDef, hd.publisher_id, hd.instrument_id, hd.ts_event},
115+
ts_recv,
116+
min_price_increment,
117+
display_factor,
118+
expiration,
119+
activation,
120+
high_limit_price,
121+
low_limit_price,
122+
max_price_variation,
123+
unit_of_measure_qty,
124+
min_price_increment_amount,
125+
price_ratio,
126+
strike_price,
127+
raw_instrument_id,
128+
kUndefPrice,
129+
kUndefPrice,
130+
inst_attrib_value,
131+
underlying_id,
132+
market_depth_implied,
133+
market_depth,
134+
market_segment_id,
135+
max_trade_vol,
136+
min_lot_size,
137+
min_lot_size_block,
138+
min_lot_size_round_lot,
139+
min_trade_vol,
140+
contract_multiplier,
141+
decay_quantity,
142+
original_contract_size,
143+
{},
144+
{},
145+
{},
146+
{},
147+
{},
148+
{},
149+
appl_id,
150+
maturity_year,
151+
decay_start_date,
152+
channel_id,
153+
{},
154+
{},
155+
currency,
156+
settl_currency,
157+
secsubtype,
158+
{},
159+
{},
160+
{},
161+
{},
162+
{},
163+
{},
164+
{},
165+
{},
166+
{},
167+
{},
168+
instrument_class,
169+
match_algorithm,
170+
main_fraction,
171+
price_display_format,
172+
sub_fraction,
173+
underlying_product,
174+
security_update_action,
175+
maturity_month,
176+
maturity_day,
177+
maturity_week,
178+
user_defined_instrument,
179+
contract_multiplier_unit,
180+
flow_schedule_type,
181+
tick_rule,
182+
{},
183+
Side::None,
184+
{}};
185+
std::copy(raw_symbol.begin(), raw_symbol.end(), ret.raw_symbol.begin());
186+
std::copy(group.begin(), group.end(), ret.group.begin());
187+
std::copy(exchange.begin(), exchange.end(), ret.exchange.begin());
188+
std::copy(asset.begin(), asset.end(), ret.asset.begin());
189+
std::copy(cfi.begin(), cfi.end(), ret.cfi.begin());
190+
std::copy(security_type.begin(), security_type.end(),
191+
ret.security_type.begin());
192+
std::copy(unit_of_measure.begin(), unit_of_measure.end(),
193+
ret.unit_of_measure.begin());
194+
std::copy(underlying.begin(), underlying.end(), ret.underlying.begin());
195+
std::copy(strike_price_currency.begin(), strike_price_currency.end(),
196+
ret.strike_price_currency.begin());
197+
return ret;
198+
}
199+
109200
bool databento::operator==(const InstrumentDefMsg& lhs,
110201
const InstrumentDefMsg& rhs) {
111202
return lhs.hd == rhs.hd && lhs.ts_recv == rhs.ts_recv &&

0 commit comments

Comments
 (0)