Longbridge OpenAPI C++ SDK
fund_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 <vector>
8 
10 
11 namespace longbridge {
12 namespace fund {
13 
16 {
17 private:
18  const lb_fund_context_t* ctx_;
19 
20 public:
23  FundContext(const FundContext& ctx);
26 
28 
30  static FundContext create(const Config& config);
31 
32  // ── fund catalog / market data ─────────────────────────────────────────────
33 
35  void hot_funds(
36  AsyncCallback<FundContext, std::vector<HotFund>> callback) const;
37 
39  void funds(const std::optional<GetFundsOptions>& opts,
40  AsyncCallback<FundContext, std::vector<FundBrief>> callback) const;
41 
44 
46  void detail(const std::string& counter_id,
48 
50  void analysis(const std::string& counter_id,
51  const std::optional<GetFundAnalysisOptions>& opts,
53 
56  const std::string& counter_id,
57  const std::optional<GetFundAnalysisOptions>& opts,
59 
61  void trend(const std::string& counter_id,
62  const std::optional<GetFundAnalysisOptions>& opts,
64 
67  const std::string& counter_id,
68  const std::optional<FundPageOptions>& opts,
69  AsyncCallback<FundContext, std::vector<FundAnnualReturn>> callback) const;
70 
73  const std::string& counter_id,
74  const std::optional<FundPageOptions>& opts,
75  AsyncCallback<FundContext, std::vector<FundQuarterlyReturn>> callback) const;
76 
79  const std::string& counter_id,
80  AsyncCallback<FundContext, std::vector<FundPerformance>> callback) const;
81 
84  const std::string& counter_id,
85  const std::optional<GetFundAnalysisOptions>& opts,
87 
89  void nav(const std::string& counter_id,
90  AsyncCallback<FundContext, std::vector<FundNavValue>> callback) const;
91 
94  const std::string& counter_id,
95  const std::optional<FundPageOptions>& opts,
96  AsyncCallback<FundContext, std::vector<FundNavValue>> callback) const;
97 
99  void nav_range(
100  const std::string& counter_id,
101  const std::optional<FundNavRangeOptions>& opts,
102  AsyncCallback<FundContext, std::vector<FundNavValue>> callback) const;
103 
105  void holdings(const std::string& counter_id,
106  const std::optional<GetFundHoldingsOptions>& opts,
108 
111  const std::string& counter_id,
112  const std::optional<GetFundStockHoldingsOptions>& opts,
113  AsyncCallback<FundContext, std::vector<FundStockHolding>> callback) const;
114 
115  // ── user fund positions ────────────────────────────────────────────────────
116 
118  void positions(const std::optional<GetFundPositionsOptions>& opts,
120 
122  void position(const std::string& counter_id,
123  const std::optional<GetFundPositionOptions>& opts,
125 
128  const std::string& counter_id,
129  AsyncCallback<FundContext, std::vector<FundPositionPerformance>> callback)
130  const;
131 
134  const std::string& counter_id,
135  const std::optional<GetFundPositionProfitsOptions>& opts,
137 
140  const std::string& counter_id,
141  const std::optional<FundNavRangeOptions>& opts,
142  AsyncCallback<FundContext, std::vector<FundPositionNav>> callback) const;
143 
146  const std::string& counter_id,
147  const std::optional<GetFundPositionDividendsOptions>& opts,
149 
150  // ── fund orders & trading ───────────────────────────────────────────────────
151 
153  void orders(const std::optional<GetFundOrdersOptions>& opts,
154  AsyncCallback<FundContext, std::vector<FundOrder>> callback) const;
155 
157  void order(int64_t order_id,
159 
162  const std::optional<GetFundTransactionsOptions>& opts,
163  AsyncCallback<FundContext, std::vector<FundTransaction>> callback) const;
164 
167  const ValidateFundOrderOptions& opts,
169 
172  const SubmitFundOrderOptions& opts,
174 
176  void cancel_order(int64_t order_id,
177  AsyncCallback<FundContext, void> callback) const;
178 };
179 
180 } // namespace fund
181 } // namespace longbridge
Definition: config.hpp:16
Fund (mutual fund) channel context.
Definition: fund_context.hpp:16
void position_performance(const std::string &counter_id, AsyncCallback< FundContext, std::vector< FundPositionPerformance >> callback) const
Get the performance figures of a held fund.
void position(const std::string &counter_id, const std::optional< GetFundPositionOptions > &opts, AsyncCallback< FundContext, FundPositionDetail > callback) const
Get the user's single fund position detail.
void positions(const std::optional< GetFundPositionsOptions > &opts, AsyncCallback< FundContext, FundPositions > callback) const
Get the user's fund positions overview.
void analysis_detail(const std::string &counter_id, const std::optional< GetFundAnalysisOptions > &opts, AsyncCallback< FundContext, FundAnalysisDetail > callback) const
Get fund analysis detail (level 2)
void nav_range(const std::string &counter_id, const std::optional< FundNavRangeOptions > &opts, AsyncCallback< FundContext, std::vector< FundNavValue >> callback) const
Get fund historical net value by relative time range.
void validate_order(const ValidateFundOrderOptions &opts, AsyncCallback< FundContext, FundOrderValidation > callback) const
Validate a fund order before submitting.
void cancel_order(int64_t order_id, AsyncCallback< FundContext, void > callback) const
Cancel (withdraw) a fund order.
FundContext(FundContext &&ctx)
void order(int64_t order_id, AsyncCallback< FundContext, FundOrderDetail > callback) const
Get a fund order detail.
void performance_comparison(const std::string &counter_id, const std::optional< GetFundAnalysisOptions > &opts, AsyncCallback< FundContext, FundPerformanceComparison > callback) const
Get fund performance comparison.
void analysis(const std::string &counter_id, const std::optional< GetFundAnalysisOptions > &opts, AsyncCallback< FundContext, FundAnalysis > callback) const
Get fund analysis (level 1)
void orders(const std::optional< GetFundOrdersOptions > &opts, AsyncCallback< FundContext, std::vector< FundOrder >> callback) const
Get the user's fund orders.
void filters(AsyncCallback< FundContext, FundFilters > callback) const
Get the fund list filter options.
void nav(const std::string &counter_id, AsyncCallback< FundContext, std::vector< FundNavValue >> callback) const
Get fund latest net value.
void stock_holdings(const std::string &counter_id, const std::optional< GetFundStockHoldingsOptions > &opts, AsyncCallback< FundContext, std::vector< FundStockHolding >> callback) const
Get the stocks held by a fund (reverse lookup)
void detail(const std::string &counter_id, AsyncCallback< FundContext, FundDetail > callback) const
Get fund detail.
void position_dividends(const std::string &counter_id, const std::optional< GetFundPositionDividendsOptions > &opts, AsyncCallback< FundContext, FundDividends > callback) const
Get the dividend records of a held fund.
static FundContext create(const Config &config)
Create a FundContext from a Config.
FundContext(const FundContext &ctx)
FundContext(const lb_fund_context_t *ctx)
void annual_returns(const std::string &counter_id, const std::optional< FundPageOptions > &opts, AsyncCallback< FundContext, std::vector< FundAnnualReturn >> callback) const
Get fund annual returns.
void nav_history(const std::string &counter_id, const std::optional< FundPageOptions > &opts, AsyncCallback< FundContext, std::vector< FundNavValue >> callback) const
Get fund historical net value (paged)
void performance(const std::string &counter_id, AsyncCallback< FundContext, std::vector< FundPerformance >> callback) const
Get fund performance figures.
void transactions(const std::optional< GetFundTransactionsOptions > &opts, AsyncCallback< FundContext, std::vector< FundTransaction >> callback) const
Get the user's fund transactions (cash-flow records)
void holdings(const std::string &counter_id, const std::optional< GetFundHoldingsOptions > &opts, AsyncCallback< FundContext, FundHoldings > callback) const
Get a fund's top-10 holdings.
void position_nav(const std::string &counter_id, const std::optional< FundNavRangeOptions > &opts, AsyncCallback< FundContext, std::vector< FundPositionNav >> callback) const
Get the net-value history of a held fund.
void position_profits(const std::string &counter_id, const std::optional< GetFundPositionProfitsOptions > &opts, AsyncCallback< FundContext, FundPositionProfits > callback) const
Get the cumulative-profit series of a held fund.
void submit_order(const SubmitFundOrderOptions &opts, AsyncCallback< FundContext, FundOrderSubmitResponse > callback) const
Submit a fund order (buy / sell)
void trend(const std::string &counter_id, const std::optional< GetFundAnalysisOptions > &opts, AsyncCallback< FundContext, FundTrend > callback) const
Get fund trend chart.
void hot_funds(AsyncCallback< FundContext, std::vector< HotFund >> callback) const
Get the hot-selling fund list.
void quarterly_returns(const std::string &counter_id, const std::optional< FundPageOptions > &opts, AsyncCallback< FundContext, std::vector< FundQuarterlyReturn >> callback) const
Get fund quarterly returns.
FundContext & operator=(const FundContext &ctx)
void funds(const std::optional< GetFundsOptions > &opts, AsyncCallback< FundContext, std::vector< FundBrief >> callback) const
Get the fund list.
struct lb_fund_context_t lb_fund_context_t
Definition: fund_context.hpp:9
Definition: agent_context.hpp:13
std::function< void(AsyncResult< Ctx, T >)> AsyncCallback
Definition: async_result.hpp:48
Options for submitting a fund order.
Definition: types.hpp:5594
Options for validating a fund order.
Definition: types.hpp:5573