SpotTrade#
tradingstrategy.analysis.tradeanalyzer.SpotTrade Python class in Trading Strategy framework.
- class SpotTrade[source]#
Bases:
object
Track spot trades to construct position performance.
For sells, quantity is negative.
- __init__(trade_id, pair_id, timestamp, price, quantity, commission, slippage, hint=None, state_details=None)#
Methods
__init__
(trade_id, pair_id, timestamp, ...)is_buy
()is_sell
()Attributes
Any hints applied for this trade why it was performed
Internal state dump of the algorithm when this trade was made.
value
Internal running counter to uniquely label all trades in trade analysis
Trading pair for this trade
When this trade was made, the backtes simulation thick
Asset price at buy in
How much we bought the asset.
How much fees we paid to the exchange
How much we lost against the midprice due to the slippage
- state_details: Optional[Dict] = None#
Internal state dump of the algorithm when this trade was made. This is mostly useful when doing the trade analysis try to understand why some trades were made. It also allows you to reconstruct the portfolio state over the time.
- __init__(trade_id, pair_id, timestamp, price, quantity, commission, slippage, hint=None, state_details=None)#