Longbridge OpenAPI C++ SDK
config.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <utility>
5 
6 #include "async_result.hpp"
7 #include "oauth.hpp"
8 #include "status.hpp"
9 #include "types.hpp"
10 
11 typedef struct lb_config_t lb_config_t;
12 
13 namespace longbridge {
14 
15 class Config
16 {
17 private:
18  lb_config_t* config_;
19 
20 public:
21  Config();
22  Config(lb_config_t* config);
23  Config(const Config&) = delete;
24  Config(Config&& other);
25 
27 
28  operator const lb_config_t*() const;
29 
42  static Config from_apikey(const std::string& app_key,
43  const std::string& app_secret,
44  const std::string& access_token);
45 
53  static Config from_apikey_env(Status& status);
54 
65  static Config from_oauth(const OAuth& oauth);
66 
67  // ── Chainable setters ──────────────────────────────────────────────────────
68 
70  Config& set_http_url(const std::string& url);
71 
73  Config& set_quote_ws_url(const std::string& url);
74 
76  Config& set_trade_ws_url(const std::string& url);
77 
80 
83 
86 
89 
91  Config& set_log_path(const std::string& path);
92 };
93 
94 } // namespace longbridge
Definition: config.hpp:16
Config & set_trade_ws_url(const std::string &url)
Set the Trade WebSocket endpoint URL.
Config & set_http_url(const std::string &url)
Set the HTTP endpoint URL.
Config & set_push_candlestick_mode(PushCandlestickMode mode)
Set the push candlestick mode.
Config & set_log_path(const std::string &path)
Set the log file path.
static Config from_apikey_env(Status &status)
static Config from_apikey(const std::string &app_key, const std::string &app_secret, const std::string &access_token)
Config(Config &&other)
Config & disable_print_quote_packages()
Disable printing of quote packages on connection.
Config & set_language(Language language)
Set the language identifier.
Config(const Config &)=delete
Config & enable_overnight()
Enable overnight quote.
static Config from_oauth(const OAuth &oauth)
Config & set_quote_ws_url(const std::string &url)
Set the Quote WebSocket endpoint URL.
Config(lb_config_t *config)
Definition: oauth.hpp:19
Definition: status.hpp:19
struct lb_config_t lb_config_t
Definition: config.hpp:11
Definition: async_result.hpp:8
PushCandlestickMode
Push candlestick mode.
Definition: types.hpp:42
Language
Language identifer.
Definition: types.hpp:31