dxFeed Graal CXX API v4.3.1
Loading...
Searching...
No Matches
HistoryEndpoint Struct Referencefinal

Represents an endpoint for accessing historical data, supporting configurable parameters such as compression and data format. More...

#include <HistoryEndpoint.hpp>

+ Inheritance diagram for HistoryEndpoint:

Classes

class  Builder
 Builder is a static inner class that provides a flexible and readable way to construct instances of the HistoryEndpoint class. More...
 

Public Types

enum class  Compression
 The Compression enum represents different compression algorithms that can be applied to data during transmission or storage. More...
 
enum class  Format
 The Format enum represents different formats that can be used to handle data. More...
 
using Ptr = std::shared_ptr<HistoryEndpoint>
 The alias to a type of shared pointer to the HistoryEndpoint object.
 
using Unique = std::unique_ptr<HistoryEndpoint>
 The alias to a type of unique pointer to the HistoryEndpoint object.
 
- Public Types inherited from SharedEntity
using Ptr = std::shared_ptr<SharedEntity>
 The alias to a type of shared pointer to the SharedEntity object.
 

Public Member Functions

template<Derived< TimeSeriesEvent > E>
std::vector< std::shared_ptr< E > > getTimeSeries (const SymbolWrapper &symbol, std::int64_t from, std::int64_t to)
 Retrieves a list of time series events for a specific type of event and symbol within the given time range.
 
- Public Member Functions inherited from SharedEntity
template<typename T>
bool is () const noexcept
 Checks that pointer to the current type could be converted to type T* In other words: whether type T belongs to the type hierarchy in which the current type resides.
 
template<typename T>
std::shared_ptr< T > sharedAs () noexcept
 Returns a pointer to the current object wrapped in a smart pointer to type T.
 
template<typename T>
std::shared_ptr< T > sharedAs () const noexcept
 Returns a pointer to the current object wrapped in a smart pointer to type T.
 
virtual std::string toString () const
 Returns a string representation of the current object.
 
- Public Member Functions inherited from Entity
virtual ~Entity () noexcept=default
 The default virtual d-tor.
 

Static Public Member Functions

static std::shared_ptr< BuildernewBuilder ()
 Creates a new instance of HistoryEndpoint::Builder with default configurations.
 
- Static Public Member Functions inherited from RequireMakeShared< HistoryEndpoint >
static auto createShared (Args &&...args)
 Creates smart pointer to object.
 

Detailed Description

Represents an endpoint for accessing historical data, supporting configurable parameters such as compression and data format.

This class provides functionality to retrieve and process time-series data using a flexible API.

const auto candleDataUrl = "https://tools.dxfeed.com/candledata";
const auto user = "*****";
const auto password = "*****";
const auto start = TimeFormat::DEFAULT.parse("20221201-000000");
const auto stop = TimeFormat::DEFAULT.parse("20230101-000000");
const auto builder = HistoryEndpoint::newBuilder()
->withAddress(candleDataUrl)
->withUserName(user)
->withPassword(password);
const auto endpoint = builder->build();
auto res = endpoint->getTimeSeries<Candle>("AAPL{=d}", start, stop);
std::cout << "Received candle count: " << res.size() << std::endl;
const auto resTns= builder->build()->getTimeSeries<TimeAndSale>(
"AAPL&Q",
TimeFormat::DEFAULT.parse("20250818-120000"),
TimeFormat::DEFAULT.parse("20250819-130000"));
std::cout << "Received tns count: " << resTns.size() << std::endl;
Candle event with open, high, low, close prices and other information for a specific period.
Definition Candle.hpp:63
Time and Sale represents a trade or other market event with price, like market open/close price,...
Definition TimeAndSale.hpp:52
static std::shared_ptr< Builder > newBuilder()
Creates a new instance of HistoryEndpoint::Builder with default configurations.
Definition HistoryEndpoint.cpp:79
static const TimeFormat DEFAULT
An instance of TimeFormat that corresponds to default timezone as returned by TimeZone::getDefault() ...
Definition TimeFormat.hpp:33

Member Enumeration Documentation

◆ Compression

enum class HistoryEndpoint::Compression
strong

The Compression enum represents different compression algorithms that can be applied to data during transmission or storage.

It provides three types of compression:

  • NONE: No compression is applied.
  • ZIP: ZIP compression is applied.
  • GZIP: GZIP compression is applied.

This enum is used to dictate the type of compression to be applied in various data handling scenarios.

◆ Format

enum class HistoryEndpoint::Format
strong

The Format enum represents different formats that can be used to handle data.

It provides three types of formats:

It provides three types of compression:

  • TEXT: Data is represented as plain text.
  • CSV: Data is represented as comma-separated values.
  • BINARY: Data is represented in binary format.

This enum is used to specify the format in various data transmission and processing scenarios.

Member Function Documentation

◆ getTimeSeries()

template<Derived< TimeSeriesEvent > E>
std::vector< std::shared_ptr< E > > HistoryEndpoint::getTimeSeries ( const SymbolWrapper & symbol,
std::int64_t from,
std::int64_t to )
inline

Retrieves a list of time series events for a specific type of event and symbol within the given time range.

Template Parameters
EThe subclass of TimeSeriesEvent that specifies the type of event to retrieve.
Parameters
symbolThe identifier of the symbol for which the time series data is requested.
fromThe start timestamp for the time series query, in milliseconds since epoch.
toThe end timestamp for the time series query, in milliseconds since epoch.
Returns
A list of events of the specified type and symbol within the given time range.

◆ newBuilder()

std::shared_ptr< HistoryEndpoint::Builder > HistoryEndpoint::newBuilder ( )
static

Creates a new instance of HistoryEndpoint::Builder with default configurations.

The default settings include:

  • Compression::ZIP as the compression type.
  • Format::BINARY as the data format.
Returns
A new HistoryEndpoint::Builder instance with preset default values.