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


  • Hello,

    I am using the sample code below. I get the following output.

    Account Cash = 0.0
    Account Value = 0.0

    made sure that the balance has funds. The api token and account number are correct as I double checked them. What could be the problem?

    import argparse
    import datetime
    import backtrader as bt
    apikey = 'xxxxxxxx'
    acc = 'yyyyyyyyy'
    # Create a Stratey
    class TestStrategy(bt.Strategy):
       def __init__(self):
       #Provides any noticficaitons about the data.
       def notify_data(self, data, status, *args, **kwargs):
           print('*' * 5, 'DATA NOTIF:', data._getstatusname(status), *args)
       def notify_store(self, msg, *args, **kwargs):
           print('*' * 5, 'STORE NOTIF:', msg)
       def next(self):
           # Simply log the closing price of the series from the reference
           print('O: {} H: {} L: {} C: {}'.format(
       def start(self):
           if self.data0.contractdetails is not None:
               print('-- Contract Details:')
           acc_cash =
           acc_val =
           print('Account Cash = {}'.format(acc_cash))
           print('Account Value = {}'.format(acc_val))
    if __name__ == '__main__':
       cerebro = bt.Cerebro()
       print("apikey", apikey)
       print("acc", acc)
       oandastore = bt.stores.OandaStore(token=apikey, account=acc, practice=True) = oandastore.getbroker()
       data0 = oandastore.getdata(dataname="GBP_USD", timeframe=bt.TimeFrame.Ticks, compression=1, backfill_start=False, backfill=False)
       #This is setting what timeframe we want to use.
       cerebro.resampledata(data0, timeframe=bt.TimeFrame.Minutes, compression=5)

  • administrators

    Your API key and account have been redacted. But someone or web bots may hav already cached the details. You should immediately invalidate the API token.

    You probably have a v20 account. You may want to have a look at this:

  • Is there a way to create an account that is not v20, so it would be compatible?
    Also, what is the status of this repo? Is it still in development or something that I can use?

  • administrators

    It seems Oanda no longer creates v1 accounts even if you contact the customer service.

    @ahmed-sobhy said in NOTSUBSCRIBED Issue:

    Also, what is the status of this repo? Is it still in development or something that I can use?

    You will have to ask the repo (i.e.: the team on GitHub)

Log in to reply