Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Oanda store cancel Order: oref is not defined

    General Code/Help
    2
    3
    875
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      ThatBlokeDave last edited by

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

      I am using backtrader: 1.9.36.116

      Tested using my own script then confirmed with oandatest.py. See below

      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:
      {'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/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 548, in _t_order_cancel
          if oref is None:
      NameError: name 'oref' is not defined
      
      
      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        https://github.com/mementum/backtrader/commit/9fc9a2878c536c7ec7d60766aaf01ac936e90858

        1 Reply Last reply Reply Quote 0
        • B
          backtrader administrators last edited by

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

          https://github.com/mementum/backtrader/commit/ec568a957d38492aa4f4de67a764958ad6920ac7

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
          $(document).ready(function () { app.coldLoad(); }); }