Skip to content

Commit

Permalink
VER: Release 0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen authored Aug 10, 2023
2 parents fa3e700 + 64e85e0 commit d82b35b
Show file tree
Hide file tree
Showing 19 changed files with 415 additions and 364 deletions.
25 changes: 24 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## 0.11.0 - 2023-08-10

#### Enhancements
- Added `raw_instrument_id` to definition schema
- Added `operator==` and `operator!=` implementations for `DatasetConditionDetail` and
`DatasetRange`

#### Breaking changes
- Changed `MetadataListPublishers` to return a `vector<PublisherDetail>`
- `MetadataListFields`:
- Changed return type to `vector<FieldDetail>`
- Made `encoding` and `schema` parameters required
- Removed `dataset` parameter
- `MetadataListUnitPrices`:
- Changed return type to `vector<UnitPricesForMode>`
- Made `dataset` parameter required
- Removed `mode` and `schema` parameters

#### Bug fixes
- Fixed installation of `nlohmann_json` when using bundled version
- Added missing `operator!=` implementations for `Metadata`, `MappingInterval`, and
`SymbolMapping`

## 0.10.0 - 2023-07-20

#### Enhancements
Expand Down Expand Up @@ -54,7 +77,7 @@

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

## 0.7.0 - 2023-04-28
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.14)
# Project details
#

project("databento" VERSION 0.10.0 LANGUAGES CXX)
project("databento" VERSION 0.11.0 LANGUAGES CXX)
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPERCASE)

#
Expand Down Expand Up @@ -122,6 +122,8 @@ if(${PROJECT_NAME_UPPERCASE}_USE_EXTERNAL_JSON)
find_package(nlohmann_json REQUIRED)
else()
set(json_version 3.11.2)
# Required to correctly install nlohmann_json
set(JSON_Install ON)
if(CMAKE_VERSION VERSION_LESS 3.24)
FetchContent_Declare(
json
Expand Down
128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[email protected].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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.

Please direct email feedback to [email protected] or [email protected].
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Your `CMakeLists.txt` should look something like the following:

```cmake
# CMakeLists.txt
cmake_minimum_required(VERSION 3.14)
project(databento_example)
include(FetchContent)
FetchContent_Declare(
Expand All @@ -27,23 +30,21 @@ FetchContent_Declare(
)
FetchContent_MakeAvailable(databento)
add_library(my_library)
target_link_libraries(my_library PRIVATE databento::databento)
add_executable(example main.cpp)
target_link_libraries(example PRIVATE databento::databento)
```

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

To install the library at the system level, build and install it with the following:
To install the library to `/usr`, build and install it with the following:

```sh
git clone https://github.com/databento/databento-cpp
cd databento-cpp
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX='/usr' \
-DDATABENTO_USE_EXTERNAL_JSON=ON \
-DDATABENTO_USE_EXTERNAL_HTTPLIB=ON
cmake --build build --target databento
-DCMAKE_INSTALL_PREFIX='/usr'
cmake --build build --target databento --parallel
cmake --install build
```

Expand All @@ -52,7 +53,7 @@ In your project's `CMakeLists.txt`, add the following:
```cmake
# CMakeLists.txt
find_package(databento REQUIRED)
target_link_libraries(your_target PRIVATE databento::databento)
target_link_libraries(example PRIVATE databento::databento)
```

### Dependencies
Expand Down Expand Up @@ -109,7 +110,7 @@ int main() {
return 0;
}
```
To run this program, replace `$YOUR_API_KEY` with an actual API key.
To run this program, set the `DATABENTO_API_KEY` environment variable with an actual API key.

### Historical

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

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

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

Additional example standalone executables are provided in the [examples](./examples) directory.
These examples can be compiled by enabling the cmake option `DATABENTO_ENABLE_EXAMPLES` with `-DDATABENTO_ENABLE_EXAMPLES=1` during the configure step.
Expand Down
41 changes: 7 additions & 34 deletions example/historical/metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ int main() {
const auto publishers = client.MetadataListPublishers();
std::cout << "Publishers:\n";
for (const auto& publisher : publishers) {
std::cout << "- " << publisher.first << ": " << publisher.second << '\n';
std::cout << "- " << publisher << '\n';
}
std::cout << '\n';

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

const auto fields = client.MetadataListFields(
kGlbxMdp3, databento::Encoding::Dbn, databento::Schema::Trades);
const auto fields = client.MetadataListFields(databento::Encoding::Dbn,
databento::Schema::Trades);
std::cout << "Fields:\n";
const auto& dbn_trades_fields = fields.at("GLBX.MDP3")
.at(databento::Encoding::Dbn)
.at(databento::Schema::Trades);
for (const auto& field_and_type : dbn_trades_fields) {
std::cout << "- " << field_and_type.first << ": " << field_and_type.second
<< '\n';
for (const auto& field_detail : fields) {
std::cout << "- " << field_detail << '\n';
}
std::cout << '\n';

Expand All @@ -54,8 +50,8 @@ int main() {
const auto all_unit_prices = client.MetadataListUnitPrices(kGlbxMdp3);
std::cout << "Unit prices:\n";
for (const auto& mode_and_prices : all_unit_prices) {
const auto* mode_str = ToString(mode_and_prices.first);
for (const auto& schema_and_price : mode_and_prices.second) {
const auto* mode_str = ToString(mode_and_prices.mode);
for (const auto& schema_and_price : mode_and_prices.unit_prices) {
std::cout << "- (" << mode_str << ", " << schema_and_price.first
<< "): " << schema_and_price.second << '\n';
}
Expand All @@ -67,29 +63,6 @@ int main() {
{"ESH1"}, databento::Schema::Mbo);
std::cout << "Record count: " << record_count << "\n\n";

const auto live_unit_prices =
client.MetadataListUnitPrices(kGlbxMdp3, databento::FeedMode::Live);
std::cout << "Unit prices (live):\n";
for (const auto& schema_and_price : live_unit_prices) {
std::cout << "- (" << schema_and_price.first
<< "): " << schema_and_price.second << '\n';
}
std::cout << '\n';

const auto trades_unit_prices =
client.MetadataListUnitPrices(kGlbxMdp3, databento::Schema::Trades);
std::cout << "Unit prices (trades):\n";
for (const auto& mode_and_price : trades_unit_prices) {
std::cout << "- (" << mode_and_price.first << "): " << mode_and_price.second
<< '\n';
}
std::cout << '\n';

const auto unit_price = client.MetadataListUnitPrices(
kGlbxMdp3, databento::FeedMode::Historical, databento::Schema::Trades);
std::cout << "Unit price (GLBX.MDP3, Historical, Trades): " << unit_price
<< "\n\n";

const std::size_t billable_size = client.MetadataGetBillableSize(
kGlbxMdp3, {"2020-12-28", "2020-12-29"}, {"ESH1"}, databento::Schema::Mbo,
databento::SType::RawSymbol, {});
Expand Down
9 changes: 9 additions & 0 deletions include/databento/dbn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,16 @@ inline bool operator==(const MappingInterval& lhs, const MappingInterval& rhs) {
return lhs.start_date == rhs.start_date && lhs.end_date == rhs.end_date &&
lhs.symbol == rhs.symbol;
}
inline bool operator!=(const MappingInterval& lhs, const MappingInterval& rhs) {
return !(lhs == rhs);
}

inline bool operator==(const SymbolMapping& lhs, const SymbolMapping& rhs) {
return lhs.raw_symbol == rhs.raw_symbol && lhs.intervals == rhs.intervals;
}
inline bool operator!=(const SymbolMapping& lhs, const SymbolMapping& rhs) {
return !(lhs == rhs);
}

inline bool operator==(const Metadata& lhs, const Metadata& rhs) {
return lhs.version == rhs.version && lhs.dataset == rhs.dataset &&
Expand All @@ -88,6 +94,9 @@ inline bool operator==(const Metadata& lhs, const Metadata& rhs) {
lhs.symbols == rhs.symbols && lhs.partial == rhs.partial &&
lhs.not_found == rhs.not_found && lhs.mappings == rhs.mappings;
}
inline bool operator!=(const Metadata& lhs, const Metadata& rhs) {
return !(lhs == rhs);
}

std::string ToString(const Metadata& metadata);
std::ostream& operator<<(std::ostream& stream, const Metadata& metadata);
Expand Down
3 changes: 3 additions & 0 deletions include/databento/detail/json_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ template <>
std::uint64_t ParseAt(const std::string& endpoint, const nlohmann::json& json,
const std::string& key);
template <>
std::uint16_t ParseAt(const std::string& endpoint, const nlohmann::json& json,
const std::string& key);
template <>
double ParseAt(const std::string& endpoint, const nlohmann::json& json,
const std::string& key);
template <>
Expand Down
Loading

0 comments on commit d82b35b

Please sign in to comment.