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

A KIS REST access token and its expiry. More...

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

Inheritance diagram for algotradelib::kis::KisRest:
Collaboration diagram for algotradelib::kis::KisRest:

Public Member Functions

 KisRest ()
 Constructs an empty token.
void from_json_impl (const json::object &doc)
 Reads KIS's stated expiry from a token response; called by from_json.
bool valid () const noexcept
 Tests whether the token is set and stays valid for at least five more minutes.
Public Member Functions inherited from algotradelib::network::AuthBody< KisRest >
void from_json (const json::object &document)
 Reads a token response.
bool valid (std::chrono::seconds margin=std::chrono::minutes(5)) const noexcept
 Tests whether the token is set and stays valid for at least a margin.

Static Public Member Functions

static constexpr std::string_view token_field () noexcept
 Returns the token response's field for the token.

Public Attributes

std::chrono::system_clock::time_point access_token_expired_
 KIS's stated expiry (access_token_token_expired), which takes precedence over expires_in.
Public Attributes inherited from algotradelib::network::AuthBody< KisRest >
std::string access_token_
 The bearer token; do not log it.
std::chrono::system_clock::time_point expires_at_
 When the token expires.

Detailed Description

A KIS REST access token and its expiry.

Definition at line 263 of file config.hpp.

Constructor & Destructor Documentation

◆ KisRest()

algotradelib::kis::KisRest::KisRest ( )
inline

Constructs an empty token.

Definition at line 271 of file config.hpp.

Member Function Documentation

◆ from_json_impl()

void algotradelib::kis::KisRest::from_json_impl ( const json::object & doc)
inline

Reads KIS's stated expiry from a token response; called by from_json.

Parameters
docThe response.

Definition at line 283 of file config.hpp.

◆ token_field()

constexpr std::string_view algotradelib::kis::KisRest::token_field ( )
inlinestaticconstexprnoexcept

Returns the token response's field for the token.

Returns
"access_token".

Definition at line 277 of file config.hpp.

◆ valid()

bool algotradelib::kis::KisRest::valid ( ) const
inlinenoexcept

Tests whether the token is set and stays valid for at least five more minutes.

Returns
true if so.

Definition at line 305 of file config.hpp.

Referenced by algotradelib::kis::KisClient::adopt_token().

Member Data Documentation

◆ access_token_expired_

std::chrono::system_clock::time_point algotradelib::kis::KisRest::access_token_expired_

KIS's stated expiry (access_token_token_expired), which takes precedence over expires_in.

Definition at line 268 of file config.hpp.

Referenced by from_json_impl().


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