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

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

Collaboration diagram for slick::trader::Position:

Public Member Functions

 Position ()=default
 Position (std::string_view inst)
bool is_flat () const
bool is_long () const
bool is_short () const
double get_unrealized_pnl (price_t mark_price) const
double get_total_pnl (price_t mark_price) const

Public Attributes

std::string instrument
qty_t quantity {0}
price_t avg_price {0}
price_t realized_pnl {0}
price_t realized_fees {0}
price_t open_fees {0}
double multiplier {1.0}
uint64_t last_update_time {0}

Detailed Description

Definition at line 11 of file position.hpp.

Constructor & Destructor Documentation

◆ Position() [1/2]

slick::trader::Position::Position ( )
default

◆ Position() [2/2]

slick::trader::Position::Position ( std::string_view inst)
inline

Definition at line 22 of file position.hpp.

References instrument.

Member Function Documentation

◆ get_total_pnl()

double slick::trader::Position::get_total_pnl ( price_t mark_price) const
inline

Definition at line 34 of file position.hpp.

References slick::trader::from_price_t(), get_unrealized_pnl(), and realized_pnl.

◆ get_unrealized_pnl()

double slick::trader::Position::get_unrealized_pnl ( price_t mark_price) const
inline

◆ is_flat()

bool slick::trader::Position::is_flat ( ) const
inline

Definition at line 24 of file position.hpp.

References quantity.

Referenced by get_unrealized_pnl().

◆ is_long()

bool slick::trader::Position::is_long ( ) const
inline

Definition at line 25 of file position.hpp.

References quantity.

◆ is_short()

bool slick::trader::Position::is_short ( ) const
inline

Definition at line 26 of file position.hpp.

References quantity.

Member Data Documentation

◆ avg_price

◆ instrument

std::string slick::trader::Position::instrument

◆ last_update_time

uint64_t slick::trader::Position::last_update_time {0}

◆ multiplier

double slick::trader::Position::multiplier {1.0}

◆ open_fees

price_t slick::trader::Position::open_fees {0}

◆ quantity

◆ realized_fees

price_t slick::trader::Position::realized_fees {0}

◆ realized_pnl


The documentation for this struct was generated from the following file: