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'.



  • 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?



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