diff --git a/CHANGELOG.md b/CHANGELOG.md index 79f62c1..63dbac9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.43.0 - 2025-10-21 + +### Enhancements +- Made `Unset` a fully-supported variant of `SystemCode` and `ErrorCode` + +### Breaking changes +- Removed `mode` parameter in `Historical::MetadataGetCost()` + ## 0.42.0 - 2025-08-19 ### Enhancements diff --git a/CMakeLists.txt b/CMakeLists.txt index c5b72db..7cf3697 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.24..4.0) project( databento - VERSION 0.42.0 + VERSION 0.43.0 LANGUAGES CXX DESCRIPTION "Official Databento client library" ) diff --git a/cmake/StandardSettings.cmake b/cmake/StandardSettings.cmake index 3046821..5e90442 100644 --- a/cmake/StandardSettings.cmake +++ b/cmake/StandardSettings.cmake @@ -43,7 +43,7 @@ option(${PROJECT_NAME_UPPERCASE}_ENABLE_TSAN "Enable thread sanitizer." OFF) option(${PROJECT_NAME_UPPERCASE}_ENABLE_UBSAN "Enable undefined behavior sanitizer." OFF) # -# Miscelanious options +# Miscellaneous options # # Generate compile_commands.json for clang based tools diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake index bfdd8f3..d359f9b 100644 --- a/cmake/Utils.cmake +++ b/cmake/Utils.cmake @@ -10,7 +10,7 @@ function(verbose_message content) endfunction() # -# Add a target for formating the project using `clang-format` (i.e: cmake --build build --target clang-format) +# Add a target for formatting the project using `clang-format` (i.e: cmake --build build --target clang-format) # function(add_clang_format_target) diff --git a/include/databento/dbn.hpp b/include/databento/dbn.hpp index b349848..4aac19f 100644 --- a/include/databento/dbn.hpp +++ b/include/databento/dbn.hpp @@ -76,7 +76,7 @@ struct Metadata { // This method is useful when working with a historical request over a single // day or in other situations where you're sure the mappings don't change // during the time range of the request. Otherwise, `SymbolMap()` is - // recommmended. + // recommended. PitSymbolMap CreateSymbolMapForDate(date::year_month_day date) const; // Creates a symbology mapping from instrument ID and date to text symbol. TsSymbolMap CreateSymbolMap() const; diff --git a/include/databento/detail/buffer.hpp b/include/databento/detail/buffer.hpp index 7488342..ff9d68e 100644 --- a/include/databento/detail/buffer.hpp +++ b/include/databento/detail/buffer.hpp @@ -43,7 +43,7 @@ class Buffer : public IReadable, public IWritable { std::byte* ReadEnd() { return write_pos_; } const std::byte* ReadBegin() const { return read_pos_; } const std::byte* ReadEnd() const { return write_pos_; } - // Indicate how mnay bytes were read + // Indicate how many bytes were read void Consume(std::size_t length) { read_pos_ += length; if (static_cast(read_pos_ - buf_.get()) > (Capacity() / 2)) { diff --git a/include/databento/enums.hpp b/include/databento/enums.hpp index 128bc71..dcba208 100644 --- a/include/databento/enums.hpp +++ b/include/databento/enums.hpp @@ -609,6 +609,8 @@ enum ErrorCode : std::uint8_t { InvalidSubscription = 5, // An error occurred in the gateway. InternalError = 6, + // No error code was specified or this record was upgraded from a version 1 struct + // where the code field didn't exist. Unset = 255, }; } // namespace error_code @@ -630,6 +632,8 @@ enum SystemCode : std::uint8_t { // Signals that all records for interval-based schemas have been published for the // given timestamp. EndOfInterval = 4, + // No system code was specified or this record was upgraded from a version 1 struct + // where the code field didn't exist. Unset = 255, }; } // namespace system_code diff --git a/include/databento/historical.hpp b/include/databento/historical.hpp index 7af9f22..0c5474a 100644 --- a/include/databento/historical.hpp +++ b/include/databento/historical.hpp @@ -84,7 +84,7 @@ class Historical { * Metadata API */ - // Retrievs a mapping of publisher name to publisher ID. + // Retrieves a mapping of publisher name to publisher ID. std::vector MetadataListPublishers(); std::vector MetadataListDatasets(); std::vector MetadataListDatasets(const DateRange& date_range); @@ -139,11 +139,11 @@ class Historical { double MetadataGetCost(const std::string& dataset, const DateTimeRange& datetime_range, const std::vector& symbols, Schema schema, - FeedMode mode, SType stype_in, std::uint64_t limit); + SType stype_in, std::uint64_t limit); double MetadataGetCost(const std::string& dataset, const DateTimeRange& datetime_range, const std::vector& symbols, Schema schema, - FeedMode mode, SType stype_in, std::uint64_t limit); + SType stype_in, std::uint64_t limit); /* * Symbology API diff --git a/pkg/PKGBUILD b/pkg/PKGBUILD index 7a1c703..a35bf8a 100644 --- a/pkg/PKGBUILD +++ b/pkg/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Databento _pkgname=databento-cpp pkgname=databento-cpp-git -pkgver=0.42.0 +pkgver=0.43.0 pkgrel=1 pkgdesc="Official C++ client for Databento" arch=('any') diff --git a/src/enums.cpp b/src/enums.cpp index 65f865a..97d898a 100644 --- a/src/enums.cpp +++ b/src/enums.cpp @@ -776,6 +776,9 @@ const char* ToString(ErrorCode error_code) { case ErrorCode::InternalError: { return "internal_error"; } + case ErrorCode::Unset: { + return "unset"; + } default: { return "Unknown"; } @@ -798,6 +801,9 @@ const char* ToString(SystemCode system_code) { case SystemCode::EndOfInterval: { return "end_of_interval"; } + case SystemCode::Unset: { + return "unset"; + } default: { return "Unknown"; } @@ -1219,6 +1225,9 @@ ErrorCode FromString(const std::string& str) { if (str == "internal_error") { return ErrorCode::InternalError; } + if (str == "unset") { + return ErrorCode::Unset; + } throw InvalidArgumentError{"FromString", "str", "unknown value '" + str + '\''}; } @@ -1239,6 +1248,9 @@ SystemCode FromString(const std::string& str) { if (str == "end_of_interval") { return SystemCode::EndOfInterval; } + if (str == "unset") { + return SystemCode::Unset; + } throw InvalidArgumentError{"FromString", "str", "unknown value '" + str + '\''}; } diff --git a/src/historical.cpp b/src/historical.cpp index 9df88a0..34fe9ce 100644 --- a/src/historical.cpp +++ b/src/historical.cpp @@ -665,25 +665,23 @@ double Historical::MetadataGetCost(const std::string& dataset, const std::vector& symbols, Schema schema) { return this->MetadataGetCost(dataset, datetime_range, symbols, schema, - FeedMode::HistoricalStreaming, kDefaultSTypeIn, {}); + kDefaultSTypeIn, {}); } double Historical::MetadataGetCost(const std::string& dataset, const DateTimeRange& datetime_range, const std::vector& symbols, Schema schema) { return this->MetadataGetCost(dataset, datetime_range, symbols, schema, - FeedMode::HistoricalStreaming, kDefaultSTypeIn, {}); + kDefaultSTypeIn, {}); } double Historical::MetadataGetCost(const std::string& dataset, const DateTimeRange& datetime_range, const std::vector& symbols, - Schema schema, FeedMode mode, SType stype_in, - std::uint64_t limit) { + Schema schema, SType stype_in, std::uint64_t limit) { httplib::Params params{ {"dataset", dataset}, {"start", ToString(datetime_range.start)}, {"symbols", JoinSymbolStrings(kMetadataGetCostEndpoint, symbols)}, - {"mode", ToString(mode)}, {"schema", ToString(schema)}, {"stype_in", ToString(stype_in)}}; detail::SetIfPositive(¶ms, "end", datetime_range.end); @@ -693,13 +691,11 @@ double Historical::MetadataGetCost(const std::string& dataset, double Historical::MetadataGetCost(const std::string& dataset, const DateTimeRange& datetime_range, const std::vector& symbols, - Schema schema, FeedMode mode, SType stype_in, - std::uint64_t limit) { + Schema schema, SType stype_in, std::uint64_t limit) { httplib::Params params{ {"dataset", dataset}, {"start", datetime_range.start}, {"symbols", JoinSymbolStrings(kMetadataGetCostEndpoint, symbols)}, - {"mode", ToString(mode)}, {"schema", ToString(schema)}, {"stype_in", ToString(stype_in)}}; detail::SetIfNotEmpty(¶ms, "end", datetime_range.end); diff --git a/tests/src/batch_tests.cpp b/tests/src/batch_tests.cpp index 55d6521..09260d8 100644 --- a/tests/src/batch_tests.cpp +++ b/tests/src/batch_tests.cpp @@ -6,7 +6,7 @@ namespace databento::tests { TEST(BatchTests, TestBatchJobToString) { - const BatchJob target{"aNiD", + const BatchJob target{"AN_ID", "USER", 12.39, dataset::kXnasItch, @@ -38,7 +38,7 @@ TEST(BatchTests, TestBatchJobToString) { {}}; const auto res = ToString(target); ASSERT_EQ(res, R"(BatchJob { - id = "aNiD", + id = "AN_ID", user_id = "USER", cost_usd = 12.39, dataset = "XNAS.ITCH", diff --git a/tests/src/historical_tests.cpp b/tests/src/historical_tests.cpp index c7361f8..19afef8 100644 --- a/tests/src/historical_tests.cpp +++ b/tests/src/historical_tests.cpp @@ -227,7 +227,7 @@ static const nlohmann::json kListFilesResp{ {"hash", {}}, {"urls", {{"https", "https://api.databento.com/v0/job_id/test.dbn"}, - {"ftp", "ftp://fpt.databento.com/job_id/test.dbn"}}}}, + {"ftp", "ftp://ftp.databento.com/job_id/test.dbn"}}}}, {{"filename", "test_metadata.json"}, {"size", {}}, {"hash", {}}, @@ -552,7 +552,6 @@ TEST_F(HistoricalTests, TestMetadataGetCost_Full) { {{"dataset", dataset::kGlbxMdp3}, {"start", "2020-06-06T00:00"}, {"end", "2021-03-02T00:00"}, - {"mode", "historical-streaming"}, {"symbols", "MES.OPT,EW.OPT"}, {"schema", "tbbo"}, {"stype_in", "parent"}}, @@ -562,8 +561,7 @@ TEST_F(HistoricalTests, TestMetadataGetCost_Full) { databento::Historical target = Client(port); const auto res = target.MetadataGetCost( dataset::kGlbxMdp3, {"2020-06-06T00:00", "2021-03-02T00:00"}, - {"MES.OPT", "EW.OPT"}, Schema::Tbbo, FeedMode::HistoricalStreaming, SType::Parent, - {}); + {"MES.OPT", "EW.OPT"}, Schema::Tbbo, SType::Parent, {}); ASSERT_DOUBLE_EQ(res, kResp); }