For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Can Backtrader use an existing python algo generating daily buy/sell/hold signals across multiple equities and timespans?

  • I would like to learn Backtrader in general but have a specific question to see if backtrader is able to solve my problem.

    I have built a python program that analyzes two datasets to generate buy/sell/hold decisions after close daily.

    The datasets are Quandl Sharadar Core US Equities Bundle csv files. Specifically, I am using:

    1. Sharadar Core US Fundamentals: SF1, quarterly data.
    2. Sharadar pricing information OHLC.

    My program looks at a number of factors and pricing data daily, even though some of the data is quarterly. The factors are:

    "evebitda", "price earnings", "return on equity", "debt to equity", "interest coverage", "price to cash flow", "momentum", "standard deviation"

    There are approximately 5,000 equities compared daily. Data goes back five years.

    Every day after close my alorithm creates a lost of x stocks to hold long, and y stocks to short.

    My question is: can I simply use this existing python program for my daily buy and sell recommendations in backtrader? Can I use a 'blackbox' like this that generates buy/sell instructions of a given day?

    Follow up question, if yes, can I overlay other indicators to determine quantity of orders/size of position?

    Thank you.

  • administrators

    You can always have your own signals as an extra input, overlay any number of indicators, run the backtrader script once a day and let it act accordingly.


    But it will of course take development time from your side.

  • Thanks for letting me know. I'll dive in...

  • Any ideas of where I might find sample implementation of factors for French-Fama model?

  • @backtrader Thank you for your answer. Backtrader is awesome! Handled the job really well.


Log in to reply