ATS
An algorithmic trading system completely written in C++
|
Manages the positions and the PnL of a trading system. More...
#include <PositionManager.h>
Public Member Functions | |
PositionManager () | |
Default constructor that initializes the market data to a default instance. | |
PositionManager (MarketData &marketData) | |
Constructor that initializes the market data to the given instance. More... | |
~PositionManager () | |
Destructor that stops the PositionManager if it is running. | |
void | start () |
Starts the PositionManager thread. | |
void | run () |
Runs the PositionManager loop. | |
void | stop () |
Stops the PositionManager thread. | |
bool | isRunning () |
Returns whether the PositionManager is running. More... | |
double | getPnL () |
Returns the current PnL of the trading system. More... | |
double | getPosition (std::string symbol) |
Returns the current position of the given symbol (quantity held). More... | |
void | updatePosition (std::string symbol, double quantity) |
Updates the position of the given symbol. More... | |
Manages the positions and the PnL of a trading system.
ats::PositionManager::PositionManager | ( | MarketData & | marketData | ) |
Constructor that initializes the market data to the given instance.
marketData | The market data to use. |
double ats::PositionManager::getPnL | ( | ) |
Returns the current PnL of the trading system.
double ats::PositionManager::getPosition | ( | std::string | symbol | ) |
Returns the current position of the given symbol (quantity held).
symbol | The symbol of the position to retrieve. |
bool ats::PositionManager::isRunning | ( | ) |
Returns whether the PositionManager is running.
void ats::PositionManager::updatePosition | ( | std::string | symbol, |
double | quantity | ||
) |
Updates the position of the given symbol.
symbol | The symbol of the position to update. |
quantity | The new quantity of the position. |