Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
Loading...
Searching...
No Matches
binance::common::RestApiConfig Struct Reference

#include <config.hpp>

Public Attributes

std::optional< std::string > api_key
std::optional< std::string > api_secret
std::optional< std::string > base_path
 Set by the product factory (SpotRestApi::production(...), …) when empty.
std::chrono::milliseconds timeout {1000}
 How long one attempt of a request may take as a whole, as in the other Binance connectors: DNS, connect, proxy, TLS handshake, writing the request and reading the whole response.
bool keep_alive = true
bool compression = true
 Asks for gzip / deflate responses and decodes them.
std::size_t max_response_size = 128ULL * 1024 * 1024
 Largest response body accepted, both on the wire and after decompression.
std::uint32_t retries = 3
 Total attempts for retriable failures (GET and DELETE on a network error or 500/502/503/504).
std::chrono::milliseconds backoff {1000}
 Linear backoff: attempt n waits n * backoff before retrying.
std::optional< ProxyConfig > proxy
bool proxy_from_env = true
 When proxy is unset, use the proxy from the environment. See proxy_from_environment.
std::map< std::string, std::string > custom_headers
 Extra headers on every request. Join multiple values with ", ".
TlsContextHook agent
std::optional< PrivateKey > private_key
std::optional< std::string > private_key_passphrase
std::optional< TimeUnit > time_unit
TimestampProvider timestamp_provider
 Source of the timestamp of signed requests; empty: the host clock.
boost::asio::any_io_executor executor
 Runs the client on this executor instead of a thread of its own, so that many clients can share one event loop.

Member Data Documentation

◆ api_key

std::optional<std::string> binance::common::RestApiConfig::api_key

◆ api_secret

std::optional<std::string> binance::common::RestApiConfig::api_secret

◆ base_path

std::optional<std::string> binance::common::RestApiConfig::base_path

Set by the product factory (SpotRestApi::production(...), …) when empty.

◆ timeout

std::chrono::milliseconds binance::common::RestApiConfig::timeout {1000}

How long one attempt of a request may take as a whole, as in the other Binance connectors: DNS, connect, proxy, TLS handshake, writing the request and reading the whole response.

A retry starts a new attempt. When a host resolves to several addresses, the connect step tries them with staggered attempts (the next address after 250 ms or as soon as the previous one fails, earlier attempts keep running, the first to connect wins). Any value up to milliseconds::max() is accepted; one too large to represent as a deadline means no timeout.

◆ keep_alive

bool binance::common::RestApiConfig::keep_alive = true

◆ compression

bool binance::common::RestApiConfig::compression = true

Asks for gzip / deflate responses and decodes them.

◆ max_response_size

std::size_t binance::common::RestApiConfig::max_response_size = 128ULL * 1024 * 1024

Largest response body accepted, both on the wire and after decompression.

Larger responses fail with ConnectorClientError, which guards against decompression bombs.

◆ retries

std::uint32_t binance::common::RestApiConfig::retries = 3

Total attempts for retriable failures (GET and DELETE on a network error or 500/502/503/504).

0 and 1 both mean a single attempt. Each retry is signed again with a fresh timestamp.

◆ backoff

std::chrono::milliseconds binance::common::RestApiConfig::backoff {1000}

Linear backoff: attempt n waits n * backoff before retrying.

◆ proxy

std::optional<ProxyConfig> binance::common::RestApiConfig::proxy

◆ proxy_from_env

bool binance::common::RestApiConfig::proxy_from_env = true

When proxy is unset, use the proxy from the environment. See proxy_from_environment.

◆ custom_headers

std::map<std::string, std::string> binance::common::RestApiConfig::custom_headers

Extra headers on every request. Join multiple values with ", ".

◆ agent

TlsContextHook binance::common::RestApiConfig::agent

◆ private_key

std::optional<PrivateKey> binance::common::RestApiConfig::private_key

◆ private_key_passphrase

std::optional<std::string> binance::common::RestApiConfig::private_key_passphrase

◆ time_unit

std::optional<TimeUnit> binance::common::RestApiConfig::time_unit

◆ timestamp_provider

TimestampProvider binance::common::RestApiConfig::timestamp_provider

Source of the timestamp of signed requests; empty: the host clock.

See TimestampProvider.

◆ executor

boost::asio::any_io_executor binance::common::RestApiConfig::executor

Runs the client on this executor instead of a thread of its own, so that many clients can share one event loop.

Keep it running for as long as the client has work, and do not make blocking calls from its threads. Empty: the client starts a dedicated thread.