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

A little advice....please.

  • I have managed to cobble together a python script that takes the Quandl WIKI export (1.7Gb) and reduces it down to 10 long buys and 10 short sales for each month. Enter the positions at beginning of the month, exit at the end...repeat. So, the .csv would look like (I'll include a few random stocks to illustrate):

    date        ticker        ls
    10/1/2000     AAPL       long
    10/1/2000     JNJ        long
    10/1/2000     MSF        long
    10/1/2000     NRG        long
    10/1/2000     A          long
    10/1/2000     OMI        short
    10/1/2000     CELG       short
    10/1/2000     ABBV       short
    10/1/2000     KMX        short
    10/1/2000     CSCO       short
    11/1/2000     SYMC       long
    11/1/2000     QCOM       long
    11/1/2000     PFG        long
    11/1/2000     LUK        long
    11/1/2000     EXPE       long
    11/1/2000     DLTR       short
    11/1/2000     STZ        short
    11/1/2000     COST       short
    11/1/2000     DVN        short
    11/1/2000     CSCO       short
    ...etc, etc....

    I am looking for some guidance on how to feed these in to backtest or, if it exists, another method of testing this as an equal weight portfolio. Since the table is a result of an algorithm, I need a way to backtest it as a dynamic, monthly portfolio. It is a challenge since the triggers are in the screening process. I would prefer to build the strategy in backtest but do not understand it well enough yet. Maybe contract someone to do it so the framework would be there then learn from that?

    I think I was attempting to turn backtest into a giant stock screener and that is part of the problem.

    Thanks for any input. So close yet so far away!

  • Probably related to the answer to this post a couple of days ago:

    There is a post on how to automatically trigger orders at a given price for historical performance evaluation.

Log in to reply