Oandatest.py: TypeError: cancel() takes 1 positional argument but 2 were given



  • When cancelling orders, I get the error noted in the title.

    backtrader version: 1.9.39.116

    See below for arguments used on the script.

    python3 oandatest.py --account REMOVED --token REMOVED --data0 GBP_USD --resample --timeframe Minutes --compression 1 --no-backfill_start --exectype Limit --cancel 1 --stake 1000 --trade --broker
    --------------------------------------------------
    Strategy Created
    --------------------------------------------------
    -- Contract Details:
    {'instrument': 'GBP_USD', 'displayName': 'GBP/USD', 'maxTradeUnits': 10000000, 'pip': '0.0001'}
    Datetime, Open, High, Low, Close, Volume, OpenInterest, SMA
    ***** DATA NOTIF: LIVE
    Data0, 0001, 736424.157639, 2017-04-05T03:47:00.000000, 1.244250, 1.244250, 1.244250, 1.244250,      0, 0, nan
    -------------------------------------------------- ORDER BEGIN 2017-04-05 11:50:00.379197
    Ref: 1
    OrdType: 0
    OrdType: Buy
    Status: 1
    Status: Submitted
    Size: 1000
    Price: 1.2392500000000002
    Price Limit: None
    TrailAmount: None
    TrailPercent: None
    ExecType: 2
    ExecType: Limit
    CommInfo: <backtrader.comminfo.CommInfoBase object at 0x7f84ce10c748>
    End of Session: 736424.9999999999
    Info: AutoOrderedDict([('trailamount', None), ('trailpercent', None), ('transmit', True), ('oco', None), ('parent', None)])
    Broker: <backtrader.brokers.oandabroker.OandaBroker object at 0x7f84cc8eaa58>
    Alive: True
    -------------------------------------------------- ORDER END
    -------------------------------------------------- ORDER BEGIN 2017-04-05 11:50:00.379703
    Ref: 1
    OrdType: 0
    OrdType: Buy
    Status: 2
    Status: Accepted
    Size: 1000
    Price: 1.2392500000000002
    Price Limit: None
    TrailAmount: None
    TrailPercent: None
    ExecType: 2
    ExecType: Limit
    CommInfo: <backtrader.comminfo.CommInfoBase object at 0x7f84ce10c748>
    End of Session: 736424.9999999999
    Info: AutoOrderedDict([('trailamount', None), ('trailpercent', None), ('transmit', True), ('oco', None), ('parent', None)])
    Broker: None
    Alive: True
    -------------------------------------------------- ORDER END
    Data0, 0002, 736424.159722, 2017-04-05T03:50:00.000000, 1.244320, 1.244530, 1.244300, 1.244520,      0, 0, nan
    Exception in thread Thread-5:
    Traceback (most recent call last):
      File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
        self.run()
      File "/usr/lib/python3.5/threading.py", line 862, in run
        self._target(*self._args, **self._kwargs)
      File "/home/dave/.local/lib/python3.5/site-packages/backtrader/stores/oandastore.py", line 559, in _t_order_cancel
        self.broker._cancel(oref)
      File "/home/dave/.local/lib/python3.5/site-packages/backtrader/brokers/oandabroker.py", line 185, in _cancel
        order.cancel(self)
    TypeError: cancel() takes 1 positional argument but 2 were given
    
    
    

  • administrators


Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.