Skip to content

Commit d82b35b

Browse files
authored
VER: Release 0.11.0
2 parents fa3e700 + 64e85e0 commit d82b35b

File tree

19 files changed

+415
-364
lines changed

19 files changed

+415
-364
lines changed

CHANGELOG.md

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

3+
## 0.11.0 - 2023-08-10
4+
5+
#### Enhancements
6+
- Added `raw_instrument_id` to definition schema
7+
- Added `operator==` and `operator!=` implementations for `DatasetConditionDetail` and
8+
`DatasetRange`
9+
10+
#### Breaking changes
11+
- Changed `MetadataListPublishers` to return a `vector<PublisherDetail>`
12+
- `MetadataListFields`:
13+
- Changed return type to `vector<FieldDetail>`
14+
- Made `encoding` and `schema` parameters required
15+
- Removed `dataset` parameter
16+
- `MetadataListUnitPrices`:
17+
- Changed return type to `vector<UnitPricesForMode>`
18+
- Made `dataset` parameter required
19+
- Removed `mode` and `schema` parameters
20+
21+
#### Bug fixes
22+
- Fixed installation of `nlohmann_json` when using bundled version
23+
- Added missing `operator!=` implementations for `Metadata`, `MappingInterval`, and
24+
`SymbolMapping`
25+
326
## 0.10.0 - 2023-07-20
427

528
#### Enhancements
@@ -54,7 +77,7 @@
5477

5578
#### Breaking changes
5679
- Renamed `booklevel` MBP field to `levels` for brevity and consistent naming
57-
- Removed `open_interest_qty` and `cleared_volume` fields from definitions schema
80+
- Removed `open_interest_qty` and `cleared_volume` fields from definition schema
5881
that were always unset
5982

6083
## 0.7.0 - 2023-04-28

CMakeLists.txt

Lines changed: 3 additions & 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.10.0 LANGUAGES CXX)
7+
project("databento" VERSION 0.11.0 LANGUAGES CXX)
88
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPERCASE)
99

1010
#
@@ -122,6 +122,8 @@ if(${PROJECT_NAME_UPPERCASE}_USE_EXTERNAL_JSON)
122122
find_package(nlohmann_json REQUIRED)
123123
else()
124124
set(json_version 3.11.2)
125+
# Required to correctly install nlohmann_json
126+
set(JSON_Install ON)
125127
if(CMAKE_VERSION VERSION_LESS 3.24)
126128
FetchContent_Declare(
127129
json

CODE_OF_CONDUCT.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity
10+
and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
* Demonstrating empathy and kindness toward other people
21+
* Being respectful of differing opinions, viewpoints, and experiences
22+
* Giving and gracefully accepting constructive feedback
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the
26+
overall community
27+
28+
Examples of unacceptable behavior include:
29+
30+
* The use of sexualized language or imagery, and sexual attention or
31+
advances of any kind
32+
* Trolling, insulting or derogatory comments, and personal or political attacks
33+
* Public or private harassment
34+
* Publishing others' private information, such as a physical or email
35+
address, without their explicit permission
36+
* Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
64+
All complaints will be reviewed and investigated promptly and fairly.
65+
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
68+
69+
## Enforcement Guidelines
70+
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
73+
74+
### 1. Correction
75+
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
78+
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
82+
83+
### 2. Warning
84+
85+
**Community Impact**: A violation through a single incident or series
86+
of actions.
87+
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or
93+
permanent ban.
94+
95+
### 3. Temporary Ban
96+
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
99+
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
105+
106+
### 4. Permanent Ban
107+
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
111+
112+
**Consequence**: A permanent ban from any sort of public interaction within
113+
the community.
114+
115+
## Attribution
116+
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.0, available at
119+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120+
121+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
122+
enforcement ladder](https://github.com/mozilla/diversity).
123+
124+
[homepage]: https://www.contributor-covenant.org
125+
126+
For answers to common questions about this code of conduct, see the FAQ at
127+
https://www.contributor-covenant.org/faq. Translations are available at
128+
https://www.contributor-covenant.org/translations.

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
We welcome feedback through discussions and issues on GitHub, however we don't currently accept pull requests due to the open-source repository being a downstream mirror of our internal codebase.
2+
3+
Please direct email feedback to [email protected] or [email protected].

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ Your `CMakeLists.txt` should look something like the following:
1818

1919
```cmake
2020
# CMakeLists.txt
21+
cmake_minimum_required(VERSION 3.14)
22+
23+
project(databento_example)
2124
include(FetchContent)
2225
2326
FetchContent_Declare(
@@ -27,23 +30,21 @@ FetchContent_Declare(
2730
)
2831
FetchContent_MakeAvailable(databento)
2932
30-
add_library(my_library)
31-
target_link_libraries(my_library PRIVATE databento::databento)
33+
add_executable(example main.cpp)
34+
target_link_libraries(example PRIVATE databento::databento)
3235
```
3336

3437
Alternatively, you can clone the source code from GitHub [here](https://github.com/databento/databento-cpp).
3538

36-
To install the library at the system level, build and install it with the following:
39+
To install the library to `/usr`, build and install it with the following:
3740

3841
```sh
3942
git clone https://github.com/databento/databento-cpp
4043
cd databento-cpp
4144
cmake -S . -B build \
4245
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
43-
-DCMAKE_INSTALL_PREFIX='/usr' \
44-
-DDATABENTO_USE_EXTERNAL_JSON=ON \
45-
-DDATABENTO_USE_EXTERNAL_HTTPLIB=ON
46-
cmake --build build --target databento
46+
-DCMAKE_INSTALL_PREFIX='/usr'
47+
cmake --build build --target databento --parallel
4748
cmake --install build
4849
```
4950

@@ -52,7 +53,7 @@ In your project's `CMakeLists.txt`, add the following:
5253
```cmake
5354
# CMakeLists.txt
5455
find_package(databento REQUIRED)
55-
target_link_libraries(your_target PRIVATE databento::databento)
56+
target_link_libraries(example PRIVATE databento::databento)
5657
```
5758

5859
### Dependencies
@@ -109,7 +110,7 @@ int main() {
109110
return 0;
110111
}
111112
```
112-
To run this program, replace `$YOUR_API_KEY` with an actual API key.
113+
To run this program, set the `DATABENTO_API_KEY` environment variable with an actual API key.
113114

114115
### Historical
115116

@@ -123,7 +124,7 @@ Here is a simple program that fetches 10 minutes worth of historical trades for
123124
using namespace databento;
124125

125126
int main() {
126-
auto client = HistoricalBuilder{}.SetKey("$YOUR_API_KEY").Build();
127+
auto client = HistoricalBuilder{}.SetKeyFromEnv().Build();
127128
auto print_trades = [](const Record& record) {
128129
const auto& trade_msg = record.Get<TradeMsg>();
129130
std::cout << trade_msg << '\n';
@@ -136,7 +137,7 @@ int main() {
136137
}
137138
```
138139

139-
To run this program, replace `$YOUR_API_KEY` with an actual API key.
140+
To run this program, set the `DATABENTO_API_KEY` environment variable with an actual API key.
140141

141142
Additional example standalone executables are provided in the [examples](./examples) directory.
142143
These examples can be compiled by enabling the cmake option `DATABENTO_ENABLE_EXAMPLES` with `-DDATABENTO_ENABLE_EXAMPLES=1` during the configure step.

example/historical/metadata.cpp

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int main() {
1313
const auto publishers = client.MetadataListPublishers();
1414
std::cout << "Publishers:\n";
1515
for (const auto& publisher : publishers) {
16-
std::cout << "- " << publisher.first << ": " << publisher.second << '\n';
16+
std::cout << "- " << publisher << '\n';
1717
}
1818
std::cout << '\n';
1919

@@ -31,15 +31,11 @@ int main() {
3131
}
3232
std::cout << '\n';
3333

34-
const auto fields = client.MetadataListFields(
35-
kGlbxMdp3, databento::Encoding::Dbn, databento::Schema::Trades);
34+
const auto fields = client.MetadataListFields(databento::Encoding::Dbn,
35+
databento::Schema::Trades);
3636
std::cout << "Fields:\n";
37-
const auto& dbn_trades_fields = fields.at("GLBX.MDP3")
38-
.at(databento::Encoding::Dbn)
39-
.at(databento::Schema::Trades);
40-
for (const auto& field_and_type : dbn_trades_fields) {
41-
std::cout << "- " << field_and_type.first << ": " << field_and_type.second
42-
<< '\n';
37+
for (const auto& field_detail : fields) {
38+
std::cout << "- " << field_detail << '\n';
4339
}
4440
std::cout << '\n';
4541

@@ -54,8 +50,8 @@ int main() {
5450
const auto all_unit_prices = client.MetadataListUnitPrices(kGlbxMdp3);
5551
std::cout << "Unit prices:\n";
5652
for (const auto& mode_and_prices : all_unit_prices) {
57-
const auto* mode_str = ToString(mode_and_prices.first);
58-
for (const auto& schema_and_price : mode_and_prices.second) {
53+
const auto* mode_str = ToString(mode_and_prices.mode);
54+
for (const auto& schema_and_price : mode_and_prices.unit_prices) {
5955
std::cout << "- (" << mode_str << ", " << schema_and_price.first
6056
<< "): " << schema_and_price.second << '\n';
6157
}
@@ -67,29 +63,6 @@ int main() {
6763
{"ESH1"}, databento::Schema::Mbo);
6864
std::cout << "Record count: " << record_count << "\n\n";
6965

70-
const auto live_unit_prices =
71-
client.MetadataListUnitPrices(kGlbxMdp3, databento::FeedMode::Live);
72-
std::cout << "Unit prices (live):\n";
73-
for (const auto& schema_and_price : live_unit_prices) {
74-
std::cout << "- (" << schema_and_price.first
75-
<< "): " << schema_and_price.second << '\n';
76-
}
77-
std::cout << '\n';
78-
79-
const auto trades_unit_prices =
80-
client.MetadataListUnitPrices(kGlbxMdp3, databento::Schema::Trades);
81-
std::cout << "Unit prices (trades):\n";
82-
for (const auto& mode_and_price : trades_unit_prices) {
83-
std::cout << "- (" << mode_and_price.first << "): " << mode_and_price.second
84-
<< '\n';
85-
}
86-
std::cout << '\n';
87-
88-
const auto unit_price = client.MetadataListUnitPrices(
89-
kGlbxMdp3, databento::FeedMode::Historical, databento::Schema::Trades);
90-
std::cout << "Unit price (GLBX.MDP3, Historical, Trades): " << unit_price
91-
<< "\n\n";
92-
9366
const std::size_t billable_size = client.MetadataGetBillableSize(
9467
kGlbxMdp3, {"2020-12-28", "2020-12-29"}, {"ESH1"}, databento::Schema::Mbo,
9568
databento::SType::RawSymbol, {});

include/databento/dbn.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,16 @@ inline bool operator==(const MappingInterval& lhs, const MappingInterval& rhs) {
7171
return lhs.start_date == rhs.start_date && lhs.end_date == rhs.end_date &&
7272
lhs.symbol == rhs.symbol;
7373
}
74+
inline bool operator!=(const MappingInterval& lhs, const MappingInterval& rhs) {
75+
return !(lhs == rhs);
76+
}
7477

7578
inline bool operator==(const SymbolMapping& lhs, const SymbolMapping& rhs) {
7679
return lhs.raw_symbol == rhs.raw_symbol && lhs.intervals == rhs.intervals;
7780
}
81+
inline bool operator!=(const SymbolMapping& lhs, const SymbolMapping& rhs) {
82+
return !(lhs == rhs);
83+
}
7884

7985
inline bool operator==(const Metadata& lhs, const Metadata& rhs) {
8086
return lhs.version == rhs.version && lhs.dataset == rhs.dataset &&
@@ -88,6 +94,9 @@ inline bool operator==(const Metadata& lhs, const Metadata& rhs) {
8894
lhs.symbols == rhs.symbols && lhs.partial == rhs.partial &&
8995
lhs.not_found == rhs.not_found && lhs.mappings == rhs.mappings;
9096
}
97+
inline bool operator!=(const Metadata& lhs, const Metadata& rhs) {
98+
return !(lhs == rhs);
99+
}
91100

92101
std::string ToString(const Metadata& metadata);
93102
std::ostream& operator<<(std::ostream& stream, const Metadata& metadata);

include/databento/detail/json_helpers.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ template <>
8080
std::uint64_t ParseAt(const std::string& endpoint, const nlohmann::json& json,
8181
const std::string& key);
8282
template <>
83+
std::uint16_t ParseAt(const std::string& endpoint, const nlohmann::json& json,
84+
const std::string& key);
85+
template <>
8386
double ParseAt(const std::string& endpoint, const nlohmann::json& json,
8487
const std::string& key);
8588
template <>

0 commit comments

Comments
 (0)