algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::tossinvest::TossConfig Struct Reference

Toss Securities credentials (client id and secret). Toss has no demo environment. More...

#include <algotradelib/src/brokers/tossinvest/config.hpp>

Inheritance diagram for algotradelib::tossinvest::TossConfig:
Collaboration diagram for algotradelib::tossinvest::TossConfig:

Public Member Functions

void from_env_impl ()
 Reads the credentials from TOSS_CLIENT_ID and TOSS_CLIENT_SECRET; called by from_env().
void from_json_impl (const std::string &filename)
 Reads the credentials from a JSON file, { "client_id": "...", "client_secret": "..." }; called by from_json(filename).
Public Member Functions inherited from algotradelib::network::ClientCredentials< TossConfig >
void from_env ()
 Loads the credentials from the broker's environment variables.
void from_json (const std::string &filename)
 Loads the credentials from a JSON file, in the broker's format.
const std::string & key () const noexcept
 Returns the app key (client id).
const std::string & secret () const noexcept
 Returns the app secret.
std::string to_jsonbody () const
 Builds a JSON token-request body (grant type, key and secret under the broker's field names).
std::string to_form_urlencoded_body () const
 Builds a form-encoded token-request body (grant_type, client_id, client_secret).

Static Public Member Functions

static constexpr std::string_view key_field () noexcept
 Returns the token request's field for the client id.
static constexpr std::string_view secret_field () noexcept
 Returns the token request's field for the client secret.

Additional Inherited Members

Static Public Attributes inherited from algotradelib::network::ClientCredentials< TossConfig >
static constexpr std::string_view grant_type
 The OAuth grant type sent in a token request.
Protected Attributes inherited from algotradelib::network::ClientCredentials< TossConfig >
std::string key_
 The app key (client id).
std::string secret_
 The app secret.

Detailed Description

Toss Securities credentials (client id and secret). Toss has no demo environment.

Load with from_env() (TOSS_CLIENT_ID, TOSS_CLIENT_SECRET) or from_json(filename).

Definition at line 24 of file config.hpp.

Member Function Documentation

◆ from_env_impl()

void algotradelib::tossinvest::TossConfig::from_env_impl ( )
inline

Reads the credentials from TOSS_CLIENT_ID and TOSS_CLIENT_SECRET; called by from_env().

Exceptions
std::runtime_errorif either is not set.

Definition at line 34 of file config.hpp.

◆ from_json_impl()

void algotradelib::tossinvest::TossConfig::from_json_impl ( const std::string & filename)
inline

Reads the credentials from a JSON file, { "client_id": "...", "client_secret": "..." }; called by from_json(filename).

Parameters
filenameThe file.
Exceptions
std::runtime_errorif the file cannot be read, is not a JSON object, or lacks either field or has one that is not a string.

Definition at line 51 of file config.hpp.

◆ key_field()

constexpr std::string_view algotradelib::tossinvest::TossConfig::key_field ( )
inlinestaticconstexprnoexcept

Returns the token request's field for the client id.

Returns
"client_id".

Definition at line 78 of file config.hpp.

◆ secret_field()

constexpr std::string_view algotradelib::tossinvest::TossConfig::secret_field ( )
inlinestaticconstexprnoexcept

Returns the token request's field for the client secret.

Returns
"client_secret".

Definition at line 84 of file config.hpp.


The documentation for this struct was generated from the following file: