trade historyon
-
Hello,
In the documentation for a trade. There is a keyword argument to sethistoryon
for a trade. Where / when should this be set to activate history?https://www.backtrader.com/docu/trade.html?highlight=historyon#reference-trade
A search for
historyon
only directs me to the one page. Perhaps whenjustopened
is called?Thanks!
-
A trade can be the sum of several orders. For example:
- 5 orders that add each 10 items
- 2 orders reduce 10 items each
- 3 new orders add 15 items
- A final order reduces the trade down to 0 from 75 items
With
historyon
, each order is recorded inside theTrade
object which is in charge of tracking that trade.When? When you want and you need it.
You activate it in
cerebro
withtradehistory
. See Docs - Cerebro
-
Great thanks! I didn't spot it in the cerebro docs since it has a different keyword name.
My "when" question was more in relation to when in the life of a script / backtest. You answered that thanks. I should set it when setting up cerebro or within the strategy using the
set_tradehistory
method.Appreciate the info!
-
Great thanks, I was wondering the exact same thing!