Longbridge OpenAPI C++ SDK
calendar_context.hpp
Go to the documentation of this file.
1 #pragma once
2 #include "async_result.hpp"
3 #include "callback.hpp"
4 #include "config.hpp"
5 #include "types.hpp"
6 
8 
9 namespace longbridge {
10 namespace calendar {
11 
12 enum class CalendarCategory
13 {
14  Report = 0,
15  Dividend = 1,
16  Split = 2,
17  Ipo = 3,
18  MacroData = 4,
19  Closed = 5,
20 };
21 
23 struct CalendarDataKv { std::string key; std::string value; std::string value_type; std::string value_raw; };
25 struct CalendarEventInfo { std::string symbol; std::string market; std::string content; std::string counter_name; std::string date_type; std::string date; std::string chart_uid; std::vector<CalendarDataKv> data_kv; std::string event_type; std::string datetime; std::string icon; int32_t star; std::string id; std::string financial_market_time; std::string currency; std::string activity_type; };
27 struct CalendarDateGroup { std::string date; int32_t count; std::vector<CalendarEventInfo> infos; };
29 struct CalendarEventsResponse { std::string date; std::vector<CalendarDateGroup> list; };
30 
33 private: const lb_calendar_context_t* ctx_;
34 public:
37  static CalendarContext create(const Config& config);
39  void finance_calendar(CalendarCategory category, const std::string& start, const std::string& end, const std::string& market, AsyncCallback<CalendarContext, CalendarEventsResponse> callback) const;
40 };
41 
42 } // namespace calendar
43 } // namespace longbridge
struct lb_calendar_context_t lb_calendar_context_t
Definition: calendar_context.hpp:7
Definition: config.hpp:16
Financial calendar context — earnings, dividends, splits, IPOs, macro data.
Definition: calendar_context.hpp:32
CalendarContext & operator=(const CalendarContext &)
void finance_calendar(CalendarCategory category, const std::string &start, const std::string &end, const std::string &market, AsyncCallback< CalendarContext, CalendarEventsResponse > callback) const
Get financial calendar events for the given date range.
static CalendarContext create(const Config &config)
Create a CalendarContext from a Config.
CalendarCategory
Definition: calendar_context.hpp:13
Definition: alert_context.hpp:9
std::function< void(AsyncResult< Ctx, T >)> AsyncCallback
Definition: async_result.hpp:48
Key-value metadata entry attached to a calendar event.
Definition: calendar_context.hpp:23
std::string key
Definition: calendar_context.hpp:23
std::string value
Definition: calendar_context.hpp:23
std::string value_raw
Definition: calendar_context.hpp:23
std::string value_type
Definition: calendar_context.hpp:23
Calendar events grouped by date.
Definition: calendar_context.hpp:27
std::vector< CalendarEventInfo > infos
Definition: calendar_context.hpp:27
int32_t count
Definition: calendar_context.hpp:27
std::string date
Definition: calendar_context.hpp:27
A single financial calendar event (earnings report, dividend, IPO, etc.).
Definition: calendar_context.hpp:25
std::string financial_market_time
Definition: calendar_context.hpp:25
std::string datetime
Definition: calendar_context.hpp:25
int32_t star
Definition: calendar_context.hpp:25
std::string event_type
Definition: calendar_context.hpp:25
std::string icon
Definition: calendar_context.hpp:25
std::string symbol
Definition: calendar_context.hpp:25
std::string content
Definition: calendar_context.hpp:25
std::string date_type
Definition: calendar_context.hpp:25
std::vector< CalendarDataKv > data_kv
Definition: calendar_context.hpp:25
std::string date
Definition: calendar_context.hpp:25
std::string market
Definition: calendar_context.hpp:25
std::string currency
Definition: calendar_context.hpp:25
std::string activity_type
Definition: calendar_context.hpp:25
std::string counter_name
Definition: calendar_context.hpp:25
std::string id
Definition: calendar_context.hpp:25
std::string chart_uid
Definition: calendar_context.hpp:25
Response for finance_calendar — events grouped by date within the requested range.
Definition: calendar_context.hpp:29
std::vector< CalendarDateGroup > list
Definition: calendar_context.hpp:29
std::string date
Definition: calendar_context.hpp:29