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 & OANDA



  • Hi,
    I am trying to use the OANDA data feed to run a minimal example.

    First of all I have noticed that the documentation make you install oandapy, which seems to be the old version of the Oanda API. I am wondering if backtrader can also work with the V20 new APIs of OANDA or not.

    Anyway I tried running a simple example but it seems that my strategy is just not being called and no operations are performed:

    cerebro = bt.Cerebro(optreturn=False)
    
    cerebro.addstrategy(BollingerBounce)
    oandastore = bt.stores.OandaStore(token=oanda_access_token, account=acc, practice=True)
    data = oandastore.getdata(dataname='EUR_USD',
                               compression=1,
                               backfill=False,
                               #fromdate=datetime.datetime(2017, 3, 1),
                               #todate=datetime.datetime(2017, 12, 31),
                               qcheck=0.5,
                               timeframe=bt.TimeFrame.Minutes,
                               backfill_start=False,
                               historical=False)
    
    
    # Add the Data Feed to Cerebro
    cerebro.adddata(data)
    
    cerebro.broker.setcash(10000.0)
    
    # Add a FixedSize sizer according to the stake
    cerebro.addsizer(bt.sizers.FixedSize, stake=10)
    
    cerebro.broker.setcommission(commission=0.001)
    
    print('Starting Portfolio Value: %.2f' % cerebro.broker.getvalue())
    
    opt_run=cerebro.run()
    
    print('Final Portfolio Value: %.2f' % cerebro.broker.getvalue())
    

    Any pointer to help me out?


  • administrators

    v20 is not supported currently. Your example cannot work.



  • Any chance this is going to change in the near future? Is there interest in supporting the new version of OANDA?



  • @ftomassetti said in Backtrader & OANDA:

    Any chance this is going to change in the near future? Is there interest in supporting the new version of OANDA?

    Hi @ftomassetti

    Working on getting IB up and running, after which, will focus on Oanda V20 working



  • From reading part of the Algotopain white-paper it looks like V20 is intended to be supported in the future. Q1 2019.

    https://www.algotopian.com/whitepaper/content.html#roadmap



  • @thatblokedave

    Unfortunately that is 1 year too late! My goal is to get it working by the end of March - might be a bit ambitious however.



  • We have started a project to explore combining Oanda-V20 and backtrader. If some is willing to join us, he/she is welcome. Of course if later we can contribute our code back to backtrader we would be happy to.

    The repository is currently here: https://github.com/ftomassetti/backtrader-oandav20



  • Is the any progress on the Oanda V20 API? The original API is depreciated and not longer works. This makes things difficult for us trader who would like to rely on Backtrader for live trading.



  • @taylerallen6 What do you mean by depreciated and no longer works ? I had a mod suggest to me the original Oanda API just last week. That said I haven't tried implementation yet. Also, click the link above you, go to the issues section, and under "Which features are missing" is a thread of their progress.


Log in to reply
 

});