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  bool is_first_push,
50  AsyncCallback<QuoteContext, void> callback) const;
51 
53  void unsubscribe(const std::vector<std::string>& symbols,
54  SubFlags sub_flags,
55  AsyncCallback<QuoteContext, void> callback) const;
56 
58  void subscribe_candlesticks(const std::string& symbol,
59  Period period,
60  AsyncCallback<QuoteContext, void> callback) const;
61 
64  const std::string& symbol,
65  Period period,
66  AsyncCallback<QuoteContext, void> callback) const;
67 
70  AsyncCallback<QuoteContext, std::vector<Subscription>> callback) const;
71 
75 
79 
83 
87 
92 
94  void static_info(const std::vector<std::string>& symbols,
95  AsyncCallback<QuoteContext, std::vector<SecurityStaticInfo>>
96  callback) const;
97 
99  void quote(
100  const std::vector<std::string>& symbols,
101  AsyncCallback<QuoteContext, std::vector<SecurityQuote>> callback) const;
102 
105  const std::vector<std::string>& symbols,
106  AsyncCallback<QuoteContext, std::vector<OptionQuote>> callback) const;
107 
110  const std::vector<std::string>& symbols,
111  AsyncCallback<QuoteContext, std::vector<WarrantQuote>> callback) const;
112 
114  void depth(const std::string& symbol,
116 
118  void brokers(const std::string& symbol,
120 
123  AsyncCallback<QuoteContext, std::vector<ParticipantInfo>> callback) const;
124 
126  void trades(const std::string& symbol,
127  uintptr_t count,
128  AsyncCallback<QuoteContext, std::vector<Trade>> callback) const;
129 
131  void intraday(
132  const std::string& symbol,
133  AsyncCallback<QuoteContext, std::vector<IntradayLine>> callback) const;
134 
137  const std::string& symbol,
138  Period period,
139  uintptr_t count,
140  AdjustType adjust_type,
141  AsyncCallback<QuoteContext, std::vector<Candlestick>> callback) const;
142 
145  const std::string& symbol,
146  Period period,
147  AdjustType adjust_type,
148  bool forward,
149  DateTime datetime,
150  uintptr_t count,
151  AsyncCallback<QuoteContext, std::vector<Candlestick>> callback) const;
152 
155  const std::string& symbol,
156  Period period,
157  AdjustType adjust_type,
158  std::optional<Date> start,
159  std::optional<Date> end,
160  AsyncCallback<QuoteContext, std::vector<Candlestick>> callback) const;
161 
164  const std::string& symbol,
165  AsyncCallback<QuoteContext, std::vector<Date>> callback) const;
166 
169  const std::string& symbol,
170  Date expiry_date,
171  AsyncCallback<QuoteContext, std::vector<StrikePriceInfo>> callback) const;
172 
175  AsyncCallback<QuoteContext, std::vector<IssuerInfo>> callback) const;
176 
179  const std::string& symbol,
180  WarrantSortBy sort_by,
181  SortOrderType sort_order,
182  const std::vector<WarrantType>& warrant_type,
183  const std::vector<int32_t>& issuer,
184  const std::vector<FilterWarrantExpiryDate>& expiry_date,
185  const std::vector<FilterWarrantInOutBoundsType>& price_type,
186  const std::vector<WarrantStatus>& status,
187  AsyncCallback<QuoteContext, std::vector<WarrantInfo>> callback) const;
188 
191  AsyncCallback<QuoteContext, std::vector<MarketTradingSession>> callback)
192  const;
193 
198  void trading_days(Market market,
199  Date begin,
200  Date end,
202 
205  const std::string& symbol,
206  AsyncCallback<QuoteContext, std::vector<CapitalFlowLine>> callback) const;
207 
210  const std::string& symbol,
212 
215  const std::vector<std::string>& symbols,
216  const std::vector<CalcIndex>& indexes,
217  AsyncCallback<QuoteContext, std::vector<SecurityCalcIndex>> callback) const;
218 
220  void watchlist(
221  AsyncCallback<QuoteContext, std::vector<WatchlistGroup>> callback) const;
222 
225  const CreateWatchlistGroup& req,
226  AsyncCallback<QuoteContext, int64_t> callback) const;
227 
229  void delete_watchlist_group(int64_t id,
230  bool purge,
231  AsyncCallback<QuoteContext, void> callback) const;
232 
235  AsyncCallback<QuoteContext, void> callback) const;
236 
239  Market market,
240  SecurityListCategory category,
241  AsyncCallback<QuoteContext, std::vector<Security>> callback) const;
242 
248  const std::vector<std::string>& symbols,
249  AsyncCallback<QuoteContext, std::vector<RealtimeQuote>> callback) const;
250 
256  const std::string& symbol,
258 
264  const std::string& symbol,
265  uint64_t count,
266  AsyncCallback<QuoteContext, std::vector<Trade>> callback) const;
267 
273  const std::string& symbol,
275 
281  const std::string& symbol,
282  Period period,
283  uintptr_t count,
284  AsyncCallback<QuoteContext, std::vector<Candlestick>> callback) const;
285 };
286 
287 } // namespace quote
288 } // 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 intraday(const std::string &symbol, AsyncCallback< QuoteContext, std::vector< IntradayLine >> callback) const
Get security intraday lines.
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 history_candlesticks_by_date(const std::string &symbol, Period period, AdjustType adjust_type, std::optional< Date > start, std::optional< Date > end, AsyncCallback< QuoteContext, std::vector< Candlestick >> callback) const
Get security history candlesticks by date.
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 watchlist(AsyncCallback< QuoteContext, std::vector< WatchlistGroup >> callback) const
Get watchlist.
void trading_days(Market market, Date begin, Date end, AsyncCallback< QuoteContext, MarketTradingDays > callback)
static void create(const Config &config, AsyncCallback< QuoteContext, void > callback)
void create_watchlist_group(const CreateWatchlistGroup &req, AsyncCallback< QuoteContext, int64_t > callback) const
Create watchlist group.
void history_candlesticks_by_offset(const std::string &symbol, Period period, AdjustType adjust_type, bool forward, DateTime datetime, uintptr_t count, AsyncCallback< QuoteContext, std::vector< Candlestick >> callback) const
Get security history candlesticks by offset.
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 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 subscribe_candlesticks(const std::string &symbol, Period period, AsyncCallback< QuoteContext, void > callback) const
Subscribe security candlesticks.
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 subscribe(const std::vector< std::string > &symbols, SubFlags sub_flags, bool is_first_push, 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.
void candlesticks(const std::string &symbol, Period period, uintptr_t count, AdjustType adjust_type, AsyncCallback< QuoteContext, std::vector< Candlestick >> callback) const
Get security candlesticks.
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 warrant_issuers(AsyncCallback< QuoteContext, std::vector< IssuerInfo >> callback) const
Get warrant issuers.
Subscription flags.
Definition: types.hpp:70
Period
Candlestick period.
Definition: types.hpp:128
AdjustType
Adjust type.
Definition: types.hpp:659
SecurityListCategory
Security list category.
Definition: types.hpp:1151
WarrantSortBy
Warrant sort by.
Definition: types.hpp:1014
SortOrderType
Sort order type.
Definition: types.hpp:1005
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
Definition: types.hpp:24
An request for create watchlist group.
Definition: types.hpp:788
An request for update watchlist group.
Definition: types.hpp:797