Longbridge OpenAPI C++ SDK
grid_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 
9 
10 namespace longbridge {
11 namespace grid {
12 
15 {
16 private:
17  const lb_grid_context_t* ctx_;
18 
19 public:
22  GridContext(const GridContext& ctx);
25 
27 
29  static GridContext create(const Config& config);
30 
32  void submit(
33  const SubmitGridOrderOptions& opts,
35 
37  void replace(const ReplaceGridOrderOptions& opts,
38  AsyncCallback<GridContext, void> callback) const;
39 
41  void list(
42  const std::optional<GetGridOrdersOptions>& opts,
44 
47  const GetGridOrdersByIdsOptions& opts,
48  AsyncCallback<GridContext, std::vector<GridOrder>> callback) const;
49 
51  void detail(
52  const GetGridOrderDetailOptions& opts,
54 
57  const GetGridTriggerHistoryOptions& opts,
59 
61  void cancel(const std::string& order_id,
62  AsyncCallback<GridContext, void> callback) const;
63 
65  void suspend(const std::string& order_id,
66  AsyncCallback<GridContext, void> callback) const;
67 
69  void restart(const std::string& order_id,
70  AsyncCallback<GridContext, void> callback) const;
71 
75  const std::string& symbol,
77 };
78 
79 } // namespace grid
80 } // namespace longbridge
Definition: config.hpp:16
Grid trading management context.
Definition: grid_context.hpp:15
GridContext(GridContext &&ctx)
void list(const std::optional< GetGridOrdersOptions > &opts, AsyncCallback< GridContext, GridOrdersResponse > callback) const
Get grid trading orders (paged list)
void submit(const SubmitGridOrderOptions &opts, AsyncCallback< GridContext, SubmitGridOrderResponse > callback) const
Submit a grid trading order.
GridContext(const lb_grid_context_t *ctx)
void symbol_info(const std::string &symbol, AsyncCallback< GridContext, GridSymbolInfo > callback) const
GridContext(const GridContext &ctx)
void trigger_history(const GetGridTriggerHistoryOptions &opts, AsyncCallback< GridContext, GridTriggerHistoryResponse > callback) const
Get grid trading trigger history.
void replace(const ReplaceGridOrderOptions &opts, AsyncCallback< GridContext, void > callback) const
Replace (modify) a grid trading order.
GridContext & operator=(const GridContext &ctx)
void cancel(const std::string &order_id, AsyncCallback< GridContext, void > callback) const
Cancel a grid trading order.
static GridContext create(const Config &config)
Create a GridContext from a Config.
void suspend(const std::string &order_id, AsyncCallback< GridContext, void > callback) const
Suspend a grid trading order.
void detail(const GetGridOrderDetailOptions &opts, AsyncCallback< GridContext, GridOrderDetail > callback) const
Get grid trading order detail (and paged history)
void restart(const std::string &order_id, AsyncCallback< GridContext, void > callback) const
Restart a grid trading order.
void list_by_ids(const GetGridOrdersByIdsOptions &opts, AsyncCallback< GridContext, std::vector< GridOrder >> callback) const
Query grid trading orders by IDs.
struct lb_grid_context_t lb_grid_context_t
Definition: grid_context.hpp:8
Definition: agent_context.hpp:13
std::function< void(AsyncResult< Ctx, T >)> AsyncCallback
Definition: async_result.hpp:48
Options for get grid trading order detail request.
Definition: types.hpp:2740
Options for query grid trading orders by IDs request.
Definition: types.hpp:2733
Options for get grid trading trigger history request.
Definition: types.hpp:2751
Options for replace grid trading order request.
Definition: types.hpp:2705
Options for submit grid trading order request.
Definition: types.hpp:2694