Handles the streaming of market data for the trading system.
More...
#include <MarketData.h>
Handles the streaming of market data for the trading system.
◆ MarketData() [1/2]
ats::MarketData::MarketData |
( |
ExchangeManager & |
ems, |
|
|
time_t |
updateInterval = 1 |
|
) |
| |
Constructs a new MarketData object.
- Parameters
-
ems | A reference to the ExchangeManager object used to retrieve market data. |
updateInterval | The interval between updates of local data, defaults to 1s. |
◆ MarketData() [2/2]
ats::MarketData::MarketData |
( |
const std::vector< std::string > & |
symbols, |
|
|
ExchangeManager & |
ems, |
|
|
time_t |
updateInterval = 1 |
|
) |
| |
|
explicit |
Constructs a new MarketData object.
- Parameters
-
symbols | A vector of symbols to subscribe to for market data. |
ems | A reference to the ExchangeManager object used to retrieve market data. |
updateInterval | The interval between updates of local data, defaults to 1s. |
◆ getBalances()
std::map< std::string, double > ats::MarketData::getBalances |
( |
| ) |
|
Retrives user's balances.
- Returns
- Map of pairs {asset, balance}.
◆ getKlines()
Klines ats::MarketData::getKlines |
( |
const std::string & |
symbol, |
|
|
const std::string & |
interval |
|
) |
| |
Retrieves Kline data.
- Parameters
-
symbol | Symbol for which to get the Kline data. |
interval | Interval for the Klines. |
- Returns
- The requested Kline data.
◆ getOrderBook()
OrderBook ats::MarketData::getOrderBook |
( |
const std::string & |
symbol | ) |
|
Retrieves the OrderBook.
- Parameters
-
symbol | Symbol for which to get the order book. |
- Returns
- Current OrderBook.
◆ getOrderStatus()
std::string ats::MarketData::getOrderStatus |
( |
long |
id, |
|
|
const std::string & |
symbol |
|
) |
| |
Retrieves order status.
- Parameters
-
- Returns
- Order status
◆ getPrice()
double ats::MarketData::getPrice |
( |
const std::string & |
symbol | ) |
|
Retrieves the current price for a symbol.
- Parameters
-
symbol | The symbol to retrieve the price for. |
- Returns
- The current price for the symbol.
◆ getPrices()
std::vector< double > ats::MarketData::getPrices |
( |
const std::string & |
symbol | ) |
|
Returns prices recorded for a symbol.
- Parameters
-
symbol | The symbol to retrieve the prices for. |
- Returns
- The vector of prices recorded.
◆ getQtyForPrice()
double ats::MarketData::getQtyForPrice |
( |
const std::string & |
symbol, |
|
|
double |
price |
|
) |
| |
Retrieves the quantity for a given price and symbol.
- Parameters
-
symbol | The symbol to retrieve the quantity for. |
price | The price to retrieve the quantity for. |
- Returns
- The quantity for the given price and symbol.
◆ getTradeHistory()
std::vector< Trade > ats::MarketData::getTradeHistory |
( |
const std::string & |
symbol | ) |
|
Returns trade history for a symbol.
- Parameters
-
symbol | The symbol to retrieve the history for. |
- Returns
- The vector of trades.
◆ isRunning()
bool ats::MarketData::isRunning |
( |
| ) |
|
Checks whether the market data stream is running.
- Returns
- True if the market data stream is running, false otherwise.
◆ subscribe()
void ats::MarketData::subscribe |
( |
const std::string & |
symbol, |
|
|
std::string |
interval = "3m" |
|
) |
| |
Subscribes to a symbol for market data.
- Parameters
-
symbol | The symbol to subscribe to. |
interval | The interval for the Kline we want to subscribe to |
◆ unsubscribe()
void ats::MarketData::unsubscribe |
( |
const std::string & |
symbol | ) |
|
Unsubscribes from a symbol for market data.
- Parameters
-
symbol | The symbol to unsubscribe from. |
The documentation for this class was generated from the following files: