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

Obtains and caches KIS access tokens and WebSocket approval keys with blocking requests; thread-safe. More...

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

Public Member Functions

 KisAuth (net::io_context &ioc, ssl::context &ctx, const KisConfig &config)
 Constructs the wrapper.
virtual ~KisAuth ()=default
 Destroys the wrapper.
std::string accessToken ()
 Returns a REST access token, requesting a new one if none is held or it expires within five minutes.
std::string accessWebsocket ()
 Returns a WebSocket approval key, requesting a new one if none is held or it is a day old.

Detailed Description

Obtains and caches KIS access tokens and WebSocket approval keys with blocking requests; thread-safe.

KisClient manages its own token; this is for code that calls KIS directly.

Definition at line 19 of file auth.hpp.

Constructor & Destructor Documentation

◆ KisAuth()

algotradelib::kis::KisAuth::KisAuth ( net::io_context & ioc,
ssl::context & ctx,
const KisConfig & config )
inline

Constructs the wrapper.

Parameters
iocThe I/O context the requests run on; borrowed, and must outlive the wrapper.
ctxThe TLS context; borrowed, and must outlive the wrapper.
configThe credentials (copied).

Definition at line 27 of file auth.hpp.

Member Function Documentation

◆ accessToken()

std::string algotradelib::kis::KisAuth::accessToken ( )
inline

Returns a REST access token, requesting a new one if none is held or it expires within five minutes.

Returns
The token.
Exceptions
std::runtime_errorif the token request fails or its response cannot be read.
boost::system::system_erroron a transport failure.

Definition at line 40 of file auth.hpp.

◆ accessWebsocket()

std::string algotradelib::kis::KisAuth::accessWebsocket ( )
inline

Returns a WebSocket approval key, requesting a new one if none is held or it is a day old.

Returns
The key.
Exceptions
std::runtime_errorif the request fails or its response cannot be read.
boost::system::system_erroron a transport failure.

Definition at line 54 of file auth.hpp.


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