Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 1 addition & 1 deletion cmake/StandardSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmake/Utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion include/databento/dbn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/databento/detail/buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::size_t>(read_pos_ - buf_.get()) > (Capacity() / 2)) {
Expand Down
4 changes: 4 additions & 0 deletions include/databento/enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions include/databento/historical.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<PublisherDetail> MetadataListPublishers();
std::vector<std::string> MetadataListDatasets();
std::vector<std::string> MetadataListDatasets(const DateRange& date_range);
Expand Down Expand Up @@ -139,11 +139,11 @@ class Historical {
double MetadataGetCost(const std::string& dataset,
const DateTimeRange<UnixNanos>& datetime_range,
const std::vector<std::string>& 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<std::string>& datetime_range,
const std::vector<std::string>& symbols, Schema schema,
FeedMode mode, SType stype_in, std::uint64_t limit);
SType stype_in, std::uint64_t limit);

/*
* Symbology API
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.42.0
pkgver=0.43.0
pkgrel=1
pkgdesc="Official C++ client for Databento"
arch=('any')
Expand Down
12 changes: 12 additions & 0 deletions src/enums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,9 @@ const char* ToString(ErrorCode error_code) {
case ErrorCode::InternalError: {
return "internal_error";
}
case ErrorCode::Unset: {
return "unset";
}
default: {
return "Unknown";
}
Expand All @@ -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";
}
Expand Down Expand Up @@ -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<ErrorCode>", "str",
"unknown value '" + str + '\''};
}
Expand All @@ -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<SystemCode>", "str",
"unknown value '" + str + '\''};
}
Expand Down
12 changes: 4 additions & 8 deletions src/historical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,25 +665,23 @@ double Historical::MetadataGetCost(const std::string& dataset,
const std::vector<std::string>& symbols,
Schema schema) {
return this->MetadataGetCost(dataset, datetime_range, symbols, schema,
FeedMode::HistoricalStreaming, kDefaultSTypeIn, {});
kDefaultSTypeIn, {});
}
double Historical::MetadataGetCost(const std::string& dataset,
const DateTimeRange<std::string>& datetime_range,
const std::vector<std::string>& symbols,
Schema schema) {
return this->MetadataGetCost(dataset, datetime_range, symbols, schema,
FeedMode::HistoricalStreaming, kDefaultSTypeIn, {});
kDefaultSTypeIn, {});
}
double Historical::MetadataGetCost(const std::string& dataset,
const DateTimeRange<UnixNanos>& datetime_range,
const std::vector<std::string>& 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(&params, "end", datetime_range.end);
Expand All @@ -693,13 +691,11 @@ double Historical::MetadataGetCost(const std::string& dataset,
double Historical::MetadataGetCost(const std::string& dataset,
const DateTimeRange<std::string>& datetime_range,
const std::vector<std::string>& 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(&params, "end", datetime_range.end);
Expand Down
4 changes: 2 additions & 2 deletions tests/src/batch_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace databento::tests {
TEST(BatchTests, TestBatchJobToString) {
const BatchJob target{"aNiD",
const BatchJob target{"AN_ID",
"USER",
12.39,
dataset::kXnasItch,
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 2 additions & 4 deletions tests/src/historical_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", {}},
Expand Down Expand Up @@ -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"}},
Expand All @@ -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);
}

Expand Down
Loading