Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. Zeroc
    3. Posts
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    Z
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by Zeroc

    • RE: Why is backtesting speed very slow?

      @backtrader
      Thanks reply ,
      I find this thread how-to-speed-up-backtest

      the dataset he used is 6 months , and he takes 96 seconds to run , but my dataset is one years and taks 15 mins . that's crazy...

      I don't know what caused this difference in time.

      posted in General Code/Help
      Z
      Zeroc
    • Why is backtesting speed very slow?

      This is my code :

      class SmaCross(bt.SignalStrategy):
          def __init__(self):
              sma1, sma2 = bt.ind.SMA(period=10), bt.ind.SMA(period=30)
      
      cerebro = bt.Cerebro()
      cerebro.addstrategy(SmaCross)
      
      dataframe = pd.read_csv(r'D:\aaa.csv', index_col=0, parse_dates=True)
      print(dataframe)
      
      dataframe['openinterest'] = 0
      data = bt.feeds.PandasData(dataname=dataframe,
                              fromdate = datetime(2015, 1, 1),
                              todate = datetime(2016, 12, 31)
                              )
      cerebro.adddata(data)
      start = datetime.now()
      cerebro.run()
      stop = datetime.now()
      print(stop-start)
      cerebro.plot()
      

      The total processing time is 15 mins 50 sec ,
      What settings should I make to speedup ?

      Thanks.

      posted in General Code/Help
      Z
      Zeroc
    • 1 / 1