|
crypto_trader
Cryptocurrency Trading Bot API Documentation
|
Manages the accounting of trading activities, tracking positions and PnL. More...
#include <Accounting.h>

Public Types | |
| using | PositionMap |
Public Member Functions | |
| void | apply_event (const Event &e) |
| Applies a single trade event to update the accounting state. | |
| const PositionMap & | snapshot () const |
| Provides a const reference to the current snapshot of all positions. | |
| void | replay_events (const std::vector< Event > &events) |
| Replays a vector of historical events to reconstruct the accounting state. Clears all current positions and event logs before replaying. | |
| Accounting ()=default | |
| Constructs an empty Accounting object. | |
Manages the accounting of trading activities, tracking positions and PnL.
This class processes trade events to maintain an accurate record of holdings, average prices, and realized profit/loss for various trading symbols.
Map from symbol string to its aggregated positions.
|
default |
Constructs an empty Accounting object.
| void crypto_trader::common::Accounting::apply_event | ( | const Event & | e | ) |
Applies a single trade event to update the accounting state.
| e | The trade event to apply. |
| void crypto_trader::common::Accounting::replay_events | ( | const std::vector< Event > & | events | ) |
Replays a vector of historical events to reconstruct the accounting state. Clears all current positions and event logs before replaying.
| events | A vector of historical trade events. |
| const Accounting::PositionMap & crypto_trader::common::Accounting::snapshot | ( | ) | const |
Provides a const reference to the current snapshot of all positions.