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

Long Short Equity Trading Strategy



  • Hi all!

    First of all, I am very new here and trying to learn the platform.

    Typically, I want to implement long short equity trading strategy where I would like to rank securities weekly and rebalance my portfolio.

    For backtesting this, I have download the OHLCV data for all US securities in my Postgres database. To provide this data to cerebro, I am planning to create a pandas dataframe for each security (3000's) (iterable, using chunksize) and adding it to cerebro through loop.

    I don't want the entire data to be loaded into memory, so I am planning to making use of dataframe's chunksize parameter.

    I haven't tried it but will cerebro support this? Or what would be the best way to go about this problem?

    Thanks!


  • administrators

    @piby-180 said in Long Short Equity Trading Strategy:

    I don't want the entire data to be loaded into memory, so I am planning to making use of dataframe's chunksize parameter.

    Using chunksize would only have the effect that you load things in chunks and not that you load less.

    @piby-180 said in Long Short Equity Trading Strategy:

    I haven't tried it but will cerebro support this? Or what would be the best way to go about this problem?

    You have to use exactbars=True, to make sure the data feeds are not fully (pre)-loaded and all buffers are kept to the exact minimum needed for operation.

    See: Docs - Cerebro