AssetTradeHistory#
tradeexecutor.analysis.trade_analyser.AssetTradeHistory Python class in Trading Strategy framework.
- class AssetTradeHistory[source]#
Bases:
object
How a particular asset traded.
Each position can have increments or decrements. When position is decreased to zero, it is considered closed, and a new buy open a new position.
- __init__(positions=<factory>)#
- Parameters:
positions (List[TradePosition]) –
- Return type:
None
Methods
__init__
([positions])add_trade
(t[, position_id])Adds a new trade to the asset history.
get_first_opened_at
()get_last_closed_at
()Attributes
positions
- add_trade(t, position_id=None)[source]#
Adds a new trade to the asset history.
If there is an open position the trade is added against this, otherwise a new position is opened for tracking.
- __init__(positions=<factory>)#
- Parameters:
positions (List[TradePosition]) –
- Return type:
None