Longbridge OpenAPI C++ SDK
market_context.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "async_result.hpp"
4 #include "callback.hpp"
5 #include "config.hpp"
6 #include "types.hpp"
7 #include <string>
8 #include <vector>
9 
11 
12 namespace longbridge {
13 namespace market {
14 
16 {
17  Rct1 = 0,
18  Rct5 = 1,
19  Rct20 = 2,
20  Rct60 = 3,
21 };
22 enum class AhPremiumPeriod
23 {
24  Min1 = 0,
25  Min5 = 1,
26  Min15 = 2,
27  Min30 = 3,
28  Min60 = 4,
29  Day = 5,
30  Week = 6,
31  Month = 7,
32  Year = 8,
33 };
34 
37 {
38 private:
39  const lb_market_context_t* ctx_;
40 
41 public:
48 
49  static MarketContext create(const Config& config);
50 
53 
55  void broker_holding(const std::string& symbol, BrokerHoldingPeriod period,
57 
59  void broker_holding_detail(const std::string& symbol,
61 
63  void broker_holding_daily(const std::string& symbol, const std::string& broker_id,
65 
67  void ah_premium(const std::string& symbol, AhPremiumPeriod period, uint32_t count,
69 
71  void ah_premium_intraday(const std::string& symbol,
73 
75  void trade_stats(const std::string& symbol,
77 
79  void anomaly(const std::string& market,
81 
83  void constituent(const std::string& symbol,
85 
87  void top_movers(const std::vector<std::string>& markets,
88  uint32_t sort,
89  const std::string* date,
90  uint32_t limit,
92 
95 
97  void rank_list(const std::string& key,
98  bool need_article,
100 };
101 
102 } // namespace market
103 } // namespace longbridge
Definition: config.hpp:16
Market data context.
Definition: market_context.hpp:37
MarketContext(const lb_market_context_t *ctx)
void trade_stats(const std::string &symbol, AsyncCallback< MarketContext, TradeStatsResponse > callback) const
Get trade statistics.
void ah_premium_intraday(const std::string &symbol, AsyncCallback< MarketContext, AhPremiumIntraday > callback) const
Get A/H premium intraday.
void rank_categories(AsyncCallback< MarketContext, std::string > callback) const
Get all available rank category keys and labels (raw JSON string)
void constituent(const std::string &symbol, AsyncCallback< MarketContext, IndexConstituents > callback) const
Get index constituents.
void broker_holding(const std::string &symbol, BrokerHoldingPeriod period, AsyncCallback< MarketContext, BrokerHoldingTop > callback) const
Get top broker holdings.
void broker_holding_detail(const std::string &symbol, AsyncCallback< MarketContext, BrokerHoldingDetail > callback) const
Get full broker holding details.
static MarketContext create(const Config &config)
void rank_list(const std::string &key, bool need_article, AsyncCallback< MarketContext, RankListResponse > callback) const
Get a ranked list of securities for the given category key.
MarketContext & operator=(const MarketContext &ctx)
MarketContext(MarketContext &&ctx)
MarketContext(const MarketContext &ctx)
void anomaly(const std::string &market, AsyncCallback< MarketContext, AnomalyResponse > callback) const
Get market anomalies.
void top_movers(const std::vector< std::string > &markets, uint32_t sort, const std::string *date, uint32_t limit, AsyncCallback< MarketContext, TopMoversResponse > callback) const
Get top movers (stocks with unusual price movements) across one or more markets.
void market_status(AsyncCallback< MarketContext, MarketStatusResponse > callback) const
Get market trading status.
void ah_premium(const std::string &symbol, AhPremiumPeriod period, uint32_t count, AsyncCallback< MarketContext, AhPremiumKlines > callback) const
Get A/H premium K-lines.
void broker_holding_daily(const std::string &symbol, const std::string &broker_id, AsyncCallback< MarketContext, BrokerHoldingDailyHistory > callback) const
Get daily broker holding history.
struct lb_market_context_t lb_market_context_t
Definition: market_context.hpp:10
AhPremiumPeriod
Definition: market_context.hpp:23
BrokerHoldingPeriod
Definition: market_context.hpp:16
Definition: alert_context.hpp:9
std::function< void(AsyncResult< Ctx, T >)> AsyncCallback
Definition: async_result.hpp:48