Longbridge OpenAPI C++ SDK
alert_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 alert {
11 
12 enum class AlertCondition
13 {
14  PriceRise = 0,
15  PriceFall = 1,
16  PercentRise = 2,
17  PercentFall = 3,
18 };
19 enum class AlertFrequency
20 {
21  Daily = 0,
22  EveryTime = 1,
23  Once = 2,
24 };
25 
27 class AlertContext {
28 private:
29  const lb_alert_context_t* ctx_;
30 
31 public:
38 
40  static AlertContext create(const Config& config);
41 
45  void add(const std::string& symbol, AlertCondition condition,
46  const std::string& trigger_value, AlertFrequency frequency,
47  AsyncCallback<AlertContext, void> callback) const;
50  void update(const AlertItem& item,
51  AsyncCallback<AlertContext, void> callback) const;
52 };
53 
54 } // namespace alert
55 } // namespace longbridge
struct lb_alert_context_t lb_alert_context_t
Definition: alert_context.hpp:7
Definition: config.hpp:16
Price alert management context.
Definition: alert_context.hpp:27
void update(const AlertItem &item, AsyncCallback< AlertContext, void > callback) const
AlertContext & operator=(const AlertContext &ctx)
AlertContext(const lb_alert_context_t *ctx)
void add(const std::string &symbol, AlertCondition condition, const std::string &trigger_value, AlertFrequency frequency, AsyncCallback< AlertContext, void > callback) const
Add a price alert.
static AlertContext create(const Config &config)
Create an AlertContext from a Config.
AlertContext(const AlertContext &ctx)
AlertContext(AlertContext &&ctx)
void list(AsyncCallback< AlertContext, AlertList > callback) const
List all price alerts grouped by security.
AlertCondition
Definition: alert_context.hpp:13
AlertFrequency
Definition: alert_context.hpp:20
Definition: alert_context.hpp:9
std::function< void(AsyncResult< Ctx, T >)> AsyncCallback
Definition: async_result.hpp:48
One price alert rule attached to a security.
Definition: types.hpp:2993