backtesting.py icon indicating copy to clipboard operation
backtesting.py copied to clipboard

Buy order not creating a position ?

Open valentin-fngr opened this issue 4 months ago • 0 comments

Expected Behavior

Hi, here is the simplest strategy code you can ever imagine :

class newStrategy(Strategy):
        

    def next(self):
        if not self.position:
            self.buy()
            assert self.position

I am not passing the assert ! Meaning that self.buy() is not creating a position. Am I not understanding something ?

valentin-fngr avatar Oct 02 '24 14:10 valentin-fngr