TradeAnalysis#
tradeexecutor.analysis.trade_analyser.TradeAnalysis Python class in Trading Strategy framework.
- class TradeAnalysis[source]#
Bases:
object
Analysis of trades in a portfolio.
Methods
__init__
(portfolio)calculate_summary_statistics
([time_bucket, ...])Calculate some statistics how our trades went.
Create a timeline feed how we traded over a course of time.
Return open and closed positions over all traded assets.
get_capital_tied_at_open
(position)Get the opened_at timestamp of the first position in the portfolio.
Get the closed_at timestamp of the last position in the portfolio.
Return open positions over all traded assets.
Attributes
portfolio
filtered_sorted_positions
- get_all_positions()[source]#
Return open and closed positions over all traded assets.
Positions are sorted by position_id.
- Return type:
- get_open_positions()[source]#
Return open positions over all traded assets.
Positions are sorted by position_id.
- Return type:
- calculate_summary_statistics(time_bucket=None, state=None)[source]#
Calculate some statistics how our trades went.
- Parameters:
time_bucket (Optional[TimeBucket]) – Optional, used to display average duration as ‘number of bars’ instead of ‘number of days’.
state – Optional, should be specified if user would like to see advanced statistics
- Returns:
TradeSummary instance
- Return type: