ATS
An algorithmic trading system completely written in C++
Public Member Functions | List of all members
ats::PositionManager Class Reference

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...
 

Detailed Description

Manages the positions and the PnL of a trading system.

Constructor & Destructor Documentation

◆ PositionManager()

ats::PositionManager::PositionManager ( MarketData marketData)

Constructor that initializes the market data to the given instance.

Parameters
marketDataThe market data to use.

Member Function Documentation

◆ getPnL()

double ats::PositionManager::getPnL ( )

Returns the current PnL of the trading system.

Returns
The current PnL.

◆ getPosition()

double ats::PositionManager::getPosition ( std::string  symbol)

Returns the current position of the given symbol (quantity held).

Parameters
symbolThe symbol of the position to retrieve.
Returns
The current position of the given symbol.

◆ isRunning()

bool ats::PositionManager::isRunning ( )

Returns whether the PositionManager is running.

Returns
True if the PositionManager is running, false otherwise.

◆ updatePosition()

void ats::PositionManager::updatePosition ( std::string  symbol,
double  quantity 
)

Updates the position of the given symbol.

Parameters
symbolThe symbol of the position to update.
quantityThe new quantity of the position.

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