12 #ifndef ATS_POSITIONMANAGER_H
13 #define ATS_POSITIONMANAGER_H
16 #include <unordered_map>
56 std::thread mPositionManagerThread;
58 std::unordered_map<std::string, Position> mOpenPositions;
60 std::mutex mPositionMutex;
Contains the declaration of the MarketData class, which handles the streaming of market data for the ...
Handles the streaming of market data for the trading system.
Definition: MarketData.h:54
Manages the positions and the PnL of a trading system.
Definition: PositionManager.h:53
void run()
Runs the PositionManager loop.
Definition: PositionManager.cpp:24
void start()
Starts the PositionManager thread.
Definition: PositionManager.cpp:19
~PositionManager()
Destructor that stops the PositionManager if it is running.
Definition: PositionManager.cpp:15
void updatePosition(std::string symbol, double quantity)
Updates the position of the given symbol.
Definition: PositionManager.cpp:49
PositionManager()
Default constructor that initializes the market data to a default instance.
double getPnL()
Returns the current PnL of the trading system.
Definition: PositionManager.cpp:39
void stop()
Stops the PositionManager thread.
Definition: PositionManager.cpp:29
double getPosition(std::string symbol)
Returns the current position of the given symbol (quantity held).
Definition: PositionManager.cpp:43
bool isRunning()
Returns whether the PositionManager is running.
Definition: PositionManager.cpp:35
Namespace for the algorithmic trading system.
Definition: BinanceExchangeManager.cpp:8
Represents a position with its quantity and price.
Definition: PositionManager.h:25
double total()
Calculates the total value of the position.
Definition: PositionManager.h:45
Position()
Default constructor that initializes the quantity and price to 0.
Definition: PositionManager.h:32
double quantity
Quantity of the position.
Definition: PositionManager.h:26
double price
Price of the position.
Definition: PositionManager.h:27
Position(double q, double p)
Constructor that initializes the quantity and price to the given values.
Definition: PositionManager.h:39