Longbridge OpenAPI C++ SDK
Public Member Functions | Static Public Member Functions | List of all members
longbridge::dca::DCAContext Class Reference

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 ()
 
DCAContextoperator= (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...
 

Detailed Description

Dollar-cost averaging (DCA) plan management context.

Constructor & Destructor Documentation

◆ DCAContext() [1/4]

longbridge::dca::DCAContext::DCAContext ( )

◆ DCAContext() [2/4]

longbridge::dca::DCAContext::DCAContext ( const lb_dca_context_t ctx)

◆ DCAContext() [3/4]

longbridge::dca::DCAContext::DCAContext ( const DCAContext ctx)

◆ DCAContext() [4/4]

longbridge::dca::DCAContext::DCAContext ( DCAContext &&  ctx)

◆ ~DCAContext()

longbridge::dca::DCAContext::~DCAContext ( )

Member Function Documentation

◆ calc_date()

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.

◆ check_support()

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.

◆ create()

static DCAContext longbridge::dca::DCAContext::create ( const Config config)
static

Create a DCAContext from a Config.

◆ create_dca()

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.

◆ history()

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).

◆ list()

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).

◆ operator=()

DCAContext& longbridge::dca::DCAContext::operator= ( const DCAContext ctx)

◆ pause()

void longbridge::dca::DCAContext::pause ( const std::string &  plan_id,
AsyncCallback< DCAContext, void >  callback 
) const

Pause a DCA plan by plan_id.

◆ resume()

void longbridge::dca::DCAContext::resume ( const std::string &  plan_id,
AsyncCallback< DCAContext, void >  callback 
) const

Resume a suspended DCA plan by plan_id.

◆ set_reminder()

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".

◆ stats()

void longbridge::dca::DCAContext::stats ( AsyncCallback< DCAContext, DcaStats callback) const

Get DCA statistics (counts, nearest plans, total invested/profit).

◆ stop()

void longbridge::dca::DCAContext::stop ( const std::string &  plan_id,
AsyncCallback< DCAContext, void >  callback 
) const

Stop (permanently finish) a DCA plan by plan_id.

◆ update_dca()

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.


The documentation for this class was generated from the following file: