|
Longbridge OpenAPI C++ SDK
|
Dollar-cost averaging (DCA) plan management context. More...
#include <dca_context.hpp>
Public Member Functions | |
| DCAContext () | |
| DCAContext (const lb_dca_context_t *ctx) | |
| DCAContext (const DCAContext &ctx) | |
| DCAContext (DCAContext &&ctx) | |
| ~DCAContext () | |
| DCAContext & | operator= (const DCAContext &ctx) |
| void | list (int32_t status, AsyncCallback< DCAContext, DcaList > callback) const |
| List DCA plans filtered by status (0=Active, 1=Suspended, 2=Finished). More... | |
| void | stats (AsyncCallback< DCAContext, DcaStats > callback) const |
| Get DCA statistics (counts, nearest plans, total invested/profit). More... | |
| void | check_support (const std::vector< std::string > &symbols, AsyncCallback< DCAContext, DcaSupportList > callback) const |
| Check whether DCA is supported for the given securities. More... | |
| void | pause (const std::string &plan_id, AsyncCallback< DCAContext, void > callback) const |
| Pause a DCA plan by plan_id. More... | |
| void | resume (const std::string &plan_id, AsyncCallback< DCAContext, void > callback) const |
| Resume a suspended DCA plan by plan_id. More... | |
| void | stop (const std::string &plan_id, AsyncCallback< DCAContext, void > callback) const |
| Stop (permanently finish) a DCA plan by plan_id. More... | |
| 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 |
| void | set_reminder (const std::string &hours, AsyncCallback< DCAContext, void > callback) const |
| Update advance reminder hours. hours must be "1", "6", or "12". More... | |
| 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. More... | |
| 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, -1=unchanged. More... | |
| 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). More... | |
Static Public Member Functions | |
| static DCAContext | create (const Config &config) |
| Create a DCAContext from a Config. More... | |
Dollar-cost averaging (DCA) plan management context.
| longbridge::dca::DCAContext::DCAContext | ( | ) |
| longbridge::dca::DCAContext::DCAContext | ( | const lb_dca_context_t * | ctx | ) |
| longbridge::dca::DCAContext::DCAContext | ( | const DCAContext & | ctx | ) |
| longbridge::dca::DCAContext::DCAContext | ( | DCAContext && | ctx | ) |
| longbridge::dca::DCAContext::~DCAContext | ( | ) |
| void longbridge::dca::DCAContext::calc_date | ( | const std::string & | symbol, |
| DCAFrequency | frequency, | ||
| const std::string & | day_of_week, | ||
| uint32_t | day_of_month, | ||
| AsyncCallback< DCAContext, DcaCalcDateResult > | callback | ||
| ) | const |
Calculate next projected trade date. Pass empty string for unused day_of_week; pass day_of_month=0 to omit.
| void longbridge::dca::DCAContext::check_support | ( | const std::vector< std::string > & | symbols, |
| AsyncCallback< DCAContext, DcaSupportList > | callback | ||
| ) | const |
Check whether DCA is supported for the given securities.
|
static |
Create a DCAContext from a Config.
| void longbridge::dca::DCAContext::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.
| void longbridge::dca::DCAContext::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 longbridge::dca::DCAContext::list | ( | int32_t | status, |
| AsyncCallback< DCAContext, DcaList > | callback | ||
| ) | const |
List DCA plans filtered by status (0=Active, 1=Suspended, 2=Finished).
| DCAContext& longbridge::dca::DCAContext::operator= | ( | const DCAContext & | ctx | ) |
| void longbridge::dca::DCAContext::pause | ( | const std::string & | plan_id, |
| AsyncCallback< DCAContext, void > | callback | ||
| ) | const |
Pause a DCA plan by plan_id.
| void longbridge::dca::DCAContext::resume | ( | const std::string & | plan_id, |
| AsyncCallback< DCAContext, void > | callback | ||
| ) | const |
Resume a suspended DCA plan by plan_id.
| void longbridge::dca::DCAContext::set_reminder | ( | const std::string & | hours, |
| AsyncCallback< DCAContext, void > | callback | ||
| ) | const |
Update advance reminder hours. hours must be "1", "6", or "12".
| void longbridge::dca::DCAContext::stats | ( | AsyncCallback< DCAContext, DcaStats > | callback | ) | const |
Get DCA statistics (counts, nearest plans, total invested/profit).
| void longbridge::dca::DCAContext::stop | ( | const std::string & | plan_id, |
| AsyncCallback< DCAContext, void > | callback | ||
| ) | const |
Stop (permanently finish) a DCA plan by plan_id.
| void longbridge::dca::DCAContext::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, -1=unchanged.