Position size on previous day [-1]
I would like to extract the position size of the "previous day" (using daily data as datafeeds).
To obtain the position of "today" I can use the following, which works well:
As I have several datafeeds I need the [i] to refer to the individual feeds.
However, if I would like to refer to the "previous day" I struggle...
I have tried:
as well as
but both dont work and I couldn't find any hints in the documentation/the forum.
Would be great if someone could point me to a solution!
Positiondoesn't store the actual values of previous days. It only holds the current values of
If you want to reference past positions, you need to keep them yourself.
def __init__(self): self.posis = collections.defaultdict(list) def next(self): [self.posis[d].append(self.getposition(data=d) for d in self.datas]
Of course you can also use a
forloop and avoid the useless list full of
Noneitems which is generated with the one liner