Hello all,
As the title suggests I am having difficulty creating a boolean condition inside OnData to check if a current bar represents the beginning of a new year compared to the previous bar
def OnData(self, data):
if not self.Portfolio.Invested: #initialise holdings at backtest start
self.SetHoldings(self.vti, 0.3)
if ' ' ' boolean to compare current datetime with previous bar datetime' ' ' :
self.SetHoldings(self.vti, 0.3)
Has anyone got an example of how to check this?
Thank you in advance
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!