statistics#

tradeexecutor.state.statistics Python module in Trading Strategy framework.

Module description#

Various statistics calculated across portfolios and positions.

Statistics are calculated/refreshed on the server-side and exported as a part of the state. This way the clients (JavaScript) do not need to reconstruct this information.

Any statistics are optional: they are not needed to make any state transitions, they are purely there for profit and loss calculations.

Classes#

FinalPositionStatistics

When position is closed, its final statistics are calculated.

PortfolioStatistics

Portfolio statistics for each timepoint.

PositionStatistics

Time-series of statistics calculated for each open position.

Statistics

Statistics for a trade execution state.

Functions#

calculate_naive_profitability(...[, ...])

Calculate the profitability as value at end - value at start.