LongPort OpenAPI C++ SDK
quote_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 "push.hpp"
7 #include "types.hpp"
8 
10 
11 namespace longport {
12 namespace quote {
13 
16 {
17 private:
18  const lb_quote_context_t* ctx_;
19 
20 public:
26 
28 
29  size_t ref_count() const;
30 
31  static void create(const Config& config,
33 
35  int64_t member_id();
36 
38  std::string quote_level() const;
39 
42  const std::vector<std::string>& symbols,
43  AsyncCallback<QuoteContext, std::vector<QuotePackageDetail>> callback)
44  const;
45 
47  void subscribe(const std::vector<std::string>& symbols,
48  SubFlags sub_flags,
49  AsyncCallback<QuoteContext, void> callback) const;
50 
52  void unsubscribe(const std::vector<std::string>& symbols,
53  SubFlags sub_flags,
54  AsyncCallback<QuoteContext, void> callback) const;
55 
58  const std::string& symbol,
59  Period period,
60  TradeSessions trade_sessions,
61  AsyncCallback<QuoteContext, std::vector<Candlestick>> callback) const;
62 
65  const std::string& symbol,
66  Period period,
67  AsyncCallback<QuoteContext, void> callback) const;
68 
71  AsyncCallback<QuoteContext, std::vector<Subscription>> callback) const;
72 
76 
80 
84 
88 
93 
95  void static_info(const std::vector<std::string>& symbols,
96  AsyncCallback<QuoteContext, std::vector<SecurityStaticInfo>>
97  callback) const;
98 
100  void quote(
101  const std::vector<std::string>& symbols,
102  AsyncCallback<QuoteContext, std::vector<SecurityQuote>> callback) const;
103 
106  const std::vector<std::string>& symbols,
107  AsyncCallback<QuoteContext, std::vector<OptionQuote>> callback) const;
108 
111  const std::vector<std::string>& symbols,
112  AsyncCallback<QuoteContext, std::vector<WarrantQuote>> callback) const;
113 
115  void depth(const std::string& symbol,
117 
119  void brokers(const std::string& symbol,
121 
124  AsyncCallback<QuoteContext, std::vector<ParticipantInfo>> callback) const;
125 
127  void trades(const std::string& symbol,
128  uintptr_t count,
129  AsyncCallback<QuoteContext, std::vector<Trade>> callback) const;
130 
132  void intraday(
133  const std::string& symbol,
134  TradeSessions trade_sessions,
135  AsyncCallback<QuoteContext, std::vector<IntradayLine>> callback) const;
136 
139  const std::string& symbol,
140  Period period,
141  uintptr_t count,
142  AdjustType adjust_type,
143  TradeSessions trade_sessions,
144  AsyncCallback<QuoteContext, std::vector<Candlestick>> callback) const;
145 
148  const std::string& symbol,
149  Period period,
150  AdjustType adjust_type,
151  bool forward,
152  std::optional<DateTime> datetime,
153  uintptr_t count,
154  TradeSessions trade_sessions,
155  AsyncCallback<QuoteContext, std::vector<Candlestick>> callback) const;
156 
159  const std::string& symbol,
160  Period period,
161  AdjustType adjust_type,
162  std::optional<Date> start,
163  std::optional<Date> end,
164  TradeSessions trade_sessions,
165  AsyncCallback<QuoteContext, std::vector<Candlestick>> callback) const;
166 
169  const std::string& symbol,
170  AsyncCallback<QuoteContext, std::vector<Date>> callback) const;
171 
174  const std::string& symbol,
175  Date expiry_date,
176  AsyncCallback<QuoteContext, std::vector<StrikePriceInfo>> callback) const;
177 
180  AsyncCallback<QuoteContext, std::vector<IssuerInfo>> callback) const;
181 
184  const std::string& symbol,
185  WarrantSortBy sort_by,
186  SortOrderType sort_order,
187  const std::vector<WarrantType>& warrant_type,
188  const std::vector<int32_t>& issuer,
189  const std::vector<FilterWarrantExpiryDate>& expiry_date,
190  const std::vector<FilterWarrantInOutBoundsType>& price_type,
191  const std::vector<WarrantStatus>& status,
192  AsyncCallback<QuoteContext, std::vector<WarrantInfo>> callback) const;
193 
196  AsyncCallback<QuoteContext, std::vector<MarketTradingSession>> callback)
197  const;
198 
203  void trading_days(Market market,
204  Date begin,
205  Date end,
207 
210  const std::string& symbol,
211  AsyncCallback<QuoteContext, std::vector<CapitalFlowLine>> callback) const;
212 
215  const std::string& symbol,
217 
220  const std::vector<std::string>& symbols,
221  const std::vector<CalcIndex>& indexes,
222  AsyncCallback<QuoteContext, std::vector<SecurityCalcIndex>> callback) const;
223 
225  void watchlist(
226  AsyncCallback<QuoteContext, std::vector<WatchlistGroup>> callback) const;
227 
230  const CreateWatchlistGroup& req,
231  AsyncCallback<QuoteContext, int64_t> callback) const;
232 
234  void delete_watchlist_group(int64_t id,
235  bool purge,
236  AsyncCallback<QuoteContext, void> callback) const;
237 
240  AsyncCallback<QuoteContext, void> callback) const;
241 
244  Market market,
245  SecurityListCategory category,
246  AsyncCallback<QuoteContext, std::vector<Security>> callback) const;
247 
250  Market market,
251  AsyncCallback<QuoteContext, std::vector<Security>> callback) const;
252 
255  Market market,
257 
260  Market market,
261  Date start,
262  Date end,
264  const;
265 
271  const std::vector<std::string>& symbols,
272  AsyncCallback<QuoteContext, std::vector<RealtimeQuote>> callback) const;
273 
279  const std::string& symbol,
281 
287  const std::string& symbol,
288  uint64_t count,
289  AsyncCallback<QuoteContext, std::vector<Trade>> callback) const;
290 
296  const std::string& symbol,
298 
304  const std::string& symbol,
305  Period period,
306  uintptr_t count,
307  AsyncCallback<QuoteContext, std::vector<Candlestick>> callback) const;
308 };
309 
310 } // namespace quote
311 } // namespace longport
Definition: config.hpp:16
Quote context.
Definition: quote_context.hpp:16
void set_on_brokers(PushCallback< QuoteContext, PushBrokers > callback) const
void option_quote(const std::vector< std::string > &symbols, AsyncCallback< QuoteContext, std::vector< OptionQuote >> callback) const
Get quote of option securities.
void realtime_candlesticks(const std::string &symbol, Period period, uintptr_t count, AsyncCallback< QuoteContext, std::vector< Candlestick >> callback) const
void depth(const std::string &symbol, AsyncCallback< QuoteContext, SecurityDepth > callback) const
Get security depth.
void unsubscribe_candlesticks(const std::string &symbol, Period period, AsyncCallback< QuoteContext, void > callback) const
Unsubscribe security candlesticks.
void warrant_list(const std::string &symbol, WarrantSortBy sort_by, SortOrderType sort_order, const std::vector< WarrantType > &warrant_type, const std::vector< int32_t > &issuer, const std::vector< FilterWarrantExpiryDate > &expiry_date, const std::vector< FilterWarrantInOutBoundsType > &price_type, const std::vector< WarrantStatus > &status, AsyncCallback< QuoteContext, std::vector< WarrantInfo >> callback) const
Query warrant list.
void delete_watchlist_group(int64_t id, bool purge, AsyncCallback< QuoteContext, void > callback) const
Delete watchlist group.
QuoteContext(const lb_quote_context_t *ctx)
void option_chain_expiry_date_list(const std::string &symbol, AsyncCallback< QuoteContext, std::vector< Date >> callback) const
Get option chain expiry date list.
void security_list(Market market, SecurityListCategory category, AsyncCallback< QuoteContext, std::vector< Security >> callback) const
Get security list.
int64_t member_id()
Returns the member id.
void history_candlesticks_by_date(const std::string &symbol, Period period, AdjustType adjust_type, std::optional< Date > start, std::optional< Date > end, TradeSessions trade_sessions, AsyncCallback< QuoteContext, std::vector< Candlestick >> callback) const
Get security history candlesticks by date.
void watchlist(AsyncCallback< QuoteContext, std::vector< WatchlistGroup >> callback) const
Get watchlist.
void trading_days(Market market, Date begin, Date end, AsyncCallback< QuoteContext, MarketTradingDays > callback)
void history_market_temperature(Market market, Date start, Date end, AsyncCallback< QuoteContext, HistoryMarketTemperatureResponse > callback) const
Get historical market temperature.
void subscribe_candlesticks(const std::string &symbol, Period period, TradeSessions trade_sessions, AsyncCallback< QuoteContext, std::vector< Candlestick >> callback) const
Subscribe security candlesticks.
static void create(const Config &config, AsyncCallback< QuoteContext, void > callback)
void security_list(Market market, AsyncCallback< QuoteContext, std::vector< Security >> callback) const
Get security list without category.
void create_watchlist_group(const CreateWatchlistGroup &req, AsyncCallback< QuoteContext, int64_t > callback) const
Create watchlist group.
void realtime_quote(const std::vector< std::string > &symbols, AsyncCallback< QuoteContext, std::vector< RealtimeQuote >> callback) const
void realtime_depth(const std::string &symbol, AsyncCallback< QuoteContext, SecurityDepth > callback) const
void set_on_candlestick(PushCallback< QuoteContext, PushCandlestick > callback) const
void history_candlesticks_by_offset(const std::string &symbol, Period period, AdjustType adjust_type, bool forward, std::optional< DateTime > datetime, uintptr_t count, TradeSessions trade_sessions, AsyncCallback< QuoteContext, std::vector< Candlestick >> callback) const
Get security history candlesticks by offset.
void capital_flow(const std::string &symbol, AsyncCallback< QuoteContext, std::vector< CapitalFlowLine >> callback) const
Get capital flow intraday.
void set_on_quote(PushCallback< QuoteContext, PushQuote > callback) const
void set_on_depth(PushCallback< QuoteContext, PushDepth > callback) const
void set_on_trades(PushCallback< QuoteContext, PushTrades > callback) const
void trading_session(AsyncCallback< QuoteContext, std::vector< MarketTradingSession >> callback) const
Get trading session of the day.
void capital_distribution(const std::string &symbol, AsyncCallback< QuoteContext, CapitalDistributionResponse > callback) const
Get capital distribution.
void market_temperature(Market market, AsyncCallback< QuoteContext, MarketTemperature > callback) const
Get current market temperature.
void static_info(const std::vector< std::string > &symbols, AsyncCallback< QuoteContext, std::vector< SecurityStaticInfo >> callback) const
Get basic information of securities.
void subscriptions(AsyncCallback< QuoteContext, std::vector< Subscription >> callback) const
Get subscription information.
void candlesticks(const std::string &symbol, Period period, uintptr_t count, AdjustType adjust_type, TradeSessions trade_sessions, AsyncCallback< QuoteContext, std::vector< Candlestick >> callback) const
Get security candlesticks.
void subscribe(const std::vector< std::string > &symbols, SubFlags sub_flags, AsyncCallback< QuoteContext, void > callback) const
Subscribe.
void trades(const std::string &symbol, uintptr_t count, AsyncCallback< QuoteContext, std::vector< Trade >> callback) const
Get security trades.
void update_watchlist_group(const UpdateWatchlistGroup &req, AsyncCallback< QuoteContext, void > callback) const
Create watchlist group.
void unsubscribe(const std::vector< std::string > &symbols, SubFlags sub_flags, AsyncCallback< QuoteContext, void > callback) const
Unsubscribe.
void realtime_brokers(const std::string &symbol, AsyncCallback< QuoteContext, SecurityBrokers > callback) const
std::string quote_level() const
Returns the quote level.
QuoteContext(const QuoteContext &ctx)
void quote_package_details(const std::vector< std::string > &symbols, AsyncCallback< QuoteContext, std::vector< QuotePackageDetail >> callback) const
Returns the quote package details.
void participants(AsyncCallback< QuoteContext, std::vector< ParticipantInfo >> callback) const
Get participants.
void brokers(const std::string &symbol, AsyncCallback< QuoteContext, SecurityBrokers > callback) const
Get security brokers.
void realtime_trades(const std::string &symbol, uint64_t count, AsyncCallback< QuoteContext, std::vector< Trade >> callback) const
void quote(const std::vector< std::string > &symbols, AsyncCallback< QuoteContext, std::vector< SecurityQuote >> callback) const
Get quote of securities.
QuoteContext & operator=(const QuoteContext &ctx)
void warrant_quote(const std::vector< std::string > &symbols, AsyncCallback< QuoteContext, std::vector< WarrantQuote >> callback) const
Get quote of warrant securities.
void option_chain_info_by_date(const std::string &symbol, Date expiry_date, AsyncCallback< QuoteContext, std::vector< StrikePriceInfo >> callback) const
Get option chain expiry date list.
void calc_indexes(const std::vector< std::string > &symbols, const std::vector< CalcIndex > &indexes, AsyncCallback< QuoteContext, std::vector< SecurityCalcIndex >> callback) const
Get calc indexes.
QuoteContext(QuoteContext &&ctx)
void intraday(const std::string &symbol, TradeSessions trade_sessions, AsyncCallback< QuoteContext, std::vector< IntradayLine >> callback) const
Get security intraday lines.
void warrant_issuers(AsyncCallback< QuoteContext, std::vector< IssuerInfo >> callback) const
Get warrant issuers.
Subscription flags.
Definition: types.hpp:72
Period
Candlestick period.
Definition: types.hpp:130
AdjustType
Adjust type.
Definition: types.hpp:691
SecurityListCategory
Security list category.
Definition: types.hpp:1183
WarrantSortBy
Warrant sort by.
Definition: types.hpp:1046
SortOrderType
Sort order type.
Definition: types.hpp:1037
TradeSessions
Trade sessions.
Definition: types.hpp:1205
Definition: async_result.hpp:7
std::function< void(AsyncResult< Ctx, T >)> AsyncCallback
Definition: async_result.hpp:39
Market
Market.
Definition: types.hpp:51
std::function< void(PushEvent< Ctx, T >)> PushCallback
Definition: push.hpp:27
struct lb_quote_context_t lb_quote_context_t
Definition: quote_context.hpp:9
Definition: types.hpp:10
An request for create watchlist group.
Definition: types.hpp:820
An request for update watchlist group.
Definition: types.hpp:829