crypto_trader
Cryptocurrency Trading Bot API Documentation
Loading...
Searching...
No Matches
crypto_trader::protocols::Executor< T > Class Template Referenceabstract

Abstract base class defining the interface for trade execution. More...

#include <executor.h>

Inheritance diagram for crypto_trader::protocols::Executor< T >:
Inheritance graph
Collaboration diagram for crypto_trader::protocols::Executor< T >:
Collaboration graph

Public Member Functions

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

Detailed Description

template<common::MarketData T>
class crypto_trader::protocols::Executor< T >

Abstract base class defining the interface for trade execution.

Template Parameters
TThe MarketData type that the executor processes.

Constructor & Destructor Documentation

◆ ~Executor()

template<common::MarketData T>
virtual crypto_trader::protocols::Executor< T >::~Executor ( )
virtualdefault

Destructor for the Executor interface.

Member Function Documentation

◆ buy()

template<common::MarketData T>
virtual common::TradeResult crypto_trader::protocols::Executor< T >::buy ( const std::string_view & product,
double quantity )
pure virtual

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.

Implemented in crypto_trader::executors::PaperTradingExecutor< T >, and crypto_trader::executors::RealTradingExecutor< T >.

◆ getBalance()

template<common::MarketData T>
virtual double crypto_trader::protocols::Executor< T >::getBalance ( const std::string_view & currency) const
pure virtual

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.

Implemented in crypto_trader::executors::PaperTradingExecutor< T >, and crypto_trader::executors::RealTradingExecutor< T >.

◆ getPosition()

template<common::MarketData T>
virtual std::optional< double > crypto_trader::protocols::Executor< T >::getPosition ( const std::string_view & product) const
pure virtual

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.

Implemented in crypto_trader::executors::PaperTradingExecutor< T >, and crypto_trader::executors::RealTradingExecutor< T >.

◆ processTickerData()

template<common::MarketData T>
virtual void crypto_trader::protocols::Executor< T >::processTickerData ( const std::string_view & product,
double price,
const T::Timestamp & timestamp )
pure virtual

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.

Implemented in crypto_trader::executors::PaperTradingExecutor< T >, and crypto_trader::executors::RealTradingExecutor< T >.

◆ sell()

template<common::MarketData T>
virtual common::TradeResult crypto_trader::protocols::Executor< T >::sell ( const std::string_view & product,
double quantity )
pure virtual

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.

Implemented in crypto_trader::executors::PaperTradingExecutor< T >, and crypto_trader::executors::RealTradingExecutor< T >.


The documentation for this class was generated from the following file:
  • /home/runner/work/crypto_trader/crypto_trader/protocols/executor.h