Slick Trader 0.11.0
Multi-broker algorithmic trading engine with plugin strategies and a live web dashboard
Loading...
Searching...
No Matches
slick::trader::PnLCalculator Class Reference

#include <slick-trader/core/pnl_calculator.hpp>

Collaboration diagram for slick::trader::PnLCalculator:

Public Member Functions

 PnLCalculator (PositionTracker &position_tracker)
 ~PnLCalculator ()=default
void update_mark_price (const std::string &instrument, price_t price, uint64_t timestamp_ns)
void update_top_of_book (const std::string &instrument, price_t bid, price_t ask, uint64_t timestamp_ns)
PnLSnapshot calculate_pnl (const std::string &strategy_id, uint64_t timestamp_ns) const
std::unordered_map< std::string, PnLSnapshot > calculate_all_pnl (uint64_t timestamp_ns) const
price_t get_mark_price (const std::string &instrument) const
bool has_mark_price (const std::string &instrument) const

Detailed Description

Definition at line 30 of file pnl_calculator.hpp.

Constructor & Destructor Documentation

◆ PnLCalculator()

slick::trader::PnLCalculator::PnLCalculator ( PositionTracker & position_tracker)
inlineexplicit

Definition at line 32 of file pnl_calculator.hpp.

◆ ~PnLCalculator()

slick::trader::PnLCalculator::~PnLCalculator ( )
default

Member Function Documentation

◆ calculate_all_pnl()

std::unordered_map< std::string, PnLSnapshot > slick::trader::PnLCalculator::calculate_all_pnl ( uint64_t timestamp_ns) const

Definition at line 100 of file pnl_calculator.cpp.

References calculate_pnl().

◆ calculate_pnl()

◆ get_mark_price()

price_t slick::trader::PnLCalculator::get_mark_price ( const std::string & instrument) const

Definition at line 40 of file pnl_calculator.cpp.

◆ has_mark_price()

bool slick::trader::PnLCalculator::has_mark_price ( const std::string & instrument) const

Definition at line 51 of file pnl_calculator.cpp.

◆ update_mark_price()

void slick::trader::PnLCalculator::update_mark_price ( const std::string & instrument,
price_t price,
uint64_t timestamp_ns )

Definition at line 20 of file pnl_calculator.cpp.

◆ update_top_of_book()

void slick::trader::PnLCalculator::update_top_of_book ( const std::string & instrument,
price_t bid,
price_t ask,
uint64_t timestamp_ns )

Definition at line 29 of file pnl_calculator.cpp.


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