![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
Toss Securities credentials (client id and secret). Toss has no demo environment. More...
#include <algotradelib/src/brokers/tossinvest/config.hpp>
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. | |
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.
|
inline |
Reads the credentials from TOSS_CLIENT_ID and TOSS_CLIENT_SECRET; called by from_env().
| std::runtime_error | if either is not set. |
Definition at line 34 of file config.hpp.
|
inline |
Reads the credentials from a JSON file, { "client_id": "...", "client_secret": "..." }; called by from_json(filename).
| filename | The file. |
| std::runtime_error | if 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.
|
inlinestaticconstexprnoexcept |
Returns the token request's field for the client id.
Definition at line 78 of file config.hpp.
|
inlinestaticconstexprnoexcept |
Returns the token request's field for the client secret.
Definition at line 84 of file config.hpp.