Skip to content

Commit c147170

Browse files
authored
VER: Release 0.5.0
2 parents b3be5d5 + 389e520 commit c147170

20 files changed

+202
-286
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.5.0 - 2023-03-13
4+
- Added `Historical::MetadataGetDatasetRange`
5+
- Changed `MetadataGetDatasetCondition` to return `vector<DatasetConditionDetail>`
6+
- Removed `MetadataListCompressions` (redundant with docs)
7+
- Removed `MetadataListEncodings` (redundant with docs)
8+
- Removed optional `start` and `end` params from `MetadataListSchemas` (redundant)
9+
- Renamed `FileBento` to `DbnFileStore`
10+
311
## 0.4.0 - 2023-03-02
412
- Renamed DBZ to DBN
513
- Renamed `DbzParser` to `DbnDecoder`
@@ -33,7 +41,7 @@
3341
- Renamed `is_full_book` to `is_full_universe`
3442

3543
## 0.2.0 - 2022-12-01
36-
- Added dataset condition endpoint
44+
- Added `Historical::MetadataGetDatasetCondition`
3745
- Improved Zstd CMake integration
3846
- Fixed requesting all symbols for a dataset
3947

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
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.4.0 LANGUAGES CXX)
7+
project("databento" VERSION 0.5.0 LANGUAGES CXX)
88
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPERCASE)
99

1010
#

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# databento-cpp
22

33
[![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)
4-
![license](https://img.shields.io/github/license/databento/databento-cpp?color=blue)
4+
[![license](https://img.shields.io/github/license/databento/databento-cpp?color=blue)](./LICENSE)
55

66
The official C++ client library for [Databento](https://databento.com).
77
The client supports both streaming live and historical data through similar interfaces.
@@ -80,7 +80,7 @@ cmake --install build
8080

8181
Then in your project's `CMakeLists.txt`, add the following:
8282
```cmake
83-
find_package(databento 0.4.0 REQUIRED)
83+
find_package(databento 0.5.0 REQUIRED)
8484
add_library(my_library)
8585
target_link_libraries(my_library PRIVATE databento::databento)
8686
```
@@ -92,10 +92,10 @@ The library has the following dependencies:
9292
- [OpenSSL](https://www.openssl.org/)
9393
- [Libcrypto](https://www.openssl.org/docs/man3.0/man7/crypto.html)
9494
- [Zstandard (zstd)](https://github.com/facebook/zstd)
95-
- [nlohmann_json (header-only)](https://github.com/nlohmann/json)
95+
- [nlohmann\_json (header-only)](https://github.com/nlohmann/json)
9696
- [cpp-httplib (header-only)](https://github.com/yhirose/cpp-httplib)
9797

98-
By default, cpp-httplib and nlohmann_json are downloaded by CMake as part of the build process.
98+
By default, cpp-httplib and nlohmann\_json are downloaded by CMake as part of the build process.
9999
If you would like to use a local version of these libraries, enable the CMake flag
100100
`DATABENTO_ENABLE_EXTERNAL_HTTPLIB` or `DATABENTO_ENABLE_EXTERNAL_JSON`.
101101

cmake/SourcesAndHeaders.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set(headers
44
include/databento/datetime.hpp
55
include/databento/dbn.hpp
66
include/databento/dbn_decoder.hpp
7-
include/databento/file_bento.hpp
7+
include/databento/dbn_file_store.hpp
88
include/databento/enums.hpp
99
include/databento/exceptions.hpp
1010
include/databento/flag_set.hpp
@@ -34,7 +34,7 @@ set(sources
3434
src/dbn_decoder.cpp
3535
src/enums.cpp
3636
src/exceptions.cpp
37-
src/file_bento.cpp
37+
src/dbn_file_store.cpp
3838
src/historical.cpp
3939
src/live.cpp
4040
src/live_blocking.cpp

example/historical/metadata.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,11 @@ int main() {
4343
}
4444
std::cout << '\n';
4545

46-
const auto encodings = client.MetadataListEncodings();
47-
std::cout << "Encodings:\n";
48-
for (const auto encoding : encodings) {
49-
std::cout << "- " << encoding << '\n';
50-
}
51-
std::cout << '\n';
52-
53-
const auto dataset_condition = client.MetadataGetDatasetCondition(
46+
const auto dataset_conditions = client.MetadataGetDatasetCondition(
5447
"GLBX.MDP3", "2019-06-01", "2019-08-01");
55-
std::cout << dataset_condition << "\n\n";
56-
57-
const auto compressions = client.MetadataListCompressions();
58-
std::cout << "Compressions:\n";
59-
for (const auto compression : compressions) {
60-
std::cout << "- " << compression << '\n';
48+
std::cout << "Conditions:\n";
49+
for (const auto& dataset_condition : dataset_conditions) {
50+
std::cout << "- " << dataset_condition << "\n";
6151
}
6252
std::cout << '\n';
6353

example/historical/timeseries_get_range_to_file.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55

66
#include "databento/constants.hpp"
77
#include "databento/datetime.hpp"
8+
#include "databento/dbn_file_store.hpp"
89
#include "databento/enums.hpp"
9-
#include "databento/file_bento.hpp"
1010
#include "databento/historical.hpp"
1111
#include "databento/record.hpp"
1212

1313
int main() {
1414
auto client = databento::HistoricalBuilder{}.SetKeyFromEnv().Build();
1515
const auto limit = 1000;
16-
databento::FileBento file_bento = client.TimeseriesGetRangeToFile(
16+
databento::DbnFileStore dbn_file_store = client.TimeseriesGetRangeToFile(
1717
databento::dataset::kGlbxMdp3, "2022-10-03T00:00", "2022-10-04T00:00",
1818
{"ESZ2"}, databento::Schema::Ohlcv1M, databento::SType::Native,
1919
databento::SType::ProductId, limit,
2020
"ESZ2-ohlcv1m-20201003-20201004.dbn.zst");
21-
file_bento.Replay([](const databento::Record record) {
21+
dbn_file_store.Replay([](const databento::Record record) {
2222
const auto& ohlcv_bar = record.Get<databento::OhlcvMsg>();
2323
std::cout << ohlcv_bar << '\n';
2424
return databento::KeepGoing::Continue;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
namespace databento {
1111
// A reader for DBN files.
12-
class FileBento {
12+
class DbnFileStore {
1313
public:
14-
explicit FileBento(const std::string& file_path);
14+
explicit DbnFileStore(const std::string& file_path);
1515

1616
void Replay(const MetadataCallback& metadata_callback,
1717
const RecordCallback& record_callback);

include/databento/historical.hpp

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
#include <string>
77
#include <vector>
88

9-
#include "databento/batch.hpp" // BatchJob
10-
#include "databento/datetime.hpp" // UnixNanos
9+
#include "databento/batch.hpp" // BatchJob
10+
#include "databento/datetime.hpp" // UnixNanos
11+
#include "databento/dbn_file_store.hpp"
1112
#include "databento/detail/http_client.hpp" // HttpClient
1213
#include "databento/enums.hpp" // BatchState, Delivery, DurationInterval, Packaging, Schema, SType
13-
#include "databento/file_bento.hpp"
14-
#include "databento/metadata.hpp" // DatasetConditionInfo, FieldsByDatasetEncodingAndSchema, PriceByFeedMode, PriceByFeedModeAndSchema, PriceBySchema
14+
#include "databento/metadata.hpp" // DatasetConditionDetail, DatasetRange, FieldsByDatasetEncodingAndSchema, PriceByFeedMode, PriceByFeedModeAndSchema, PriceBySchema
1515
#include "databento/symbology.hpp" // SymbologyResolution
1616
#include "databento/timeseries.hpp" // KeepGoing, MetadataCallback, RecordCallback
1717

@@ -76,27 +76,24 @@ class Historical {
7676
std::vector<std::string> MetadataListDatasets(const std::string& start_date,
7777
const std::string& end_date);
7878
std::vector<Schema> MetadataListSchemas(const std::string& dataset);
79-
std::vector<Schema> MetadataListSchemas(const std::string& dataset,
80-
const std::string& start_date,
81-
const std::string& end_date);
8279
FieldsByDatasetEncodingAndSchema MetadataListFields();
8380
FieldsByDatasetEncodingAndSchema MetadataListFields(
8481
const std::string& dataset);
8582
FieldsByDatasetEncodingAndSchema MetadataListFields(
8683
const std::string& dataset, Encoding encoding, Schema schema);
87-
std::vector<Encoding> MetadataListEncodings();
88-
std::vector<Compression> MetadataListCompressions();
8984
PriceByFeedModeAndSchema MetadataListUnitPrices(const std::string& dataset);
9085
PriceBySchema MetadataListUnitPrices(const std::string& dataset,
9186
FeedMode mode);
9287
PriceByFeedMode MetadataListUnitPrices(const std::string& dataset,
9388
Schema schema);
9489
double MetadataListUnitPrices(const std::string& dataset, FeedMode mode,
9590
Schema schema);
96-
DatasetConditionInfo MetadataGetDatasetCondition(const std::string& dataset);
97-
DatasetConditionInfo MetadataGetDatasetCondition(
91+
std::vector<DatasetConditionDetail> MetadataGetDatasetCondition(
92+
const std::string& dataset);
93+
std::vector<DatasetConditionDetail> MetadataGetDatasetCondition(
9894
const std::string& dataset, const std::string& start_date,
9995
const std::string& end_date);
96+
DatasetRange MetadataGetDatasetRange(const std::string& dataset);
10097
std::size_t MetadataGetRecordCount(const std::string& dataset,
10198
UnixNanos start, UnixNanos end,
10299
const std::vector<std::string>& symbols,
@@ -208,42 +205,43 @@ class Historical {
208205
std::size_t limit,
209206
const MetadataCallback& metadata_callback,
210207
const RecordCallback& record_callback);
211-
// Stream historical market data to a file at `path`. Returns a `FileBento`
208+
// Stream historical market data to a file at `path`. Returns a `DbnFileStore`
212209
// object for replaying the data in `file_path`.
213210
//
214211
// If a file at `file_path` already exists, it will be overwritten.
215-
FileBento TimeseriesGetRangeToFile(const std::string& dataset,
216-
UnixNanos start, UnixNanos end,
217-
const std::vector<std::string>& symbols,
218-
Schema schema,
219-
const std::string& file_path);
220-
FileBento TimeseriesGetRangeToFile(const std::string& dataset,
221-
const std::string& start,
222-
const std::string& end,
223-
const std::vector<std::string>& symbols,
224-
Schema schema,
225-
const std::string& file_path);
226-
FileBento TimeseriesGetRangeToFile(const std::string& dataset,
227-
UnixNanos start, UnixNanos end,
228-
const std::vector<std::string>& symbols,
229-
Schema schema, SType stype_in,
230-
SType stype_out, std::size_t limit,
231-
const std::string& file_path);
232-
FileBento TimeseriesGetRangeToFile(const std::string& dataset,
233-
const std::string& start,
234-
const std::string& end,
235-
const std::vector<std::string>& symbols,
236-
Schema schema, SType stype_in,
237-
SType stype_out, std::size_t limit,
238-
const std::string& file_path);
212+
DbnFileStore TimeseriesGetRangeToFile(const std::string& dataset,
213+
UnixNanos start, UnixNanos end,
214+
const std::vector<std::string>& symbols,
215+
Schema schema,
216+
const std::string& file_path);
217+
DbnFileStore TimeseriesGetRangeToFile(const std::string& dataset,
218+
const std::string& start,
219+
const std::string& end,
220+
const std::vector<std::string>& symbols,
221+
Schema schema,
222+
const std::string& file_path);
223+
DbnFileStore TimeseriesGetRangeToFile(const std::string& dataset,
224+
UnixNanos start, UnixNanos end,
225+
const std::vector<std::string>& symbols,
226+
Schema schema, SType stype_in,
227+
SType stype_out, std::size_t limit,
228+
const std::string& file_path);
229+
DbnFileStore TimeseriesGetRangeToFile(const std::string& dataset,
230+
const std::string& start,
231+
const std::string& end,
232+
const std::vector<std::string>& symbols,
233+
Schema schema, SType stype_in,
234+
SType stype_out, std::size_t limit,
235+
const std::string& file_path);
239236

240237
private:
241238
using HttplibParams = std::multimap<std::string, std::string>;
242239

243240
BatchJob BatchSubmitJob(const HttplibParams& params);
244241
void DownloadFile(const std::string& url, const std::string& output_path);
245242
std::vector<BatchJob> BatchListJobs(const HttplibParams& params);
246-
DatasetConditionInfo MetadataGetDatasetCondition(const HttplibParams& params);
243+
std::vector<DatasetConditionDetail> MetadataGetDatasetCondition(
244+
const HttplibParams& params);
247245
std::size_t MetadataGetRecordCount(const HttplibParams& params);
248246
std::size_t MetadataGetBillableSize(const HttplibParams& params);
249247
double MetadataGetCost(const HttplibParams& params);
@@ -252,8 +250,8 @@ class Historical {
252250
void TimeseriesGetRange(const HttplibParams& params,
253251
const MetadataCallback& metadata_callback,
254252
const RecordCallback& record_callback);
255-
FileBento TimeseriesGetRangeToFile(const HttplibParams& params,
256-
const std::string& file_path);
253+
DbnFileStore TimeseriesGetRangeToFile(const HttplibParams& params,
254+
const std::string& file_path);
257255

258256
const std::string key_;
259257
const std::string gateway_;

include/databento/metadata.hpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,15 @@ struct DatasetConditionDetail {
2323
DatasetCondition condition;
2424
};
2525

26-
struct DatasetConditionInfo {
27-
// Overall condition for the date range.
28-
DatasetCondition condition;
29-
// The dataset condition by date.
30-
std::vector<DatasetConditionDetail> details;
31-
std::string adjusted_start_date;
32-
std::string adjusted_end_date;
33-
std::string available_start_date;
34-
std::string available_end_date;
26+
struct DatasetRange {
27+
std::string start_date;
28+
std::string end_date;
3529
};
3630

3731
std::string ToString(const DatasetConditionDetail& condition_detail);
3832
std::ostream& operator<<(std::ostream& stream,
3933
const DatasetConditionDetail& condition_detail);
40-
std::string ToString(const DatasetConditionInfo& condition);
34+
std::string ToString(const DatasetRange& dataset_range);
4135
std::ostream& operator<<(std::ostream& stream,
42-
const DatasetConditionInfo& condition);
36+
const DatasetRange& dataset_range);
4337
} // namespace databento

include/databento/record.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct RecordHeader {
1919
RType rtype;
2020
// The publisher ID assigned by Databento.
2121
std::uint16_t publisher_id;
22-
// The product ID assigned by the venue.
22+
// The numeric product ID assigned to the instrument.
2323
std::uint32_t product_id;
2424
// The exchange timestamp in UNIX epoch nanoseconds.
2525
UnixNanos ts_event;

0 commit comments

Comments
 (0)