Skip to content

Commit

Permalink
VER: Release 0.23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen authored Sep 24, 2024
2 parents 9b72db6 + 71697a5 commit cf9a2a7
Show file tree
Hide file tree
Showing 21 changed files with 205 additions and 38 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.23.0 - 2024-09-24

### Enhancements
- Added new `Cmbp1Msg`
- Added new consolidated publisher values for `XNAS.BASIC` and `DBEQ.MAX`

### Breaking changes
- Changed the layout of `CbboMsg` to better match `BboMsg`
- Renamed `Schema::Cbbo` to `Schema::Cmbp1`

### Deprecations
- Deprecated `Packing::Tar` and renamed it to `TarDeprecated`. This variant will be
removed in a future version when it is no longer supported by the API

## 0.22.0 - 2024-08-27

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.14)
# Project details
#

project("databento" VERSION 0.22.0 LANGUAGES CXX)
project("databento" VERSION 0.23.0 LANGUAGES CXX)
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPERCASE)

#
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![test](https://github.com/databento/databento-cpp/actions/workflows/build.yaml/badge.svg?branch=main)](https://github.com/databento/databento-cpp/actions/workflows/build.yaml)
[![license](https://img.shields.io/github/license/databento/databento-cpp?color=blue)](./LICENSE)
[![Slack](https://img.shields.io/badge/join_Slack-community-darkblue.svg?logo=slack)](http://to.dbn.to/slack)
[![Slack](https://img.shields.io/badge/join_Slack-community-darkblue.svg?logo=slack)](https://to.dbn.to/slack)

The official C++ client library for [Databento](https://databento.com).
The client supports both streaming real-time and historical market data through similar interfaces.
Expand Down
5 changes: 3 additions & 2 deletions include/databento/dbn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ struct MappingInterval {
date::year_month_day start_date;
// The end date of the interval (exclusive).
date::year_month_day end_date;
// The resolved symbol for this interval (in `stype_out`).
std::string symbol;
};

struct SymbolMapping {
// The raw symbol from the publisher.
// The `stype_in` symbol.
std::string raw_symbol;
// The mappings of `native` for different date ranges.
// The mappings of `raw_symbol` to `stype_out` for different date ranges.
std::vector<MappingInterval> intervals;
};

Expand Down
6 changes: 3 additions & 3 deletions include/databento/enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ enum class Schema : std::uint16_t {
Statistics = 10,
Status = 11,
Imbalance = 12,
Cbbo = 14,
Cmbp1 = 14,
Cbbo1S = 15,
Cbbo1M = 16,
Tcbbo = 17,
Expand Down Expand Up @@ -89,7 +89,7 @@ enum class SplitDuration : std::uint8_t {
enum class Packaging : std::uint8_t {
None = 0,
Zip,
Tar,
TarDeprecated,
};

// Represents how a batch job will be delivered.
Expand Down Expand Up @@ -139,7 +139,7 @@ enum RType : std::uint8_t {
System = 0x17,
Statistics = 0x18,
Mbo = 0xA0,
Cbbo = 0xB1,
Cmbp1 = 0xB1,
Cbbo1S = 0xC0,
Cbbo1M = 0xC1,
Tcbbo = 0xC2,
Expand Down
4 changes: 4 additions & 0 deletions include/databento/publishers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ enum class Publisher : std::uint16_t {
XcisBbotradesXcis = 91,
// NYSE BBO and Trades
XnysBbotradesXnys = 92,
// Nasdaq Basic - Consolidated
XnasBasicDbeq = 93,
// DBEQ Max - Consolidated
DbeqMaxDbeq = 94,
};

// Get a Publisher's Venue.
Expand Down
60 changes: 50 additions & 10 deletions include/databento/record.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,36 +254,68 @@ using Bbo1MMsg = BboMsg;
static_assert(alignof(BboMsg) == 8, "Must have 8-byte alignment");
static_assert(sizeof(BboMsg) == sizeof(Mbp1Msg), "BboMsg size must match Rust");

struct Cmbp1Msg {
static bool HasRType(RType rtype) {
switch (rtype) {
case RType::Cmbp1: // fallthrough
case RType::Tcbbo:
return true;
default:
return false;
};
}

UnixNanos IndexTs() const { return ts_recv; }

RecordHeader hd;
std::int64_t price;
std::uint32_t size;
char action;
Side side;
FlagSet flags;
char reserved1;
UnixNanos ts_recv;
TimeDeltaNanos ts_in_delta;
std::array<char, 4> reserved2;
std::array<ConsolidatedBidAskPair, 1> levels;
};
using TcbboMsg = Cmbp1Msg;
static_assert(alignof(Cmbp1Msg) == 8, "Must have 8-byte alignment");
static_assert(sizeof(Cmbp1Msg) ==
sizeof(TradeMsg) + sizeof(ConsolidatedBidAskPair),
"Cmbp1Msg size must match Rust");

struct CbboMsg {
static bool HasRType(RType rtype) {
switch (rtype) {
case RType::Cbbo: // fallthrough
case RType::Cbbo1S: // fallthrough
case RType::Cbbo1M: // fallthrough
case RType::Tcbbo:
return true;
default:
return false;
};
}
static_assert(alignof(Cmbp1Msg) == 8, "Must have 8-byte alignment");
static_assert(sizeof(Cmbp1Msg) ==
sizeof(TradeMsg) + sizeof(ConsolidatedBidAskPair),
"Cmbp1Msg size must match Rust");

UnixNanos IndexTs() const { return ts_recv; }

RecordHeader hd;
std::int64_t price;
std::uint32_t size;
Action action;
char reserved1;
Side side;
FlagSet flags;
char reserved;
char reserved2;
UnixNanos ts_recv;
TimeDeltaNanos ts_in_delta;
std::uint32_t sequence;
std::array<char, 4> reserved3;
std::array<char, 4> reserved4;
std::array<ConsolidatedBidAskPair, 1> levels;
};
using Cbbo1SMsg = CbboMsg;
using Cbbo1MMsg = CbboMsg;
using TcbboMsg = CbboMsg;
static_assert(alignof(CbboMsg) == 8, "Must have 8-byte alignment");
static_assert(sizeof(CbboMsg) ==
sizeof(TradeMsg) + sizeof(ConsolidatedBidAskPair),
Expand Down Expand Up @@ -604,12 +636,20 @@ inline bool operator!=(const BboMsg& lhs, const BboMsg& rhs) {
return !(lhs == rhs);
}

inline bool operator==(const CbboMsg& lhs, const CbboMsg& rhs) {
inline bool operator==(const Cmbp1Msg& lhs, const Cmbp1Msg& rhs) {
return lhs.hd == rhs.hd && lhs.price == rhs.price && lhs.size == rhs.size &&
lhs.action == rhs.action && lhs.side == rhs.side &&
lhs.flags == rhs.flags && lhs.ts_recv == rhs.ts_recv &&
lhs.ts_in_delta == rhs.ts_in_delta && lhs.sequence == rhs.sequence &&
lhs.levels == rhs.levels;
lhs.ts_in_delta == rhs.ts_in_delta && lhs.levels == rhs.levels;
}
inline bool operator!=(const Cmbp1Msg& lhs, const Cmbp1Msg& rhs) {
return !(lhs == rhs);
}

inline bool operator==(const CbboMsg& lhs, const CbboMsg& rhs) {
return lhs.hd == rhs.hd && lhs.price == rhs.price && lhs.size == rhs.size &&
lhs.side == rhs.side && lhs.flags == rhs.flags &&
lhs.ts_recv == rhs.ts_recv && lhs.levels == rhs.levels;
}
inline bool operator!=(const CbboMsg& lhs, const CbboMsg& rhs) {
return !(lhs == rhs);
Expand Down
2 changes: 1 addition & 1 deletion pkg/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Maintainer: Databento <[email protected]>
_pkgname=databento-cpp
pkgname=databento-cpp-git
pkgver=0.22.0
pkgver=0.23.0
pkgrel=1
pkgdesc="Official C++ client for Databento"
arch=('any')
Expand Down
16 changes: 8 additions & 8 deletions src/enums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ const char* ToString(Schema schema) {
case Schema::Imbalance: {
return "imbalance";
}
case Schema::Cbbo: {
return "cbbo";
case Schema::Cmbp1: {
return "cmbp-1";
}
case Schema::Cbbo1S: {
return "cbbo-1s";
Expand Down Expand Up @@ -188,7 +188,7 @@ const char* ToString(Packaging packaging) {
case Packaging::Zip: {
return "zip";
}
case Packaging::Tar: {
case Packaging::TarDeprecated: {
return "tar";
}
default: {
Expand Down Expand Up @@ -310,8 +310,8 @@ const char* ToString(RType rtype) {
case RType::Mbo: {
return "Mbo";
}
case RType::Cbbo: {
return "Cbbo";
case RType::Cmbp1: {
return "Cmbp1";
}
case RType::Cbbo1S: {
return "Cbbo1S";
Expand Down Expand Up @@ -933,8 +933,8 @@ Schema FromString(const std::string& str) {
if (str == "imbalance") {
return Schema::Imbalance;
}
if (str == "cbbo") {
return Schema::Cbbo;
if (str == "cmbp-1") {
return Schema::Cmbp1;
}
if (str == "cbbo-1s") {
return Schema::Cbbo1S;
Expand Down Expand Up @@ -1048,7 +1048,7 @@ Packaging FromString(const std::string& str) {
return Packaging::Zip;
}
if (str == "tar") {
return Packaging::Tar;
return Packaging::TarDeprecated;
}
throw InvalidArgumentError{"FromString<Packaging>", "str",
"unknown value '" + str + '\''};
Expand Down
24 changes: 24 additions & 0 deletions src/publishers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,12 @@ Venue PublisherVenue(Publisher publisher) {
case Publisher::XnysBbotradesXnys: {
return Venue::Xnys;
}
case Publisher::XnasBasicDbeq: {
return Venue::Dbeq;
}
case Publisher::DbeqMaxDbeq: {
return Venue::Dbeq;
}
default: {
throw InvalidArgumentError{
"PublisherVenue", "publisher",
Expand Down Expand Up @@ -1073,6 +1079,12 @@ Dataset PublisherDataset(Publisher publisher) {
case Publisher::XnysBbotradesXnys: {
return Dataset::XnysBbotrades;
}
case Publisher::XnasBasicDbeq: {
return Dataset::XnasBasic;
}
case Publisher::DbeqMaxDbeq: {
return Dataset::DbeqMax;
}
default: {
throw InvalidArgumentError{
"PublisherDataset", "publisher",
Expand Down Expand Up @@ -1360,6 +1372,12 @@ const char* ToString(Publisher publisher) {
case Publisher::XnysBbotradesXnys: {
return "XNYS.BBOTRADES.XNYS";
}
case Publisher::XnasBasicDbeq: {
return "XNAS.BASIC.DBEQ";
}
case Publisher::DbeqMaxDbeq: {
return "DBEQ.MAX.DBEQ";
}
default: {
return "Unknown";
}
Expand Down Expand Up @@ -1649,6 +1667,12 @@ Publisher FromString(const std::string& str) {
if (str == "XNYS.BBOTRADES.XNYS") {
return Publisher::XnysBbotradesXnys;
}
if (str == "XNAS.BASIC.DBEQ") {
return Publisher::XnasBasicDbeq;
}
if (str == "DBEQ.MAX.DBEQ") {
return Publisher::DbeqMaxDbeq;
}
throw InvalidArgumentError{"FromString<Publisher>", "str",
"unknown value '" + str + '\''};
}
Expand Down
20 changes: 17 additions & 3 deletions src/record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,23 @@ std::ostream& operator<<(std::ostream& stream, const BboMsg& bbo_msg) {
.AddField("levels", std::get<0>(bbo_msg.levels))
.Finish();
}
std::string ToString(const Cmbp1Msg& cbbo_msg) { return MakeString(cbbo_msg); }
std::ostream& operator<<(std::ostream& stream, const Cmbp1Msg& cmbp1_msg) {
return StreamOpBuilder{stream}
.SetTypeName("Cmbp1Msg")
.SetSpacer("\n ")
.Build()
.AddField("hd", cmbp1_msg.hd)
.AddField("price", FixPx{cmbp1_msg.price})
.AddField("size", cmbp1_msg.size)
.AddField("action", cmbp1_msg.action)
.AddField("side", cmbp1_msg.side)
.AddField("flags", cmbp1_msg.flags)
.AddField("ts_recv", cmbp1_msg.ts_recv)
.AddField("ts_in_delta", cmbp1_msg.ts_in_delta)
.AddField("levels", std::get<0>(cmbp1_msg.levels))
.Finish();
}
std::string ToString(const CbboMsg& cbbo_msg) { return MakeString(cbbo_msg); }
std::ostream& operator<<(std::ostream& stream, const CbboMsg& cbbo_msg) {
return StreamOpBuilder{stream}
Expand All @@ -331,12 +348,9 @@ std::ostream& operator<<(std::ostream& stream, const CbboMsg& cbbo_msg) {
.AddField("hd", cbbo_msg.hd)
.AddField("price", FixPx{cbbo_msg.price})
.AddField("size", cbbo_msg.size)
.AddField("action", cbbo_msg.action)
.AddField("side", cbbo_msg.side)
.AddField("flags", cbbo_msg.flags)
.AddField("ts_recv", cbbo_msg.ts_recv)
.AddField("ts_in_delta", cbbo_msg.ts_in_delta)
.AddField("sequence", cbbo_msg.sequence)
.AddField("levels", std::get<0>(cbbo_msg.levels))
.Finish();
}
Expand Down
Binary file modified tests/data/test_data.cbbo.dbn
Binary file not shown.
Binary file modified tests/data/test_data.cbbo.dbn.zst
Binary file not shown.
Binary file modified tests/data/test_data.cbbo.v1.dbn
Binary file not shown.
Binary file modified tests/data/test_data.cbbo.v1.dbn.zst
Binary file not shown.
Binary file added tests/data/test_data.cmbp-1.dbn
Binary file not shown.
Binary file added tests/data/test_data.cmbp-1.dbn.zst
Binary file not shown.
Binary file added tests/data/test_data.cmbp-1.v1.dbn
Binary file not shown.
Binary file added tests/data/test_data.cmbp-1.v1.dbn.zst
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/src/batch_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ TEST(BatchTests, TestBatchJobToString) {
SplitDuration::Week,
{},
false,
Packaging::Tar,
Packaging::Zip,
Delivery::Download,
10250,
35000000,
Expand Down Expand Up @@ -61,7 +61,7 @@ TEST(BatchTests, TestBatchJobToString) {
split_duration = week,
split_size = 0,
split_symbols = false,
packaging = tar,
packaging = zip,
delivery = download,
record_count = 10250,
billed_size = 35000000,
Expand Down
Loading

0 comments on commit cf9a2a7

Please sign in to comment.