LongPort OpenAPI C++ SDK
Public Member Functions | Static Public Member Functions | List of all members
longport::Config Class Reference

#include <config.hpp>

Public Member Functions

 Config ()
 
 Config (lb_config_t *config)
 
 Config (const Config &)=delete
 
 Config (Config &&other)
 
 Config (const std::string &app_key, const std::string &app_secret, const std::string &access_token, const std::optional< std::string > &http_url, const std::optional< std::string > &quote_ws_url, const std::optional< std::string > &trade_ws_url, const std::optional< Language > &language, bool enable_overnight, const std::optional< PushCandlestickMode > &push_candlestick_mode)
 
 Config (const std::string &app_key, const std::string &app_secret, const std::string &access_token)
 
 ~Config ()
 
 operator const lb_config_t * () const
 
void refresh_access_token (int64_t expired_at, AsyncCallback< void *, std::string > callback)
 Gets a new access_token More...
 

Static Public Member Functions

static Status from_env (Config &config)
 

Constructor & Destructor Documentation

◆ Config() [1/6]

longport::Config::Config ( )

◆ Config() [2/6]

longport::Config::Config ( lb_config_t config)

◆ Config() [3/6]

longport::Config::Config ( const Config )
delete

◆ Config() [4/6]

longport::Config::Config ( Config &&  other)

◆ Config() [5/6]

longport::Config::Config ( const std::string &  app_key,
const std::string &  app_secret,
const std::string &  access_token,
const std::optional< std::string > &  http_url,
const std::optional< std::string > &  quote_ws_url,
const std::optional< std::string > &  trade_ws_url,
const std::optional< Language > &  language,
bool  enable_overnight,
const std::optional< PushCandlestickMode > &  push_candlestick_mode 
)

Config

Parameters
app_keyApp key
app_secretApp secret
access_tokenAccess token
http_urlHTTP endpoint url (Default: https://openapi.portbridgeapp.com)
quote_ws_urlQuote websocket endpoint url (Default: wss://openapi-quote.longportapp.com/v2)
trade_ws_urlTrade websocket endpoint url (Default: wss://openapi-trade.longportapp.com/v2)
languageLanguage identifer (Default: Language::EN)
push_candlestick_modePush candlestick mode (Default: PushCandlestickMode::Realtime)

◆ Config() [6/6]

longport::Config::Config ( const std::string &  app_key,
const std::string &  app_secret,
const std::string &  access_token 
)
inline

Config

Parameters
app_keyApp key
app_secretApp secret
access_tokenAccess token

◆ ~Config()

longport::Config::~Config ( )

Member Function Documentation

◆ from_env()

static Status longport::Config::from_env ( Config config)
static

Create a new Config from the given environment variables

It first gets the environment variables from the .env file in the current directory.

Variables

  • LONGPORT_APP_KEY - App key
  • LONGPORT_APP_SECRET - App secret
  • LONGPORT_ACCESS_TOKEN - Access token
  • LONGPORT_HTTP_URL - HTTP endpoint url (Default: https://openapi.longportapp.com)
  • LONGPORT_QUOTE_WS_URL - Quote websocket endpoint url (Default: wss://openapi-quote.longportapp.com/v2)
  • LONGPORT_TRADE_WS_URL - Trade websocket endpoint url (Default: wss://openapi-trade.longportapp.com/v2)
  • LONGPORT_ENABLE_OVERNIGHT - Enable overnight quote, true or false (Default: false)
  • LONGPORT_PUSH_CANDLESTICK_MODE - realtime or confirmed (Default: realtime)

◆ operator const lb_config_t *()

longport::Config::operator const lb_config_t * ( ) const

◆ refresh_access_token()

void longport::Config::refresh_access_token ( int64_t  expired_at,
AsyncCallback< void *, std::string >  callback 
)

Gets a new access_token


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