|
Slick Trader 0.11.0
Multi-broker algorithmic trading engine with plugin strategies and a live web dashboard
|
#include <slick-trader/core/pnl_calculator.hpp>
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 |
Definition at line 30 of file pnl_calculator.hpp.
|
inlineexplicit |
Definition at line 32 of file pnl_calculator.hpp.
|
default |
| 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().
| PnLSnapshot slick::trader::PnLCalculator::calculate_pnl | ( | const std::string & | strategy_id, |
| uint64_t | timestamp_ns ) const |
Definition at line 56 of file pnl_calculator.cpp.
References slick::trader::PnLSnapshot::realized_pnl, slick::trader::PnLSnapshot::strategy_id, slick::trader::PnLSnapshot::timestamp_ns, slick::trader::to_price_t(), slick::trader::PnLSnapshot::total_fees, slick::trader::PnLSnapshot::total_pnl, and slick::trader::PnLSnapshot::unrealized_pnl.
Referenced by calculate_all_pnl().
| price_t slick::trader::PnLCalculator::get_mark_price | ( | const std::string & | instrument | ) | const |
Definition at line 40 of file pnl_calculator.cpp.
| bool slick::trader::PnLCalculator::has_mark_price | ( | const std::string & | instrument | ) | const |
Definition at line 51 of file pnl_calculator.cpp.
| 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.
| 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.