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/

    NOTSUBSCRIBED Issue

    General Code/Help
    2
    4
    520
    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.
    • Ahmed Sobhy
      Ahmed Sobhy last edited by backtrader

      Hello,

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

      Started
      Account Cash = 0.0
      Account Value = 0.0
      ***** DATA NOTIF: NOTSUBSCRIBED

      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):
             pass
      
         #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(
                     self.data.open[0],
                     self.data.high[0],
                     self.data.low[0],
                     self.data.close[0],
                     ))
      
      
         def start(self):
             if self.data0.contractdetails is not None:
                 print('-- Contract Details:')
                 print(self.data0.contractdetails)
             print('Started')
             acc_cash = cerebro.broker.getcash()
             acc_val = cerebro.broker.getvalue()
             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)
         cerebro.broker = 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)
      
         cerebro.addstrategy(TestStrategy)
         cerebro.run()
      
      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        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:

        • https://github.com/ftomassetti/backtrader-oandav20
        1 Reply Last reply Reply Quote 0
        • Ahmed Sobhy
          Ahmed Sobhy last edited by

          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?

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

            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)

            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(); }); }