Skip to content

Commit b3be5d5

Browse files
authored
VER: Release 0.4.0
2 parents e4c09ae + 83303d1 commit b3be5d5

File tree

102 files changed

+2076
-1034
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+2076
-1034
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
cmake -S . -B build \
3131
-GNinja \
3232
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \
33+
-DDATABENTO_ENABLE_UNIT_TESTING=1 \
3334
-DDATABENTO_ENABLE_EXAMPLES=1 \
3435
-DDATABENTO_ENABLE_CLANG_TIDY=1
3536
- name: CMake build
@@ -51,6 +52,7 @@ jobs:
5152
run: |
5253
cmake -S . -B build \
5354
-GNinja \
55+
-DDATABENTO_ENABLE_UNIT_TESTING=1 \
5456
-DDATABENTO_ENABLE_EXAMPLES=1 \
5557
-DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3)
5658
- name: CMake build

CHANGELOG.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,41 @@
11
# Changelog
22

3+
## 0.4.0 - 2023-03-02
4+
- Renamed DBZ to DBN
5+
- Renamed `DbzParser` to `DbnDecoder`
6+
- Renamed `TimeseriesStream` to `TimeseriesGetRange`
7+
- Refactored rtypes
8+
- Introduced separate rtypes for each OHLCV schema
9+
- Added live gateway resolution
10+
- Added `SymbolMappingMsg` and `ErrorMsg` records
11+
- Improved API for `flags` record fields
12+
- Added `Action` and `Side` enums
13+
- Changed `kAllSymbols` representation
14+
- Fixed usage of as a system library
15+
- Removed `is_full_universe` and `is_example` fields from `BatchJob`
16+
- Disabled unit testing by default
17+
- Added `PKGBUILD` to demonstrate installation
18+
- Made `start_date` and `end_date` optional for
19+
`Historical::MetadataGetDatasetCondition`
20+
- Added `available_start_date` and `available_end_date` to
21+
`DatasetConditionInfo`
22+
323
## 0.3.0 - 2023-01-06
4-
- Add support for definition schema
5-
- Fix cancellation in `Historical::TimeseriesStream`
6-
- Fix race condition in `Historical::TimeseriesStream` exception handling
7-
- Fix gtest linker error on macOS
8-
- Add option for CMake to download gtest
9-
- Rename `TickMsg` to `MboMsg`
10-
- Change `flags` fields to unsigned
11-
- Update `Flag` enum
12-
- Standardize getter method names to pascal case
13-
- Rename `is_full_book` to `is_full_universe`
24+
- Added support for definition schema
25+
- Fixed cancellation in `Historical::TimeseriesStream`
26+
- Fixed race condition in `Historical::TimeseriesStream` exception handling
27+
- Fixed gtest linker error on macOS
28+
- Added option for CMake to download gtest
29+
- Renamed `TickMsg` to `MboMsg`
30+
- Changed `flags` fields to unsigned
31+
- Updated `Flag` enum
32+
- Standardized getter method names to pascal case
33+
- Renamed `is_full_book` to `is_full_universe`
1434

1535
## 0.2.0 - 2022-12-01
16-
- Add dataset condition endpoint
17-
- Improve Zstd CMake integration
18-
- Fix requesting all symbols for a dataset
36+
- Added dataset condition endpoint
37+
- Improved Zstd CMake integration
38+
- Fixed requesting all symbols for a dataset
1939

2040
## 0.1.0 - 2022-11-07
2141
- Initial release with support for historical data

CMakeLists.txt

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@ cmake_minimum_required(VERSION 3.14)
44
# Project details
55
#
66

7-
project("databento" VERSION 0.3.0 LANGUAGES CXX)
7+
project("databento" VERSION 0.4.0 LANGUAGES CXX)
88
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPERCASE)
99

10+
#
11+
# Main project check
12+
#
13+
14+
set(IS_MAIN_PROJECT OFF)
15+
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
16+
set(IS_MAIN_PROJECT ON)
17+
endif()
18+
1019
#
1120
# Set project options
1221
#
@@ -18,8 +27,13 @@ include(cmake/Utils.cmake)
1827
message(STATUS "Started CMake for ${PROJECT_NAME} v${PROJECT_VERSION}...\n")
1928

2029
if(NOT CMAKE_BUILD_TYPE)
21-
message(STATUS "Defaulting to Debug build")
22-
set(CMAKE_BUILD_TYPE "Debug")
30+
if(IS_MAIN_PROJECT)
31+
message(STATUS "Defaulting to Debug build")
32+
set(CMAKE_BUILD_TYPE "Debug")
33+
else()
34+
message(STATUS "Defaulting to RelWithDebInfo build")
35+
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
36+
endif()
2337
endif()
2438

2539
#
@@ -37,7 +51,7 @@ endif()
3751
include(TestBigEndian)
3852
test_big_endian(IS_BIG_ENDIAN)
3953
if(IS_BIG_ENDIAN)
40-
message(FATAL_ERROR "Big-endian platforms aren't supported because DBZ parsing assumes the data is little-endian and in native byte order.\n")
54+
message(FATAL_ERROR "Big-endian platforms aren't supported because DBN parsing assumes the data is little-endian and in native byte order.\n")
4155
endif()
4256

4357
#
@@ -203,12 +217,15 @@ add_clang_format_target()
203217
# Install library for easy downstream inclusion
204218
#
205219

220+
set(targets ${PROJECT_NAME})
221+
if(NOT ${PROJECT_NAME_UPPERCASE}_USE_EXTERNAL_JSON)
222+
list(APPEND targets nlohmann_json)
223+
endif()
224+
206225
include(GNUInstallDirs)
207226
install(
208227
TARGETS
209-
${PROJECT_NAME}
210-
# public dependency
211-
nlohmann_json
228+
${targets}
212229
EXPORT
213230
${PROJECT_NAME}Targets
214231
LIBRARY DESTINATION

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static constexpr auto kApiKey = "YOUR_API_KEY";
2222

2323
int main() {
2424
auto client = HistoricalBuilder{}.SetKey(kApiKey).Build();
25-
client.TimeseriesStream("GLBX.MDP3", "2022-06-10", "2022-06-11", {"ES"},
25+
client.TimeseriesGetRange("GLBX.MDP3", "2022-06-10", "2022-06-11", {"ES"},
2626
Schema::Trades, SType::Smart, SType::ProductId, {},
2727
{}, [](const Record& record) {
2828
const auto& trade_msg = record.Get<TradeMsg>();
@@ -71,14 +71,16 @@ git clone https://github.com/databento/databento-cpp
7171
cd databento-cpp
7272
cmake -S . -B build \
7373
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
74-
-DCMAKE_INSTALL_PREFIX='/usr'
74+
-DCMAKE_INSTALL_PREFIX='/usr' \
75+
-DDATABENTO_USE_EXTERNAL_JSON=ON \
76+
-DDATABENTO_USE_EXTERNAL_HTTPLIB=ON
7577
cmake --build build --target databento
7678
cmake --install build
7779
```
7880

7981
Then in your project's `CMakeLists.txt`, add the following:
8082
```cmake
81-
find_package(databento 0.1.0 REQUIRED)
83+
find_package(databento 0.4.0 REQUIRED)
8284
add_library(my_library)
8385
target_link_libraries(my_library PRIVATE databento::databento)
8486
```
@@ -87,10 +89,11 @@ target_link_libraries(my_library PRIVATE databento::databento)
8789

8890
The minimum C++ standard is C++11 and CMake 3.14.
8991
The library has the following dependencies:
90-
- [cpp-httplib (header only)](https://github.com/yhirose/cpp-httplib)
9192
- [OpenSSL](https://www.openssl.org/)
92-
- [nlohmann_json (header only)](https://github.com/nlohmann/json)
93+
- [Libcrypto](https://www.openssl.org/docs/man3.0/man7/crypto.html)
9394
- [Zstandard (zstd)](https://github.com/facebook/zstd)
95+
- [nlohmann_json (header-only)](https://github.com/nlohmann/json)
96+
- [cpp-httplib (header-only)](https://github.com/yhirose/cpp-httplib)
9497

9598
By default, cpp-httplib and nlohmann_json are downloaded by CMake as part of the build process.
9699
If you would like to use a local version of these libraries, enable the CMake flag
@@ -117,11 +120,19 @@ Tests are located in the `test` directory.
117120
They're written using [GoogleTest (gtest)](https://github.com/google/googletest).
118121
The test target is `databentoTests` and can be build and run with the following commands:
119122
```sh
120-
cmake -S . -B build # configure
123+
cmake -S . -B build -DDATABENTO_ENABLE_UNIT_TESTING=1 # configure
121124
cmake --build build --target databentoTests # build
122125
build/test/databentoTests # run
123126
```
124127

128+
By default, it's assumed google test is installed already, if instead you'd like CMake to
129+
download it for you, disable the `DATABENTO_USE_EXTERNAL_GTEST` flag:
130+
```sh
131+
cmake -S . -B build \
132+
-DDATABENTO_ENABLE_UNIT_TESTING=1 \
133+
-DDATABENTO_USE_EXTERNAL_GTEST=0
134+
```
135+
125136
### Formatting
126137

127138
databento-cpp uses [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) with Google's style.

cmake/SourcesAndHeaders.cmake

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ set(headers
22
include/databento/batch.hpp
33
include/databento/constants.hpp
44
include/databento/datetime.hpp
5-
include/databento/dbz.hpp
6-
include/databento/dbz_parser.hpp
5+
include/databento/dbn.hpp
6+
include/databento/dbn_decoder.hpp
77
include/databento/file_bento.hpp
88
include/databento/enums.hpp
99
include/databento/exceptions.hpp
10+
include/databento/flag_set.hpp
1011
include/databento/historical.hpp
12+
include/databento/ireadable.hpp
1113
include/databento/live.hpp
1214
include/databento/live_blocking.hpp
1315
include/databento/live_threaded.hpp
@@ -21,14 +23,15 @@ set(headers
2123
include/databento/detail/scoped_thread.hpp
2224
include/databento/detail/shared_channel.hpp
2325
include/databento/detail/tcp_client.hpp
26+
include/databento/detail/zstd_stream.hpp
2427
src/stream_op_helper.hpp
2528
)
2629

2730
set(sources
2831
src/batch.cpp
2932
src/datetime.cpp
30-
src/dbz.cpp
31-
src/dbz_parser.cpp
33+
src/dbn.cpp
34+
src/dbn_decoder.cpp
3235
src/enums.cpp
3336
src/exceptions.cpp
3437
src/file_bento.cpp
@@ -44,4 +47,5 @@ set(sources
4447
src/detail/scoped_fd.cpp
4548
src/detail/shared_channel.cpp
4649
src/detail/tcp_client.cpp
50+
src/detail/zstd_stream.cpp
4751
)

cmake/StandardSettings.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ endif()
2727
# Unit testing
2828
#
2929

30-
option(${PROJECT_NAME_UPPERCASE}_ENABLE_UNIT_TESTING "Enable unit tests for the projects (from the `test` subfolder)." ON)
30+
# Default to ON if main project, otherwise OFF
31+
option(${PROJECT_NAME_UPPERCASE}_ENABLE_UNIT_TESTING "Enable unit tests for the projects (from the `test` subfolder)." OFF)
3132
option(${PROJECT_NAME_UPPERCASE}_ENABLE_EXAMPLES "Enable building examples for the project." OFF)
3233

3334
#
@@ -49,9 +50,9 @@ option(${PROJECT_NAME_UPPERCASE}_ENABLE_CODE_COVERAGE "Enable code coverage thro
4950
#
5051

5152
# Generate compile_commands.json for clang based tools
52-
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
53+
set(CMAKE_EXPORT_COMPILE_COMMANDS ${IS_MAIN_PROJECT})
5354

54-
option(${PROJECT_NAME_UPPERCASE}_VERBOSE_OUTPUT "Enable verbose output, allowing for a better understanding of each step taken." ON)
55+
option(${PROJECT_NAME_UPPERCASE}_VERBOSE_OUTPUT "Enable verbose output, allowing for a better understanding of each step taken." ${IS_MAIN_PROJECT})
5556
option(${PROJECT_NAME_UPPERCASE}_GENERATE_EXPORT_HEADER "Create a `project_export.h` file containing all exported symbols." OFF)
5657

5758
# Export all symbols when building a shared library

example/historical/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ add_example_target(batch batch.cpp)
44
add_example_target(metadata metadata.cpp)
55
add_example_target(readme readme.cpp)
66
add_example_target(symbology-resolve symbology_resolve.cpp)
7-
add_example_target(timeseries-stream timeseries_stream.cpp)
8-
add_example_target(timeseries-stream-to-file timeseries_stream_to_file.cpp)
7+
add_example_target(timeseries-get-range timeseries_get_range.cpp)
8+
add_example_target(timeseries-get-range-to-file timeseries_get_range_to_file.cpp)

example/historical/metadata.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ int main() {
3232
std::cout << '\n';
3333

3434
const auto fields = client.MetadataListFields(
35-
kGlbxMdp3, databento::Encoding::Dbz, databento::Schema::Trades);
35+
kGlbxMdp3, databento::Encoding::Dbn, databento::Schema::Trades);
3636
std::cout << "Fields:\n";
37-
const auto& dbz_trades_fields = fields.at("GLBX.MDP3")
38-
.at(databento::Encoding::Dbz)
37+
const auto& dbn_trades_fields = fields.at("GLBX.MDP3")
38+
.at(databento::Encoding::Dbn)
3939
.at(databento::Schema::Trades);
40-
for (const auto& field_and_type : dbz_trades_fields) {
40+
for (const auto& field_and_type : dbn_trades_fields) {
4141
std::cout << "- " << field_and_type.first << ": " << field_and_type.second
4242
<< '\n';
4343
}

example/historical/readme.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ static constexpr auto kApiKey = "YOUR_API_KEY";
1010

1111
int main() {
1212
auto client = HistoricalBuilder{}.SetKey(kApiKey).Build();
13-
client.TimeseriesStream("GLBX.MDP3", "2022-06-10", "2022-06-11", {"ES"},
14-
Schema::Trades, SType::Smart, SType::ProductId, {},
15-
{}, [](const Record& record) {
16-
const auto& trade_msg = record.Get<TradeMsg>();
17-
std::cout << trade_msg << '\n';
18-
return KeepGoing::Continue;
19-
});
13+
client.TimeseriesGetRange("GLBX.MDP3", "2022-06-10", "2022-06-11", {"ES"},
14+
Schema::Trades, SType::Smart, SType::ProductId, {},
15+
{}, [](const Record& record) {
16+
const auto& trade_msg = record.Get<TradeMsg>();
17+
std::cout << trade_msg << '\n';
18+
return KeepGoing::Continue;
19+
});
2020
}
2121
// NOLINTEND(google-build-using-namespace)

example/historical/timeseries_stream.cpp renamed to example/historical/timeseries_get_range.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ int main() {
2323
const databento::UnixNanos start = DateToUnixNanos(2022, 10, 3);
2424
const databento::UnixNanos end = DateToUnixNanos(2022, 10, 4);
2525
const auto limit = 1000;
26-
client.TimeseriesStream(
26+
client.TimeseriesGetRange(
2727
databento::dataset::kGlbxMdp3, start, end, {"ESZ2"},
2828
databento::Schema::Trades, databento::SType::Native,
2929
databento::SType::ProductId, limit,

0 commit comments

Comments
 (0)