pub struct FullAccountTracker { /* private fields */ }
Expand description

Keep track of many possible Account performance statistics This can be quite memory intensive, easily reaching beyond 10GB if using tick-by-tick data due to the storage of many returns

Implementations

Create a new AccTracker struct

Vector of absolute returns the account has generated, including unrealized pnl # Parameters source: the sampling interval of pnl snapshots

Vector of natural logarithmic returns the account has generated, including unrealized pnl # Parameters source: the sampling interval of pnl snapshots

Ratio of cumulative trade profit over cumulative trade loss

Cumulative fees paid to the exchange

Would be return of buy and hold strategy

Would be return of sell and hold strategy

Return the sharpe ratio using the selected returns as source

Parameters:

returns_source: the sampling interval of pnl snapshots risk_free_is_buy_and_hold: if true, it will use the market returns as the risk-free comparison else risk-free rate is zero

Return the Sortino ratio based on daily returns data

Parameters:

returns_source: the sampling interval of pnl snapshots risk_free_is_buy_and_hold: if true, it will use the market returns as the risk-free comparison else risk-free rate is zero

Calculate the value at risk using the percentile method on daily returns multiplied by starting wallet balance The time horizon N is assumed to be 1 The literature says if you want a larger N, just multiply by N.sqrt(), which assumes standard normal distribution # Arguments returns_source: the sampling interval of pnl snapshots percentile: value between [0.0, 1.0], smaller value will return more worst case results

Calculate the historical value at risk from n consequtive hourly return values, This should have better statistical properties compared to using daily returns due to having more samples. Set n to 24 for daily value at risk, but with 24x more samples from which to take the percentile, giving a more accurate VaR

Parameters:

n: number of hourly returns to use percentile: value between [0.0, 1.0], smaller value will return more worst case results

Calculate the cornish fisher value at risk based on daily returns of the account # Arguments returns_source: the sampling interval of pnl snapshots percentile: in range [0.0, 1.0], usually something like 0.01 or 0.05

Calculate the corni fisher value at risk from n consequtive hourly return values This should have better statistical properties compared to using daily returns due to having more samples. Set n to 24 for daily value at risk, but with 24x more samples from which to take the percentile, giving a more accurate VaR

Parameters:

n: number of hourly returns to use percentile: value between [0.0, 1.0], smaller value will return more worst case results

Return the number of trading days

Also called discriminant-ratio, which focuses on the added value of the algorithm It uses the Cornish-Fish Value at Risk (CF-VaR) It better captures the risk of the asset as it is not limited by the assumption of a gaussian distribution It it time-insensitive from: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3927058

Parameters

returns_source: the sampling interval of pnl snapshots

Annualized return on investment as a factor, e.g.: 100% -> 2x

Maximum drawdown of the wallet balance

Maximum drawdown of the wallet balance including unrealized profit and loss

Return the number of trades the account made

Return the ratio of executed trades vs total trading opportunities Higher values means a more active trading agent

Return the ratio of buy trades vs total number of trades

Return the cumulative turnover denoted in margin currency

Return the total realized profit and loss of the account

Return the current unrealized profit and loss

Return the ratio of winning trades vs all trades

Return the ratio of filled limit orders vs number of submitted limit orders

Return the ratio of limit order cancellations vs number of submitted limit orders

Trait Implementations

Update with each tick, using data provided in update_state method of Exchange # Arguments timestamp: timestamp of latest tick price: price of latest tick upnl: unrealized profit and loss of account in current tick Read more

Log a realized profit and loss event

Log a fee event

Log a limit order submission event

Log a limit order cancellation event

Log a limit order fill event

Log a trade event where some order got filled and the position changed

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.