LongPort OpenAPI C++ SDK
Public Member Functions | Static Public Member Functions | List of all members
longport::trade::TradeContext Class Reference

Trade context. More...

#include <trade_context.hpp>

Public Member Functions

 TradeContext ()
 
 TradeContext (const lb_trade_context_t *ctx)
 
 TradeContext (const TradeContext &ctx)
 
 TradeContext (TradeContext &&ctx)
 
 ~TradeContext ()
 
TradeContextoperator= (const TradeContext &ctx)
 
size_t ref_count () const
 
void subscribe (const std::vector< TopicType > &topics, AsyncCallback< TradeContext, void > callback) const
 Subscribe. More...
 
void unsubscribe (const std::vector< TopicType > &topics, AsyncCallback< TradeContext, void > callback) const
 Unsubscribe. More...
 
void set_on_order_changed (PushCallback< TradeContext, PushOrderChanged > callback) const
 
void history_executions (const std::optional< GetHistoryExecutionsOptions > &opts, AsyncCallback< TradeContext, std::vector< Execution >> callback) const
 Get history executions. More...
 
void today_executions (const std::optional< GetTodayExecutionsOptions > &opts, AsyncCallback< TradeContext, std::vector< Execution >> callback) const
 Get today executions. More...
 
void history_orders (const std::optional< GetHistoryOrdersOptions > &opts, AsyncCallback< TradeContext, std::vector< Order >> callback) const
 Get history orders. More...
 
void today_orders (const std::optional< GetTodayOrdersOptions > &opts, AsyncCallback< TradeContext, std::vector< Order >> callback) const
 Get history orders. More...
 
void replace_order (const ReplaceOrderOptions &opts, AsyncCallback< TradeContext, void > callback) const
 Replace order. More...
 
void submit_order (const SubmitOrderOptions &opts, AsyncCallback< TradeContext, SubmitOrderResponse > callback) const
 Submit order. More...
 
void cancel_order (const std::string &order_id, AsyncCallback< TradeContext, void > callback) const
 Cancel order. More...
 
void account_balance (const std::string &currency, AsyncCallback< TradeContext, std::vector< AccountBalance >> callback) const
 Get account balance with currency. More...
 
void account_balance (AsyncCallback< TradeContext, std::vector< AccountBalance >> callback) const
 Get account balance. More...
 
void account_balance (const GetCashFlowOptions &opts, AsyncCallback< TradeContext, std::vector< CashFlow >> callback) const
 Get cash flow. More...
 
void fund_positions (const std::optional< GetFundPositionsOptions > &opts, AsyncCallback< TradeContext, FundPositionsResponse > callback) const
 Get fund positions. More...
 
void stock_positions (const std::optional< GetStockPositionsOptions > &opts, AsyncCallback< TradeContext, StockPositionsResponse > callback) const
 Get stock positions. More...
 
void margin_ratio (const std::string &symbol, AsyncCallback< TradeContext, MarginRatio > callback) const
 Get margin ratio. More...
 
void order_detail (const std::string &order_id, AsyncCallback< TradeContext, OrderDetail > callback) const
 Get order detail. More...
 
void estimate_max_purchase_quantity (const EstimateMaxPurchaseQuantityOptions &opts, AsyncCallback< TradeContext, EstimateMaxPurchaseQuantityResponse > callback) const
 

Static Public Member Functions

static void create (const Config &config, AsyncCallback< TradeContext, void > callback)
 

Detailed Description

Trade context.

Constructor & Destructor Documentation

◆ TradeContext() [1/4]

longport::trade::TradeContext::TradeContext ( )

◆ TradeContext() [2/4]

longport::trade::TradeContext::TradeContext ( const lb_trade_context_t ctx)

◆ TradeContext() [3/4]

longport::trade::TradeContext::TradeContext ( const TradeContext ctx)

◆ TradeContext() [4/4]

longport::trade::TradeContext::TradeContext ( TradeContext &&  ctx)

◆ ~TradeContext()

longport::trade::TradeContext::~TradeContext ( )

Member Function Documentation

◆ account_balance() [1/3]

void longport::trade::TradeContext::account_balance ( AsyncCallback< TradeContext, std::vector< AccountBalance >>  callback) const

Get account balance.

◆ account_balance() [2/3]

void longport::trade::TradeContext::account_balance ( const GetCashFlowOptions opts,
AsyncCallback< TradeContext, std::vector< CashFlow >>  callback 
) const

Get cash flow.

◆ account_balance() [3/3]

void longport::trade::TradeContext::account_balance ( const std::string &  currency,
AsyncCallback< TradeContext, std::vector< AccountBalance >>  callback 
) const

Get account balance with currency.

◆ cancel_order()

void longport::trade::TradeContext::cancel_order ( const std::string &  order_id,
AsyncCallback< TradeContext, void >  callback 
) const

Cancel order.

◆ create()

static void longport::trade::TradeContext::create ( const Config config,
AsyncCallback< TradeContext, void >  callback 
)
static

◆ estimate_max_purchase_quantity()

void longport::trade::TradeContext::estimate_max_purchase_quantity ( const EstimateMaxPurchaseQuantityOptions opts,
AsyncCallback< TradeContext, EstimateMaxPurchaseQuantityResponse callback 
) const

Estimating the maximum purchase quantity for Hong Kong and US stocks, warrants, and options

◆ fund_positions()

void longport::trade::TradeContext::fund_positions ( const std::optional< GetFundPositionsOptions > &  opts,
AsyncCallback< TradeContext, FundPositionsResponse callback 
) const

Get fund positions.

◆ history_executions()

void longport::trade::TradeContext::history_executions ( const std::optional< GetHistoryExecutionsOptions > &  opts,
AsyncCallback< TradeContext, std::vector< Execution >>  callback 
) const

Get history executions.

◆ history_orders()

void longport::trade::TradeContext::history_orders ( const std::optional< GetHistoryOrdersOptions > &  opts,
AsyncCallback< TradeContext, std::vector< Order >>  callback 
) const

Get history orders.

◆ margin_ratio()

void longport::trade::TradeContext::margin_ratio ( const std::string &  symbol,
AsyncCallback< TradeContext, MarginRatio callback 
) const

Get margin ratio.

◆ operator=()

TradeContext& longport::trade::TradeContext::operator= ( const TradeContext ctx)

◆ order_detail()

void longport::trade::TradeContext::order_detail ( const std::string &  order_id,
AsyncCallback< TradeContext, OrderDetail callback 
) const

Get order detail.

◆ ref_count()

size_t longport::trade::TradeContext::ref_count ( ) const

◆ replace_order()

void longport::trade::TradeContext::replace_order ( const ReplaceOrderOptions opts,
AsyncCallback< TradeContext, void >  callback 
) const

Replace order.

◆ set_on_order_changed()

void longport::trade::TradeContext::set_on_order_changed ( PushCallback< TradeContext, PushOrderChanged callback) const

Set order changed callback, after receiving the order changed event, it will call back to this function.

◆ stock_positions()

void longport::trade::TradeContext::stock_positions ( const std::optional< GetStockPositionsOptions > &  opts,
AsyncCallback< TradeContext, StockPositionsResponse callback 
) const

Get stock positions.

◆ submit_order()

void longport::trade::TradeContext::submit_order ( const SubmitOrderOptions opts,
AsyncCallback< TradeContext, SubmitOrderResponse callback 
) const

Submit order.

◆ subscribe()

void longport::trade::TradeContext::subscribe ( const std::vector< TopicType > &  topics,
AsyncCallback< TradeContext, void >  callback 
) const

Subscribe.

◆ today_executions()

void longport::trade::TradeContext::today_executions ( const std::optional< GetTodayExecutionsOptions > &  opts,
AsyncCallback< TradeContext, std::vector< Execution >>  callback 
) const

Get today executions.

◆ today_orders()

void longport::trade::TradeContext::today_orders ( const std::optional< GetTodayOrdersOptions > &  opts,
AsyncCallback< TradeContext, std::vector< Order >>  callback 
) const

Get history orders.

◆ unsubscribe()

void longport::trade::TradeContext::unsubscribe ( const std::vector< TopicType > &  topics,
AsyncCallback< TradeContext, void >  callback 
) const

Unsubscribe.


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