For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Single strategy and single position on multi data
-
Hi,
I cant properly set a strategy that has multi data feed (ie the components of sp500) and inside of next() method i ahve put a function call to my personal model .
in next method I am tryingdef my_f(self, x): y = randn() #ie my strategy called on data x return y def next(self): if self.order: return ret={} for d in self.datas: ret[d]=self.my_f(d) best_stock = min(ret, key=ret.get) ...... if not self.position: self.buy(data=d,.....)
It doesnt work and it use just a small part of the dataset (ie I have data from 2019-2022, but i see only trades on the last 30 days)
If i run the strategy for each single data feed it worksbest