kernc / backtesting.py

:mag_right: :chart_with_upwards_trend: :snake: :moneybag: Backtest trading strategies in Python.
https://kernc.github.io/backtesting.py/
GNU Affero General Public License v3.0
5.06k stars 990 forks source link

AssertionError #1005

Open dpblnt opened 1 year ago

dpblnt commented 1 year ago

Expected Behavior

order get canceled

Actual Behavior

(<Order size=-4.0, contingent=1>, <Order size=-4.0, stop=22768.95979, contingent=1>)
    for order in self.orders: order.cancel()
  File "/usr/local/lib/python3.8/dist-packages/backtesting/backtesting.py", line 420, in cancel
    assert False
AssertionError

Steps to Reproduce


            if(len(self.orders)>0):
                print(self.orders)
            for order in self.orders: order.cancel()

Additional info

kernc commented 1 year ago

Can you show some code (MWE) that I can run to reproduce the issue?

AhmadSherief commented 10 months ago

I am also facing this issue in version 0.3.3, I cannot cancel any orders.

Which older version can I use for now to test the "cancel order" functionality?