For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Oanda store cancel Order: oref is not defined

  • I am getting this error when cancelling an order using the oanda store.

    I am using backtrader:

    Tested using my own script then confirmed with See below

    python3 --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:
    {'displayName': 'GBP/USD', 'maxTradeUnits': 10000000, 'pip': '0.0001', 'instrument': 'GBP_USD'}
    Datetime, Open, High, Low, Close, Volume, OpenInterest, SMA
    ***** DATA NOTIF: LIVE
    Data0, 0001, 736419.077083, 2017-03-31T01:51:00.000000, 1.248650, 1.248650, 1.248650, 1.248650,      0, 0, nan
    -------------------------------------------------- ORDER BEGIN 2017-03-31 09:52:00.095312
    Ref: 1
    OrdType: 0
    OrdType: Buy
    Status: 1
    Status: Submitted
    Size: 1000
    Price: 1.2436500000000001
    Price Limit: None
    TrailAmount: None
    TrailPercent: None
    ExecType: 2
    ExecType: Limit
    CommInfo: <backtrader.comminfo.CommInfoBase object at 0x7f94055b65f8>
    End of Session: 736419.9999999999
    Info: AutoOrderedDict([('trailamount', None), ('trailpercent', None), ('oco', None)])
    Broker: <backtrader.brokers.oandabroker.OandaBroker object at 0x7f9403d93358>
    Alive: True
    -------------------------------------------------- ORDER END
    Data0, 0002, 736419.077778, 2017-03-31T01:52:00.000000, 1.248670, 1.249000, 1.248660, 1.249000,      0, 0, nan
    Exception in thread Thread-5:
    Traceback (most recent call last):
      File "/usr/lib/python3.5/", line 914, in _bootstrap_inner
      File "/usr/lib/python3.5/", line 862, in run
        self._target(*self._args, **self._kwargs)
      File "/home/dave/.local/lib/python3.5/site-packages/backtrader/stores/", line 548, in _t_order_cancel
        if oref is None:
    NameError: name 'oref' is not defined

  • administrators

  • administrators

    Although for the sake of naming consistency, go for this second commit

Log in to reply