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/

    Help needed to analyze external order list

    General Code/Help
    2
    3
    779
    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.
    • D
      doggo last edited by doggo

      Hello everyone, I have developed my own strategy from scratch and I have tested it with historical data, and ended with a list of trades made over the historical data set. I am trying to run my trades through backtrader to analyze the performance, but I am not having much luck. I am not the greatest with making sense of the docs, I have been trying to figure it out for the last 4 hours and havent gotten anywhere. My problem lies (i think) with the adddata part I believe and also setting up an empty strategy.

      Anyways, I have my order list in the format [datetime, size, price] (as per "Evaluating external historical performance"). My historical data is 30 minute in the format [date, O,H,L,C]

      Here is my code (its not much but I think its all that is relevant)

      cerebro = bt.Cerebro()
      
      cerebro.adddata(historical_data)
      cerebro.addstrategy(strategy=None)
      cerebro.add_order_history(trade_list, notify=False)
      
      cerebro.addanalyzer(bt.analyzers.TradeAnalyzer)
      
      results = cerebro.run()
      print(results)
      

      Printing outputs an empty list, I have tried my best looking through the docs, but I am feeling a little overwhelmed. Thank you

      edit: nevermind i got it, but it wont let me delete the post

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

        @doggo said in Help needed to analyze external order list:

        cerebro.addstrategy(strategy=None)
        

        A lot of context (ie: code) is missing, but that line seems completely out of place. There is for sure no single code sample showing such a call. And for sure not in Blog - Evaluating external historical performance

        Maybe you want to let us know what your intention is.

        D 1 Reply Last reply Reply Quote 1
        • D
          doggo @backtrader last edited by

          @backtrader sorry, could you please delete the post? I figured it out in the end, was just all over the place when I post this

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