ATS
An algorithmic trading system completely written in C++
Public Member Functions | Protected Attributes | List of all members
ats::ExchangeManager Class Referenceabstract

The ExchangeManager class is an abstract class that defines the interface for managing orders on an exchange. More...

#include <ExchangeManager.h>

Inheritance diagram for ats::ExchangeManager:
ats::BinanceExchangeManager

Public Member Functions

 ExchangeManager (OrderManager &oms)
 Constructor for ExchangeManager class. More...
 
virtual ~ExchangeManager ()=default
 Virtual destructor for ExchangeManager class.
 
virtual double sendOrder (Order &order)=0
 Sends an order to the exchange. More...
 
virtual void modifyOrder (Order &oldOrder, Order &newOrder)=0
 Modifies an existing order on the exchange. More...
 
virtual void cancelOrder (Order &order)=0
 Cancels an order on the exchange. More...
 
virtual void getOrderStatus (Order &order, Json::Value &result)=0
 Retrieves the status of an order on the exchange. More...
 
virtual std::vector< OrdergetOpenOrders (std::string symbol)=0
 Retrieves a list of open orders on the exchange. More...
 
virtual std::vector< TradegetTradeHistory (std::string symbol)=0
 Retrieves the trade history for a given symbol on the exchange. More...
 
virtual std::map< std::string, double > getBalances ()=0
 Retrieves user balances. More...
 
virtual void getKlines (Json::Value &result, std::string symbol, std::string interval, time_t start_date, time_t end_date, int limit)=0
 Gets Klines for a symbol. More...
 
virtual double getPrice (std::string symbol)=0
 Retrieves the current price for a given symbol on the exchange. More...
 
virtual OrderBook getOrderBook (std::string symbol)=0
 Retrieves the order book. More...
 

Protected Attributes

OrderManagermOrderManager
 

Detailed Description

The ExchangeManager class is an abstract class that defines the interface for managing orders on an exchange.

Constructor & Destructor Documentation

◆ ExchangeManager()

ats::ExchangeManager::ExchangeManager ( OrderManager oms)

Constructor for ExchangeManager class.

Parameters
omsA reference to the OrderManager object.

Member Function Documentation

◆ cancelOrder()

virtual void ats::ExchangeManager::cancelOrder ( Order order)
pure virtual

Cancels an order on the exchange.

Parameters
orderThe order to be cancelled.

Implemented in ats::BinanceExchangeManager.

◆ getBalances()

virtual std::map<std::string,double> ats::ExchangeManager::getBalances ( )
pure virtual

Retrieves user balances.

Returns
A map of pairs {asset, balance}.

Implemented in ats::BinanceExchangeManager.

◆ getKlines()

virtual void ats::ExchangeManager::getKlines ( Json::Value &  result,
std::string  symbol,
std::string  interval,
time_t  start_date,
time_t  end_date,
int  limit 
)
pure virtual

Gets Klines for a symbol.

Parameters
resultJson object to write the response to
symbolSymbol to get the Klines for
intervalKline interval
start_dateStart date
end_dateEnd date
limitLimit, should be less than or equal to 1000

Implemented in ats::BinanceExchangeManager.

◆ getOpenOrders()

virtual std::vector<Order> ats::ExchangeManager::getOpenOrders ( std::string  symbol)
pure virtual

Retrieves a list of open orders on the exchange.

Parameters
symbolThe symbol to get the orders for, all open orders if omitted.
Returns
A vector of open orders.

Implemented in ats::BinanceExchangeManager.

◆ getOrderBook()

virtual OrderBook ats::ExchangeManager::getOrderBook ( std::string  symbol)
pure virtual

Retrieves the order book.

Parameters
symbolThe symbol to retrieve the order book for.
Returns
The bid and ask vectors.

Implemented in ats::BinanceExchangeManager.

◆ getOrderStatus()

virtual void ats::ExchangeManager::getOrderStatus ( Order order,
Json::Value &  result 
)
pure virtual

Retrieves the status of an order on the exchange.

Parameters
orderThe order to check the status of.
resultA Json::Value object to store the order status information.

Implemented in ats::BinanceExchangeManager.

◆ getPrice()

virtual double ats::ExchangeManager::getPrice ( std::string  symbol)
pure virtual

Retrieves the current price for a given symbol on the exchange.

Parameters
symbolThe symbol to retrieve the price for.
Returns
The current price of the symbol.

Implemented in ats::BinanceExchangeManager.

◆ getTradeHistory()

virtual std::vector<Trade> ats::ExchangeManager::getTradeHistory ( std::string  symbol)
pure virtual

Retrieves the trade history for a given symbol on the exchange.

Parameters
symbolThe symbol to retrieve the trade history for.
Returns
A vector of Trade objects representing the trade history.

Implemented in ats::BinanceExchangeManager.

◆ modifyOrder()

virtual void ats::ExchangeManager::modifyOrder ( Order oldOrder,
Order newOrder 
)
pure virtual

Modifies an existing order on the exchange.

Parameters
oldOrderThe original order.
newOrderThe modified order.

Implemented in ats::BinanceExchangeManager.

◆ sendOrder()

virtual double ats::ExchangeManager::sendOrder ( Order order)
pure virtual

Sends an order to the exchange.

Parameters
orderThe order to be sent to the exchange.
Returns
Filled quantity.

Implemented in ats::BinanceExchangeManager.

Member Data Documentation

◆ mOrderManager

OrderManager& ats::ExchangeManager::mOrderManager
protected

A reference to the OrderManager the EMS will be retrieving orders from


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