Skip to content

Commit

Permalink
VER: Release 0.19.1
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen authored Jun 25, 2024
2 parents 4b51f62 + b665f4d commit edae42e
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 21 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## 0.19.1 - 2024-06-25

### Enhancements
- Added `Upgrade()` method to `Metadata` to update the metadata fields according to a
`VersionUpgradePolicy`
- Added new publisher values for `XNAS.BASIC` and `XNAS.NLS`

### Bug fixes
- Fixed issue where `Metadata` wasn't upgraded when passing
`VersionUpgradePolicy::Upgrade`

## 0.19.0 - 2024-06-04

### Enhancements
Expand All @@ -23,7 +34,7 @@
### Bug fixes
- Fixed overloading of live `Subscribe` methods
- Fixed live subscribing with default-constructed `UnixNanos`
- Fixed descriptions for `FINN` and `FINY` publishers.
- Fixed descriptions for `FINN` and `FINY` publishers

## 0.18.1 - 2024-05-22

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.19.0 LANGUAGES CXX)
project("databento" VERSION 0.19.1 LANGUAGES CXX)
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPERCASE)

#
Expand Down
3 changes: 3 additions & 0 deletions include/databento/dbn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ struct Metadata {
std::vector<std::string> not_found;
// Symbol mappings containing a native symbol and its mapping intervals.
std::vector<SymbolMapping> mappings;

// Upgrades the metadata according to `upgrade_policy` if necessary.
void Upgrade(VersionUpgradePolicy upgrade_policy);
};

inline bool operator==(const MappingInterval& lhs, const MappingInterval& rhs) {
Expand Down
8 changes: 8 additions & 0 deletions include/databento/publishers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,14 @@ enum class Publisher : std::uint16_t {
IfeuImpactXoff = 84,
// ICE Endex - Off-Market Trades
NdexImpactXoff = 85,
// Nasdaq NLS - Nasdaq BX
XnasNlsXbos = 86,
// Nasdaq NLS - Nasdaq PSX
XnasNlsXpsx = 87,
// Nasdaq Basic - Nasdaq BX
XnasBasicXbos = 88,
// Nasdaq Basic - Nasdaq PSX
XnasBasicXpsx = 89,
};

// Get a Publisher's Venue.
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 <support@databento.com>
_pkgname=databento-cpp
pkgname=databento-cpp-git
pkgver=0.19.0
pkgver=0.19.1
pkgrel=1
pkgdesc="Official C++ client for Databento"
arch=('any')
Expand Down
11 changes: 10 additions & 1 deletion src/dbn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@

#include <array>
#include <sstream> // ostringstream
#include <utility> // pair

#include "databento/constants.hpp"
#include "stream_op_helper.hpp"

namespace databento {

void Metadata::Upgrade(VersionUpgradePolicy upgrade_policy) {
if (version < kDbnVersion &&
upgrade_policy == VersionUpgradePolicy::Upgrade) {
version = kDbnVersion;
symbol_cstr_len = kSymbolCstrLen;
}
}

std::string ToString(const Metadata& metadata) { return MakeString(metadata); }
std::ostream& operator<<(std::ostream& stream, const Metadata& metadata) {
auto helper = StreamOpBuilder{stream}
Expand Down
1 change: 1 addition & 0 deletions src/dbn_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ databento::Metadata DbnDecoder::DecodeMetadata() {
buffer_idx_ = read_buffer_.size();
auto metadata = DbnDecoder::DecodeMetadataFields(version_, read_buffer_);
ts_out_ = metadata.ts_out;
metadata.Upgrade(upgrade_policy_);
return metadata;
}

Expand Down
1 change: 1 addition & 0 deletions src/live_blocking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ databento::Metadata LiveBlocking::Start() {
auto metadata =
DbnDecoder::DecodeMetadataFields(version_and_size.first, meta_buffer);
version_ = metadata.version;
metadata.Upgrade(upgrade_policy_);
return metadata;
}

Expand Down
48 changes: 48 additions & 0 deletions src/publishers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,18 @@ Venue PublisherVenue(Publisher publisher) {
case Publisher::NdexImpactXoff: {
return Venue::Xoff;
}
case Publisher::XnasNlsXbos: {
return Venue::Xbos;
}
case Publisher::XnasNlsXpsx: {
return Venue::Xpsx;
}
case Publisher::XnasBasicXbos: {
return Venue::Xbos;
}
case Publisher::XnasBasicXpsx: {
return Venue::Xpsx;
}
default: {
throw InvalidArgumentError{
"PublisherVenue", "publisher",
Expand Down Expand Up @@ -1013,6 +1025,18 @@ Dataset PublisherDataset(Publisher publisher) {
case Publisher::NdexImpactXoff: {
return Dataset::NdexImpact;
}
case Publisher::XnasNlsXbos: {
return Dataset::XnasNls;
}
case Publisher::XnasNlsXpsx: {
return Dataset::XnasNls;
}
case Publisher::XnasBasicXbos: {
return Dataset::XnasBasic;
}
case Publisher::XnasBasicXpsx: {
return Dataset::XnasBasic;
}
default: {
throw InvalidArgumentError{
"PublisherDataset", "publisher",
Expand Down Expand Up @@ -1279,6 +1303,18 @@ const char* ToString(Publisher publisher) {
case Publisher::NdexImpactXoff: {
return "NDEX.IMPACT.XOFF";
}
case Publisher::XnasNlsXbos: {
return "XNAS.NLS.XBOS";
}
case Publisher::XnasNlsXpsx: {
return "XNAS.NLS.XPSX";
}
case Publisher::XnasBasicXbos: {
return "XNAS.BASIC.XBOS";
}
case Publisher::XnasBasicXpsx: {
return "XNAS.BASIC.XPSX";
}
default: {
return "Unknown";
}
Expand Down Expand Up @@ -1547,6 +1583,18 @@ Publisher FromString(const std::string& str) {
if (str == "NDEX.IMPACT.XOFF") {
return Publisher::NdexImpactXoff;
}
if (str == "XNAS.NLS.XBOS") {
return Publisher::XnasNlsXbos;
}
if (str == "XNAS.NLS.XPSX") {
return Publisher::XnasNlsXpsx;
}
if (str == "XNAS.BASIC.XBOS") {
return Publisher::XnasBasicXbos;
}
if (str == "XNAS.BASIC.XPSX") {
return Publisher::XnasBasicXpsx;
}
throw InvalidArgumentError{"FromString<Publisher>", "str",
"unknown value '" + str + '\''};
}
Expand Down
2 changes: 1 addition & 1 deletion test/src/dbn_decoder_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ TEST_F(DbnDecoderTests, TestDecodeDefinitionUpgrade) {
const Metadata ch_metadata = channel_target_->DecodeMetadata();
const Metadata f_metadata = file_target_->DecodeMetadata();
EXPECT_EQ(ch_metadata, f_metadata);
EXPECT_EQ(ch_metadata.version, 1);
EXPECT_EQ(ch_metadata.version, 2);
EXPECT_EQ(ch_metadata.dataset, dataset::kXnasItch);
EXPECT_EQ(ch_metadata.schema, Schema::Definition);
EXPECT_EQ(ch_metadata.start.time_since_epoch().count(), 1633305600000000000);
Expand Down
38 changes: 22 additions & 16 deletions test/src/live_blocking_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <memory>
#include <mutex> // lock_guard, mutex, unique_lock
#include <thread> // this_thread
#include <utility>
#include <vector>

#include "databento/constants.hpp" // dataset
Expand Down Expand Up @@ -55,23 +56,28 @@ TEST_F(LiveBlockingTests, TestAuthentication) {
.BuildBlocking();
}

TEST_F(LiveBlockingTests, TestStart) {
TEST_F(LiveBlockingTests, TestStartAndUpgrade) {
constexpr auto kTsOut = true;
const mock::MockLsgServer mock_server{dataset::kGlbxMdp3, kTsOut,
[](mock::MockLsgServer& self) {
self.Accept();
self.Authenticate();
self.Start();
}};

LiveBlocking target = builder_.SetAddress(kLocalhost, mock_server.Port())
.SetSendTsOut(kTsOut)
.SetDataset(dataset::kGlbxMdp3)
.BuildBlocking();
const auto metadata = target.Start();
EXPECT_EQ(metadata.version, 1);
EXPECT_TRUE(metadata.has_mixed_schema);
EXPECT_EQ(metadata.dataset, dataset::kGlbxMdp3);
for (const auto policy_and_version :
{std::make_pair(VersionUpgradePolicy::AsIs, 1),
std::make_pair(VersionUpgradePolicy::Upgrade, 2)}) {
const mock::MockLsgServer mock_server{dataset::kGlbxMdp3, kTsOut,
[](mock::MockLsgServer& self) {
self.Accept();
self.Authenticate();
self.Start();
}};

LiveBlocking target = builder_.SetAddress(kLocalhost, mock_server.Port())
.SetSendTsOut(kTsOut)
.SetDataset(dataset::kGlbxMdp3)
.SetUpgradePolicy(policy_and_version.first)
.BuildBlocking();
const auto metadata = target.Start();
EXPECT_EQ(metadata.version, policy_and_version.second);
EXPECT_TRUE(metadata.has_mixed_schema);
EXPECT_EQ(metadata.dataset, dataset::kGlbxMdp3);
}
}

TEST_F(LiveBlockingTests, TestSubscribe) {
Expand Down

0 comments on commit edae42e

Please sign in to comment.