TradeAnalyzer#
tradingstrategy.analysis.tradeanalyzer.TradeAnalyzer Python class in Trading Strategy framework.
- class TradeAnalyzer[source]#
Bases:
object
Analysis of trades in a portfolio.
- __init__(asset_histories=<factory>)#
- Parameters:
asset_histories (Dict[object, AssetTradeHistory]) –
- Return type:
None
Methods
__init__
([asset_histories])calculate_summary_statistics
(initial_cash, ...)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_first_opened_at
()get_last_closed_at
()Return open and closed positions over all traded assets.
Attributes
How a particular asset traded.
- asset_histories: Dict[object, AssetTradeHistory]#
How a particular asset traded. Asset id -> Asset history mapping
- calculate_summary_statistics(initial_cash, uninvested_cash, extra_return=0)[source]#
Calculate some statistics how our trades went.
- Return type:
- create_timeline()[source]#
Create a timeline feed how we traded over a course of time.
Note: We assume each position has only one enter and exit event, not position increases over the lifetime.
- Returns:
DataFrame with timestamp and timeline_event columns
- Return type:
- __init__(asset_histories=<factory>)#
- Parameters:
asset_histories (Dict[object, AssetTradeHistory]) –
- Return type:
None