crypto_trader
Cryptocurrency Trading Bot API Documentation
Loading...
Searching...
No Matches
crypto_trader::executors::RealTradingExecutor< T > Class Template Reference

#include <real_trading_executor.h>

Inheritance diagram for crypto_trader::executors::RealTradingExecutor< T >:
Inheritance graph
Collaboration diagram for crypto_trader::executors::RealTradingExecutor< T >:
Collaboration graph

Public Member Functions

 RealTradingExecutor (const RealTradingExecutorConfig &config)
 ~RealTradingExecutor ()=default
common::TradeResult buy (const std::string_view &product, double quantity) override
 Executes a buy order for a specified product and quantity.
common::TradeResult sell (const std::string_view &product, double quantity) override
 Executes a sell order for a specified product and quantity.
double getBalance (const std::string_view &currency) const override
 Retrieves the current balance of a specified currency.
std::optional< double > getPosition (const std::string_view &product) const override
 Retrieves the current position (holdings) for a given product.
void processTickerData (const std::string_view &product, double price, const T::Timestamp &timestamp) override
 Processes new ticker data to update the executor's internal state.
Public Member Functions inherited from crypto_trader::protocols::Executor< T >
virtual ~Executor ()=default
 Destructor for the Executor interface.

Constructor & Destructor Documentation

◆ RealTradingExecutor()

template<common::MarketData T>
crypto_trader::executors::RealTradingExecutor< T >::RealTradingExecutor ( const RealTradingExecutorConfig & config)

◆ ~RealTradingExecutor()

template<common::MarketData T>
crypto_trader::executors::RealTradingExecutor< T >::~RealTradingExecutor ( )
default

Member Function Documentation

◆ buy()

template<common::MarketData T>
common::TradeResult crypto_trader::executors::RealTradingExecutor< T >::buy ( const std::string_view & product,
double quantity )
overridevirtual

Executes a buy order for a specified product and quantity.

Parameters
productThe symbol of the product to buy (e.g., "BTC-USD").
quantityThe amount of the product to buy.
Returns
The result of the trade execution.

Implements crypto_trader::protocols::Executor< T >.

◆ getBalance()

template<common::MarketData T>
double crypto_trader::executors::RealTradingExecutor< T >::getBalance ( const std::string_view & currency) const
overridevirtual

Retrieves the current balance of a specified currency.

Parameters
currencyThe symbol of the currency (e.g., "USD", "BTC").
Returns
The current balance of the currency.

Implements crypto_trader::protocols::Executor< T >.

◆ getPosition()

template<common::MarketData T>
std::optional< double > crypto_trader::executors::RealTradingExecutor< T >::getPosition ( const std::string_view & product) const
overridevirtual

Retrieves the current position (holdings) for a given product.

Parameters
productThe symbol of the product (e.g., "BTC-USD").
Returns
An optional containing the quantity held, or empty if no position.

Implements crypto_trader::protocols::Executor< T >.

◆ processTickerData()

template<common::MarketData T>
void crypto_trader::executors::RealTradingExecutor< T >::processTickerData ( const std::string_view & product,
double price,
const T::Timestamp & timestamp )
overridevirtual

Processes new ticker data to update the executor's internal state.

Parameters
productThe symbol of the product for the ticker.
priceThe latest price of the product.
timestampThe timestamp of the ticker data.

Implements crypto_trader::protocols::Executor< T >.

◆ sell()

template<common::MarketData T>
common::TradeResult crypto_trader::executors::RealTradingExecutor< T >::sell ( const std::string_view & product,
double quantity )
overridevirtual

Executes a sell order for a specified product and quantity.

Parameters
productThe symbol of the product to sell (e.g., "BTC-USD").
quantityThe amount of the product to sell.
Returns
The result of the trade execution.

Implements crypto_trader::protocols::Executor< T >.


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