Skip to content

Commit

Permalink
VER: Release 0.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
threecgreen authored Jun 4, 2024
2 parents 6ced9b0 + 58cd635 commit 4b51f62
Show file tree
Hide file tree
Showing 22 changed files with 411 additions and 159 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:
sudo apt-get install libpcre3 libpcre3-dev libzstd-dev ninja-build
- name: Install cppcheck
run: |
git clone https://github.com/danmar/cppcheck.git
git clone https://github.com/danmar/cppcheck.git --branch 2.14.1
cd cppcheck
cmake -S. -B build \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_MATCHCOMPILER=On \
-DUSE_MATCHCOMPILER=ON \
-DHAVE_RULES=ON
cmake --build build --config Release
cmake --build build --config Release --parallel
sudo cmake --install build --prefix /usr
- name: Install gtest
uses: MarkusJx/[email protected]
Expand Down Expand Up @@ -94,6 +94,6 @@ jobs:
-DVCPKG_BUILD_TYPE=debug `
-DDATABENTO_USE_EXTERNAL_GTEST=0
- name: CMake build
run: cmake --build build --parallel 10
run: cmake --build build --parallel
- name: Unit tests
run: cd build && ctest --verbose --exclude-regex cmake
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## 0.19.0 - 2024-06-04

### Enhancements
- Added configurable `heartbeat_interval` parameter for live clients that determines the
timeout before heartbeat `SystemMsg` records will be sent. It can be configured via
the `SetHeartbeatInterval` method of the `LiveBuilder`
- Added `SetAddress` method to `LiveBuilder` for configuring a custom gateway address
without using the constructor directly
- Added new `UncrossingPrice` `StatType` variant
- Added new publisher values for `XNAS.BASIC`
- Added `SetDataset(Dataset)` overload to `LiveBuilder`
- Added new off-market publisher values for `IFEU.IMPACT` and `NDEX.IMPACT`

### Breaking changes
- Added `heartbeat_interval` parameter to the `Live` constructors
- Removed `start_date` and `end_date` fields from `DatasetRange` struct
in favor of `start` and `end`
- Removed live `Subscribe` method overloads with `use_snapshot`
parameter in favor of separate `SubscribeWithSnapshot` method

### Bug fixes
- Fixed overloading of live `Subscribe` methods
- Fixed live subscribing with default-constructed `UnixNanos`
- Fixed descriptions for `FINN` and `FINY` publishers.

## 0.18.1 - 2024-05-22

### Enhancements
Expand Down
2 changes: 1 addition & 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.18.1 LANGUAGES CXX)
project("databento" VERSION 0.19.0 LANGUAGES CXX)
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPERCASE)

#
Expand Down
8 changes: 8 additions & 0 deletions include/databento/enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ namespace stat_type {
// The type of statistic contained in a StatMsg.
enum StatType : std::uint16_t {
// The price of the first trade of an instrument. `price` will be set.
// `quantity` will be set when provided by the venue.
OpeningPrice = 1,
// The probable price of the first trade of an instrument published during
// pre-open. Both `price` and `quantity` will be set.
Expand Down Expand Up @@ -265,6 +266,7 @@ enum StatType : std::uint16_t {
// be set.
FixingPrice = 10,
// The last trade price during a trading session. `price` will be set.
// `quantity` will be set when provided by the venue.
ClosePrice = 11,
// The change in price from the close price of the previous trading session to
// the most recent trading session. `price` will be set.
Expand All @@ -279,6 +281,12 @@ enum StatType : std::uint16_t {
// The option delta associated with the settlement price. `price` will be set
// with the standard precision.
Delta = 15,
// The auction uncrossing price. This is used for auctions that are neither
// the
// official opening auction nor the official closing auction. `price` will be
// set. `quantity` will be set when provided by the venue.
UncrossingPrice = 16,

};
} // namespace stat_type
using stat_type::StatType;
Expand Down
10 changes: 10 additions & 0 deletions include/databento/live.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#pragma once

#include <chrono>
#include <string>

#include "databento/enums.hpp" // VersionUpgradePolicy
#include "databento/live_blocking.hpp"
#include "databento/live_threaded.hpp"
#include "databento/publishers.hpp"

namespace databento {
class ILogReceiver;
Expand All @@ -22,13 +24,18 @@ class LiveBuilder {
LiveBuilder& SetKeyFromEnv();
LiveBuilder& SetKey(std::string key);
LiveBuilder& SetDataset(std::string dataset);
LiveBuilder& SetDataset(Dataset dataset);
// Whether to append the gateway send timestamp after each DBN message.
LiveBuilder& SetSendTsOut(bool send_ts_out);
// Set the version upgrade policy for when receiving DBN data from a prior
// version. Defaults to upgrading to DBNv2 (if not already).
LiveBuilder& SetUpgradePolicy(VersionUpgradePolicy upgrade_policy);
// Sets the receiver of the logs to be used by the client.
LiveBuilder& SetLogReceiver(ILogReceiver* log_receiver);
// Overrides the heartbeat interval.
LiveBuilder& SetHeartbeatInterval(std::chrono::seconds heartbeat_interval);
// Overrides the gateway and port. This is an advanced method.
LiveBuilder& SetAddress(std::string gateway, std::uint16_t port);
// Attempts to construct an instance of a blocking live client or throws an
// exception.
LiveBlocking BuildBlocking();
Expand All @@ -40,9 +47,12 @@ class LiveBuilder {
void Validate();

ILogReceiver* log_receiver_{};
std::string gateway_{};
std::uint16_t port_{};
std::string key_;
std::string dataset_;
bool send_ts_out_{false};
VersionUpgradePolicy upgrade_policy_{VersionUpgradePolicy::Upgrade};
std::chrono::seconds heartbeat_interval_{};
};
} // namespace databento
17 changes: 13 additions & 4 deletions include/databento/live_blocking.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <chrono> // milliseconds
#include <cstdint>
#include <string>
#include <utility> // pair
#include <vector>

#include "databento/datetime.hpp" // UnixNanos
Expand All @@ -22,10 +23,12 @@ class ILogReceiver;
class LiveBlocking {
public:
LiveBlocking(ILogReceiver* log_receiver, std::string key, std::string dataset,
bool send_ts_out, VersionUpgradePolicy upgrade_policy);
bool send_ts_out, VersionUpgradePolicy upgrade_policy,
std::chrono::seconds heartbeat_interval);
LiveBlocking(ILogReceiver* log_receiver, std::string key, std::string dataset,
std::string gateway, std::uint16_t port, bool send_ts_out,
VersionUpgradePolicy upgrade_policy);
VersionUpgradePolicy upgrade_policy,
std::chrono::seconds heartbeat_interval);
/*
* Getters
*/
Expand All @@ -36,6 +39,11 @@ class LiveBlocking {
std::uint16_t Port() const { return port_; }
bool SendTsOut() const { return send_ts_out_; }
VersionUpgradePolicy UpgradePolicy() const { return upgrade_policy_; }
// The the first member of the pair will be true, when the heartbeat interval
// was overridden.
std::pair<bool, std::chrono::seconds> HeartbeatInterval() const {
return {heartbeat_interval_.count() > 0, heartbeat_interval_};
}

/*
* Methods
Expand All @@ -50,8 +58,8 @@ class LiveBlocking {
SType stype_in, UnixNanos start);
void Subscribe(const std::vector<std::string>& symbols, Schema schema,
SType stype_in, const std::string& start);
void Subscribe(const std::vector<std::string>& symbols, Schema schema,
SType stype_in, bool use_snapshot);
void SubscribeWithSnapshot(const std::vector<std::string>& symbols,
Schema schema, SType stype_in);
// Notifies the gateway to start sending messages for all subscriptions.
//
// This method should only be called once per instance.
Expand Down Expand Up @@ -95,6 +103,7 @@ class LiveBlocking {
bool send_ts_out_;
std::uint8_t version_{};
VersionUpgradePolicy upgrade_policy_;
std::chrono::seconds heartbeat_interval_;
detail::TcpClient client_;
// Must be 8-byte aligned for records
alignas(RecordHeader) std::array<char, kMaxStrLen> read_buffer_{};
Expand Down
14 changes: 10 additions & 4 deletions include/databento/live_threaded.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <functional> // function
#include <memory> // unique_ptr
#include <string>
#include <utility> // pair
#include <vector>

#include "databento/datetime.hpp" // UnixNanos
Expand Down Expand Up @@ -31,10 +32,12 @@ class LiveThreaded {
std::function<ExceptionAction(const std::exception&)>;

LiveThreaded(ILogReceiver* log_receiver, std::string key, std::string dataset,
bool send_ts_out, VersionUpgradePolicy upgrade_policy);
bool send_ts_out, VersionUpgradePolicy upgrade_policy,
std::chrono::seconds heartbeat_interval);
LiveThreaded(ILogReceiver* log_receiver, std::string key, std::string dataset,
std::string gateway, std::uint16_t port, bool send_ts_out,
VersionUpgradePolicy upgrade_policy);
VersionUpgradePolicy upgrade_policy,
std::chrono::seconds heartbeat_interval);
LiveThreaded(const LiveThreaded&) = delete;
LiveThreaded& operator=(const LiveThreaded&) = delete;
LiveThreaded(LiveThreaded&& other) noexcept;
Expand All @@ -51,6 +54,9 @@ class LiveThreaded {
std::uint16_t Port() const;
bool SendTsOut() const;
VersionUpgradePolicy UpgradePolicy() const;
// The the first member of the pair will be true, when the heartbeat interval
// was overridden.
std::pair<bool, std::chrono::seconds> HeartbeatInterval() const;

/*
* Methods
Expand All @@ -65,8 +71,8 @@ class LiveThreaded {
SType stype_in, UnixNanos start);
void Subscribe(const std::vector<std::string>& symbols, Schema schema,
SType stype_in, const std::string& start);
void Subscribe(const std::vector<std::string>& symbols, Schema schema,
SType stype_in, bool use_snapshot);
void SubscribeWithSnapshot(const std::vector<std::string>& symbols,
Schema schema, SType stype_in);
// Notifies the gateway to start sending messages for all subscriptions.
// `metadata_callback` will be called exactly once, before any calls to
// `record_callback`. `record_callback` will be called for records from all
Expand Down
6 changes: 3 additions & 3 deletions include/databento/metadata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ struct DatasetConditionDetail {
};

struct DatasetRange {
std::string start_date;
std::string end_date;
std::string start;
std::string end;
};

inline bool operator==(const PublisherDetail& lhs, const PublisherDetail& rhs) {
Expand Down Expand Up @@ -71,7 +71,7 @@ inline bool operator!=(const DatasetConditionDetail& lhs,
}

inline bool operator==(const DatasetRange& lhs, const DatasetRange& rhs) {
return lhs.start_date == rhs.start_date && lhs.end_date == rhs.end_date;
return lhs.start == rhs.start && lhs.end == rhs.end;
}
inline bool operator!=(const DatasetRange& lhs, const DatasetRange& rhs) {
return !(lhs == rhs);
Expand Down
22 changes: 18 additions & 4 deletions include/databento/publishers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ enum class Venue : std::uint16_t {
Sphr = 41,
// Long-Term Stock Exchange, Inc.
Ltse = 42,
// Off-Exchange Transactions - Listed Instruments
Xoff = 43,
};

// A source of data.
Expand Down Expand Up @@ -155,6 +157,8 @@ enum class Dataset : std::uint16_t {
NdexImpact = 29,
// Databento Equities Max
DbeqMax = 30,
// Nasdaq Basic (NLS+QBBO)
XnasBasic = 31,
};

// A specific Venue from a specific data source.
Expand Down Expand Up @@ -265,9 +269,9 @@ enum class Publisher : std::uint16_t {
DbeqPlusXnas = 52,
// DBEQ Plus - NYSE
DbeqPlusXnys = 53,
// DBEQ Plus - FINRA/NYSE TRF
DbeqPlusFinn = 54,
// DBEQ Plus - FINRA/Nasdaq TRF Carteret
DbeqPlusFinn = 54,
// DBEQ Plus - FINRA/NYSE TRF
DbeqPlusFiny = 55,
// DBEQ Plus - FINRA/Nasdaq TRF Chicago
DbeqPlusFinc = 56,
Expand All @@ -293,9 +297,9 @@ enum class Publisher : std::uint16_t {
DbeqMaxXnas = 66,
// DBEQ Max - NYSE
DbeqMaxXnys = 67,
// DBEQ Max - FINRA/NYSE TRF
DbeqMaxFinn = 68,
// DBEQ Max - FINRA/Nasdaq TRF Carteret
DbeqMaxFinn = 68,
// DBEQ Max - FINRA/NYSE TRF
DbeqMaxFiny = 69,
// DBEQ Max - FINRA/Nasdaq TRF Chicago
DbeqMaxFinc = 70,
Expand All @@ -319,6 +323,16 @@ enum class Publisher : std::uint16_t {
DbeqMaxArcx = 79,
// DBEQ Max - Long-Term Stock Exchange
DbeqMaxLtse = 80,
// Nasdaq Basic - Nasdaq
XnasBasicXnas = 81,
// Nasdaq Basic - FINRA/Nasdaq TRF Carteret
XnasBasicFinn = 82,
// Nasdaq Basic - FINRA/Nasdaq TRF Chicago
XnasBasicFinc = 83,
// ICE Futures Europe - Off-Market Trades
IfeuImpactXoff = 84,
// ICE Endex - Off-Market Trades
NdexImpactXoff = 85,
};

// Get a Publisher's Venue.
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 <[email protected]>
_pkgname=databento-cpp
pkgname=databento-cpp-git
pkgver=0.18.1
pkgver=0.19.0
pkgrel=1
pkgdesc="Official C++ client for Databento"
arch=('any')
Expand Down
5 changes: 2 additions & 3 deletions src/historical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,8 @@ databento::DatasetRange Historical::MetadataGetDatasetRange(
if (!json.is_object()) {
throw JsonResponseError::TypeMismatch(kEndpoint, "object", json);
}
return DatasetRange{
detail::ParseAt<std::string>(kEndpoint, json, "start_date"),
detail::ParseAt<std::string>(kEndpoint, json, "end_date")};
return DatasetRange{detail::ParseAt<std::string>(kEndpoint, json, "start"),
detail::ParseAt<std::string>(kEndpoint, json, "end")};
}

static const std::string kMetadataGetRecordCountEndpoint =
Expand Down
Loading

0 comments on commit 4b51f62

Please sign in to comment.