44 const std::string& day_of_week, uint32_t day_of_month,
49 void create_dca(
const std::string& symbol,
const std::string& amount,
51 uint32_t day_of_month,
bool allow_margin,
54 void update_dca(
const std::string& plan_id,
const std::string& amount,
55 int32_t frequency,
const std::string& day_of_week,
56 const std::string& day_of_month, int32_t allow_margin,
59 void history(
const std::string& plan_id, int32_t page, int32_t limit,
Definition: config.hpp:16
Dollar-cost averaging (DCA) plan management context.
Definition: dca_context.hpp:13
DCAContext(const DCAContext &ctx)
static DCAContext create(const Config &config)
Create a DCAContext from a Config.
DCAContext & operator=(const DCAContext &ctx)
void resume(const std::string &plan_id, AsyncCallback< DCAContext, void > callback) const
Resume a suspended DCA plan by plan_id.
void stats(AsyncCallback< DCAContext, DcaStats > callback) const
Get DCA statistics (counts, nearest plans, total invested/profit).
void pause(const std::string &plan_id, AsyncCallback< DCAContext, void > callback) const
Pause a DCA plan by plan_id.
void stop(const std::string &plan_id, AsyncCallback< DCAContext, void > callback) const
Stop (permanently finish) a DCA plan by plan_id.
void history(const std::string &plan_id, int32_t page, int32_t limit, AsyncCallback< DCAContext, DcaHistoryResponse > callback) const
Get execution history for a DCA plan (page 1-based, limit = page size).
void set_reminder(const std::string &hours, AsyncCallback< DCAContext, void > callback) const
Update advance reminder hours. hours must be "1", "6", or "12".
void check_support(const std::vector< std::string > &symbols, AsyncCallback< DCAContext, DcaSupportList > callback) const
Check whether DCA is supported for the given securities.
void update_dca(const std::string &plan_id, const std::string &amount, int32_t frequency, const std::string &day_of_week, const std::string &day_of_month, int32_t allow_margin, AsyncCallback< DCAContext, DcaCreateResult > callback) const
Update a DCA plan. Pass frequency=-1 to keep unchanged. allow_margin: 1=true, 0=false,...
void list(int32_t status, AsyncCallback< DCAContext, DcaList > callback) const
List DCA plans filtered by status (0=Active, 1=Suspended, 2=Finished).
void create_dca(const std::string &symbol, const std::string &amount, DCAFrequency frequency, const std::string &day_of_week, uint32_t day_of_month, bool allow_margin, AsyncCallback< DCAContext, DcaCreateResult > callback) const
Create a new DCA plan. Pass day_of_month=0 to omit.
DCAContext(DCAContext &&ctx)
DCAContext(const lb_dca_context_t *ctx)
void calc_date(const std::string &symbol, DCAFrequency frequency, const std::string &day_of_week, uint32_t day_of_month, AsyncCallback< DCAContext, DcaCalcDateResult > callback) const
struct lb_dca_context_t lb_dca_context_t
Definition: dca_context.hpp:7
DCAFrequency
DCA investment frequency.
Definition: types.hpp:3048
Definition: alert_context.hpp:9
std::function< void(AsyncResult< Ctx, T >)> AsyncCallback
Definition: async_result.hpp:48