Longbridge OpenAPI C++ SDK
fundamental_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 <optional>
8 #include <string>
9 #include <vector>
10 
12 
13 namespace longbridge {
14 namespace fundamental {
15 
17 {
18  IncomeStatement = 0,
19  BalanceSheet = 1,
20  CashFlow = 2,
21  All = 3,
22 };
24 {
25  Annual = 0,
26  SemiAnnual = 1,
27  Q1 = 2,
28  Q2 = 3,
29  Q3 = 4,
30  QuarterlyFull = 5,
31 };
34 {
35  LeadingGainer = 0,
36  TodayTrend = 1,
37  Popularity = 2,
38  MarketCap = 3,
39  Revenue = 4,
40  RevenueGrowth = 5,
41  NetProfit = 6,
42  NetProfitGrowth = 7,
43 };
46 {
48  Single = 0,
50  Multi = 1,
51 };
52 
55 {
56 private:
57  const lb_fundamental_context_t* ctx_;
58 
59 public:
66 
67  static FundamentalContext create(const Config& config);
68 
70  void financial_report(const std::string& symbol, FinancialReportKind kind, std::optional<FinancialReportPeriod> period,
72 
74  void institution_rating(const std::string& symbol,
76 
78  void institution_rating_detail(const std::string& symbol,
80 
82  void dividend(const std::string& symbol,
84 
86  void dividend_detail(const std::string& symbol,
88 
90  void forecast_eps(const std::string& symbol,
92 
94  void valuation(const std::string& symbol,
96 
98  void valuation_history(const std::string& symbol,
100 
102  void company(const std::string& symbol,
104 
106  void shareholder(const std::string& symbol,
108 
110  void fund_holder(const std::string& symbol,
112 
114  void corp_action(const std::string& symbol,
116 
118  void invest_relation(const std::string& symbol,
120 
122  void operating(const std::string& symbol,
124 
126  void consensus(const std::string& symbol,
128 
130  void industry_valuation(const std::string& symbol,
132 
134  void industry_valuation_dist(const std::string& symbol,
136 
138  void executive(const std::string& symbol,
140 
142  void buyback(const std::string& symbol,
144 
145  // TODO: temporarily disabled — endpoint not yet open (/v1/quote/ratings)
146  // /// Get stock ratings
147  // void ratings(const std::string& symbol,
148  // AsyncCallback<FundamentalContext, StockRatings> callback) const;
149 
151  void business_segments(const std::string& symbol,
153 
155  void business_segments_history(const std::string& symbol,
156  const char* report,
157  const char* cate,
159 
161  void institution_rating_views(const std::string& symbol,
163 
165  void industry_rank(Market market,
166  IndustryRankIndicator indicator,
167  IndustryRankSortType sort_type,
168  uint32_t limit,
170 
172  void industry_peers(const std::string& symbol,
173  const std::string& market,
174  const char* industry_id,
176 
178  void financial_report_snapshot(const std::string& symbol,
179  const char* report,
180  int32_t fiscal_year,
181  const char* fiscal_period,
183 
185  void shareholder_top(const std::string& symbol,
187 
189  void shareholder_detail(const std::string& symbol,
190  int64_t object_id,
192 
195  void valuation_comparison(const std::string& symbol,
196  const std::string& currency,
197  const std::vector<std::string>* comparison_symbols,
199 
202  const std::string& symbol,
204 };
205 
206 } // namespace fundamental
207 } // namespace longbridge
Definition: config.hpp:16
Fundamental data context.
Definition: fundamental_context.hpp:55
void shareholder_detail(const std::string &symbol, int64_t object_id, AsyncCallback< FundamentalContext, std::string > callback) const
Get holding history and detail for one shareholder (raw JSON string)
void consensus(const std::string &symbol, AsyncCallback< FundamentalContext, FinancialConsensus > callback) const
Get consensus estimates.
void operating(const std::string &symbol, AsyncCallback< FundamentalContext, OperatingList > callback) const
Get operating metrics.
void financial_report(const std::string &symbol, FinancialReportKind kind, std::optional< FinancialReportPeriod > period, AsyncCallback< FundamentalContext, FinancialReports > callback) const
Get financial reports — list_json is a JSON string.
void invest_relation(const std::string &symbol, AsyncCallback< FundamentalContext, InvestRelations > callback) const
Get investor relations data.
void dividend_detail(const std::string &symbol, AsyncCallback< FundamentalContext, DividendList > callback) const
Get detailed dividend information.
void industry_valuation_dist(const std::string &symbol, AsyncCallback< FundamentalContext, IndustryValuationDist > callback) const
Get industry valuation distribution.
void business_segments(const std::string &symbol, AsyncCallback< FundamentalContext, BusinessSegments > callback) const
Get latest business segment breakdown.
void executive(const std::string &symbol, AsyncCallback< FundamentalContext, ExecutiveList > callback) const
Get executive info.
void valuation_history(const std::string &symbol, AsyncCallback< FundamentalContext, ValuationHistoryResponse > callback) const
Get historical valuation.
FundamentalContext & operator=(const FundamentalContext &ctx)
void industry_peers(const std::string &symbol, const std::string &market, const char *industry_id, AsyncCallback< FundamentalContext, IndustryPeersResponse > callback) const
Get industry peer chain (pass nullptr for industry_id to omit)
void company(const std::string &symbol, AsyncCallback< FundamentalContext, CompanyOverview > callback) const
Get company overview.
FundamentalContext(const FundamentalContext &ctx)
void shareholder(const std::string &symbol, AsyncCallback< FundamentalContext, ShareholderList > callback) const
Get major shareholders.
void etf_asset_allocation(const std::string &symbol, AsyncCallback< FundamentalContext, AssetAllocationResponse > callback) const
Get ETF asset allocation (holdings / regional / asset class / industry)
void financial_report_snapshot(const std::string &symbol, const char *report, int32_t fiscal_year, const char *fiscal_period, AsyncCallback< FundamentalContext, FinancialReportSnapshot > callback) const
Get financial report snapshot (pass nullptr/0 for optional params)
FundamentalContext(const lb_fundamental_context_t *ctx)
void valuation_comparison(const std::string &symbol, const std::string &currency, const std::vector< std::string > *comparison_symbols, AsyncCallback< FundamentalContext, ValuationComparisonResponse > callback) const
void institution_rating_detail(const std::string &symbol, AsyncCallback< FundamentalContext, InstitutionRatingDetail > callback) const
Get historical analyst rating details.
void industry_valuation(const std::string &symbol, AsyncCallback< FundamentalContext, IndustryValuationList > callback) const
Get industry valuation.
void buyback(const std::string &symbol, AsyncCallback< FundamentalContext, BuybackData > callback) const
Get buyback data.
void industry_rank(Market market, IndustryRankIndicator indicator, IndustryRankSortType sort_type, uint32_t limit, AsyncCallback< FundamentalContext, IndustryRankResponse > callback) const
Get industry rank list for a market (limit 0 → server default of 20)
void valuation(const std::string &symbol, AsyncCallback< FundamentalContext, ValuationData > callback) const
Get valuation metrics.
void forecast_eps(const std::string &symbol, AsyncCallback< FundamentalContext, ForecastEps > callback) const
Get EPS forecasts.
void business_segments_history(const std::string &symbol, const char *report, const char *cate, AsyncCallback< FundamentalContext, BusinessSegmentsHistory > callback) const
Get historical business segment breakdowns (pass nullptr for report/cate to omit)
static FundamentalContext create(const Config &config)
void dividend(const std::string &symbol, AsyncCallback< FundamentalContext, DividendList > callback) const
Get dividend history.
FundamentalContext(FundamentalContext &&ctx)
void corp_action(const std::string &symbol, AsyncCallback< FundamentalContext, CorpActions > callback) const
Get corporate actions.
void institution_rating_views(const std::string &symbol, AsyncCallback< FundamentalContext, InstitutionRatingViews > callback) const
Get historical institutional rating view time-series.
void shareholder_top(const std::string &symbol, AsyncCallback< FundamentalContext, std::string > callback) const
Get ranked list of top shareholders (raw JSON string)
void institution_rating(const std::string &symbol, AsyncCallback< FundamentalContext, InstitutionRating > callback) const
Get analyst ratings.
void fund_holder(const std::string &symbol, AsyncCallback< FundamentalContext, FundHolders > callback) const
Get fund and ETF holders.
struct lb_fundamental_context_t lb_fundamental_context_t
Definition: fundamental_context.hpp:11
IndustryRankSortType
Sort mode for FundamentalContext::industry_rank.
Definition: fundamental_context.hpp:46
@ Single
Rank by the single selected indicator.
@ Multi
Rank by a composite of several indicators.
FinancialReportPeriod
Definition: fundamental_context.hpp:24
FinancialReportKind
Definition: fundamental_context.hpp:17
IndustryRankIndicator
Ranking indicator for FundamentalContext::industry_rank.
Definition: fundamental_context.hpp:34
Definition: agent_context.hpp:13
std::function< void(AsyncResult< Ctx, T >)> AsyncCallback
Definition: async_result.hpp:48
Market
Market.
Definition: types.hpp:52