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

Backtrader, oandapy and OandaError issues



  • I am having trouble with importing backtrader as bt. I currently have Python 3.7.3 on my pc. I am stuck here:

    import backtrader as bt

    I get the following error:
    ~Anaconda3\kub\site-packages\stores\oandastotre.py in <module>
    39 # Extend the exception to support extras cases
    40
    41 class OandaRequestError(oandapy.OandaError):
    42 def init(self):
    43 er = dict(code=599, message='Request Error', description=' ')

    AttributeError: module 'oandapy' has no attribute 'OandaError'

    I have tried to uninstall the packages multiple times. backtrader was working for me until i updated to the current version. Is there a package that I am missing and how do I get it back working.

    I have been working with the program for a while with no issues and I do not know how to fix this issue.

    Thank you.


  • administrators

    Your problem is that you have upgraded oandapy to something which isn't what's needed.



  • I'm having the same problem as @Jammawind - current version of oandapy is 0.0.9, I tried reinstalling previous versions of oandapy (0.0.8, 0.0.7, 0.0.5 (no 6 for some reason), and so on), but got the same error for all.

    The oandapy repo shows the OandaError attribute in the current version, so not sure what's going on.

    @backtrader can't make much progress in the QuickStart if the module won't load. Thanks! :)


  • administrators

    Let me venture into the crystall ball territory ... you did

    pip install oandapy
    

    (Yes I know, my crystal ball is incredible ... but it doesn't work with lottery numbers unfortunately)

    The documentation explicitly states (Docs - Oanda)

    pip install git+https://github.com/oanda/oandapy.git
    

    Hopefully you see the difference. Furthermore, you are installing something for Oanda REST v20 which isn't supported by the built-in functionality.

    That's why another part of the website lists 3rd party resources such as

    @elihubogan said in Backtrader, oandapy and OandaError issues:

    can't make much progress in the QuickStart if the module won't load

    The Quickstart doesn't reference Oanda.



  • I made the same mistake and I'm unable to uninstalll oandapy or install the correct package from git. Any ideas on what to do?


  • administrators

    Find the directory where your python packages are installed, delete the wrong oandapy and proceed to install again.


Log in to reply
 

});