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/

    AttributeError: 'CCXTBroker' object has no attribute 'startingcash'.

    General Code/Help
    2
    2
    621
    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.
    • A
      Alex Wang last edited by

      I add a CCXTBroker, data feed from CCXT, the code is like below:

      broker_config = {
                      #'verbose': True,
                      'apiKey': 'xxxxx',
                      'secret': 'xxxxx',
                      }
      broker = bt.brokers.CCXTBroker(exchange='okex', currency='USD', config=broker_config)
      cerebro.setbroker(broker)
      
      hist_start_date = datetime.utcnow() - timedelta(minutes=15)
      data_ticks = bt.feeds.CCXT(
          exchange='okex',
          symbol='LTC/USD',
          name='LTC_USD',
          timeframe=bt.TimeFrame.Minutes,
          fromdate=hist_start_date,
          historical='False',
          compression=1)
      
      # Add the Data Feed to Cerebro
      cerebro.adddata(data_ticks)
      

      It reports the error below:

      Traceback (most recent call last):
      File "d:/My Documents/Python Scripts/liveStrategyEngine/bt_ccxt_test2.py", line 217, in <module>
      cerebro.run()
      File "D:\Continuum\anaconda3\lib\site-packages\backtrader\cerebro.py", line 1127, in run
      runstrat = self.runstrategies(iterstrat)
      File "D:\Continuum\anaconda3\lib\site-packages\backtrader\cerebro.py", line 1315, in runstrategies
      self.stop_writers(runstrats)
      File "D:\Continuum\anaconda3\lib\site-packages\backtrader\cerebro.py", line 1347, in stop_writers
      stratinfos[stname] = strat.getwriterinfo()
      File "D:\Continuum\anaconda3\lib\site-packages\backtrader\strategy.py", line 450, in getwriterinfo
      ainfo.Value.Begin = self.broker.startingcash
      AttributeError: 'CCXTBroker' object has no attribute 'startingcash'.

      What's going on here?

      S 1 Reply Last reply Reply Quote 0
      • S
        Samy David @Alex Wang last edited by

        @alex-wang did you get it solved? i have the same issue.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors