Skip to content

Commit b8553e3

Browse files
authored
VER: Release 0.13.1
2 parents e107d0d + 623f557 commit b8553e3

File tree

16 files changed

+317
-30
lines changed

16 files changed

+317
-30
lines changed

.clang-tidy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ Checks: >
1111
-google-readability-casting,
1212
-google-runtime-references,
1313
modernize-deprecated-headers,
14-
misc-*,
15-
-misc-non-private-member-variables-in-classes,
1614
performance-*,
1715
portability-*'
1816
WarningsAsErrors: '*'

CHANGELOG.md

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

3+
## 0.13.1 - 2023-10-23
4+
### Enhancements
5+
- Added new publisher values in preparation for DBEQ.PLUS
6+
- Added `ToIso8601` for `UnixNanos` for converting to human-readable ISO8601 datetime
7+
string
8+
- Added `kUndefTimestamp` and `kUndefStatQuantity` constants
9+
- Added flag `kTob` for top-of-book messages
10+
311
## 0.13.0 - 2023-09-21
412
### Enhancements
513
- Added `pretty_px` option for `BatchSubmitJob`, which formats prices to the correct

CMakeLists.txt

Lines changed: 2 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.13.0 LANGUAGES CXX)
7+
project("databento" VERSION 0.13.1 LANGUAGES CXX)
88
string(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPERCASE)
99

1010
#
@@ -348,6 +348,7 @@ endif()
348348

349349
if(${PROJECT_NAME_UPPERCASE}_ENABLE_UNIT_TESTING)
350350
unset(CMAKE_CXX_CPPCHECK) # disable cppcheck for tests
351+
unset(CMAKE_CXX_CLANG_TIDY) # disable clang-tidy for tests
351352
enable_testing()
352353
message(STATUS "Build unit tests for the project.")
353354
add_subdirectory(test)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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)
44
[![license](https://img.shields.io/github/license/databento/databento-cpp?color=blue)](./LICENSE)
5-
[![Slack](https://img.shields.io/badge/join_Slack-community-darkblue.svg?logo=slack)](https://join.slack.com/t/databento-hq/shared_invite/zt-1xk498wxs-9fUs_xhz5ypaGD~mhI_hVQ)
5+
[![Slack](https://img.shields.io/badge/join_Slack-community-darkblue.svg?logo=slack)](https://join.slack.com/t/databento-hq/shared_invite/zt-24oqyrub9-MellISM2cdpQ7s_7wcXosw)
66

77
The official C++ client library for [Databento](https://databento.com).
88
The client supports both streaming real-time and historical market data through similar interfaces.

include/databento/constants.hpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,22 @@ static constexpr auto kApiVersionStr = "0";
99
static constexpr auto kApiKeyLength = 32;
1010
// The decimal scaler of fixed prices.
1111
static constexpr std::int64_t kFixedPriceScale = 1000000000;
12-
// The sentinel value for a null or undefined price.
12+
// The sentinel value for an unset or null price.
1313
static constexpr auto kUndefPrice = std::numeric_limits<std::int64_t>::max();
14-
// The sentinel value for a null or undefined order size.
14+
// The sentinel value for an unset or null order size.
1515
static constexpr auto kUndefOrderSize =
1616
std::numeric_limits<std::uint32_t>::max();
17+
// The sentinel value for an unset statistic quantity.
18+
static constexpr auto kUndefStatQuantity =
19+
std::numeric_limits<std::int32_t>::max();
20+
// The sentinel value for an unset or null timestamp.
21+
static constexpr auto kUndefTimestamp =
22+
std::numeric_limits<std::uint64_t>::max();
1723

1824
// This is not necessarily a comprehensive list of available datasets. Please
1925
// use `Historical.MetadataListDatasets` to retrieve an up-to-date list.
2026
namespace dataset {
21-
// The dataset code for Databento Equity Basic.
27+
// The dataset code for Databento Equities Basic.
2228
static constexpr auto kDbeqBasic = "DBEQ.BASIC";
2329
// The dataset code for CME Globex MDP 3.0.
2430
static constexpr auto kGlbxMdp3 = "GLBX.MDP3";

include/databento/datetime.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ using UnixNanos =
1414
// A representation of the difference between two timestamps.
1515
using TimeDeltaNanos = std::chrono::duration<int32_t, std::nano>;
1616
std::string ToString(UnixNanos unix_nanos);
17+
// Format the UNIX timestamp as a human-readable ISO8601 string of format
18+
// YYYY-MM-DDTHH:MM:SS.fffffffffZ
19+
std::string ToIso8601(UnixNanos unix_nanos);
1720
std::string ToString(TimeDeltaNanos td_nanos);
1821
// Converts a YYYYMMDD integer to a YYYY-MM-DD string.
1922
std::string DateFromIso8601Int(std::uint32_t date_int);

include/databento/flag_set.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class FlagSet {
1313
// Indicates it's the last message in the packet from the venue for a given
1414
// `instrument_id`.
1515
static constexpr Repr kLast = 1 << 7;
16+
// Indicates a top-of-book message, not an individual order.
17+
static constexpr Repr kTob = 1 << 6;
1618
// Indicates the message was sourced from a replay, such as a snapshot
1719
// server.
1820
static constexpr Repr kSnapshot = 1 << 5;

include/databento/publishers.hpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,16 @@ enum class Dataset : std::uint16_t {
129129
ArcxPillar = 21,
130130
// IEX TOPS
131131
IexgTops = 22,
132+
// Databento Equities Plus
133+
DbeqPlus = 23,
134+
// NYSE BBO
135+
XnysBbo = 24,
136+
// NYSE Trades
137+
XnysTrades = 25,
138+
// Nasdaq QBBO
139+
XnasQbbo = 26,
140+
// Nasdaq NLS
141+
XnasNls = 27,
132142
};
133143

134144
// A specific Venue from a specific data source.
@@ -219,6 +229,32 @@ enum class Publisher : std::uint16_t {
219229
DbeqBasicEprl = 42,
220230
// NYSE Arca Integrated
221231
ArcxPillarArcx = 43,
232+
// NYSE BBO
233+
XnysBboXnys = 44,
234+
// NYSE Trades
235+
XnysTradesXnys = 45,
236+
// Nasdaq QBBO
237+
XnasQbboXnas = 46,
238+
// Nasdaq Trades
239+
XnasNlsXnas = 47,
240+
// DBEQ Plus - NYSE Chicago
241+
DbeqPlusXchi = 48,
242+
// DBEQ Plus - NYSE National
243+
DbeqPlusXcis = 49,
244+
// DBEQ Plus - IEX
245+
DbeqPlusIexg = 50,
246+
// DBEQ Plus - MIAX Pearl
247+
DbeqPlusEprl = 51,
248+
// DBEQ Plus - Nasdaq
249+
DbeqPlusXnas = 52,
250+
// DBEQ Plus - NYSE
251+
DbeqPlusXnys = 53,
252+
// DBEQ Plus - FINRA/NYSE TRF
253+
DbeqPlusFinn = 54,
254+
// DBEQ Plus - FINRA/Nasdaq TRF Carteret
255+
DbeqPlusFiny = 55,
256+
// DBEQ Plus - FINRA/Nasdaq TRF Chicago
257+
DbeqPlusFinc = 56,
222258
};
223259

224260
// Get a Publisher's Venue.

pkg/PKGBUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Maintainer: Databento <[email protected]>
22
_pkgname=databento-cpp
33
pkgname=databento-cpp-git
4-
pkgver=0.13.0
4+
pkgver=0.13.1
55
pkgrel=1
66
pkgdesc="Official C++ client for Databento"
77
arch=('any')

src/datetime.cpp

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,49 @@
11
#include "databento/datetime.hpp"
22

3-
#include <iomanip>
4-
#include <sstream>
3+
// NOLINTNEXTLINE(modernize-deprecated-headers): no thread-safe version in STL
4+
#include <time.h> // gmtime_r or gmtime_s
5+
6+
#include <array>
7+
#include <chrono>
8+
#include <ctime> // localtime, strftime, tm
9+
#include <iomanip> // setw
10+
#include <sstream> // ostringstream
11+
12+
#include "databento/constants.hpp" // kUndefTimestamp
513

614
namespace databento {
15+
std::string ToIso8601(UnixNanos unix_nanos) {
16+
if (unix_nanos.time_since_epoch().count() == kUndefTimestamp) {
17+
return "UNDEF_TIMESTAMP";
18+
}
19+
std::array<char, 80> buf{};
20+
const auto time =
21+
static_cast<std::time_t>(std::chrono::duration_cast<std::chrono::seconds>(
22+
unix_nanos.time_since_epoch())
23+
.count());
24+
std::tm tm = {};
25+
#ifdef _WIN32
26+
if (::gmtime_s(&tm, &time) != 0) {
27+
// Fallback on printing nanos
28+
return ToString(unix_nanos);
29+
}
30+
#else
31+
if (::gmtime_r(&time, &tm) == nullptr) {
32+
// Fallback on printing nanos
33+
return ToString(unix_nanos);
34+
}
35+
#endif
36+
const auto nanos = std::chrono::nanoseconds{
37+
unix_nanos.time_since_epoch() %
38+
std::chrono::nanoseconds{std::chrono::seconds{1}}};
39+
const size_t count =
40+
std::strftime(buf.data(), sizeof(buf), "%Y-%m-%dT%H:%M:%S", &tm);
41+
std::ostringstream time_ss;
42+
time_ss.write(buf.data(), static_cast<std::streamsize>(count));
43+
time_ss << '.' << std::setw(9) << std::setfill('0') << nanos.count() << 'Z';
44+
return time_ss.str();
45+
}
46+
747
std::string ToString(UnixNanos unix_nanos) {
848
return std::to_string(unix_nanos.time_since_epoch().count());
949
}

0 commit comments

Comments
 (0)