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/

    Long Short Equity Trading Strategy

    General Code/Help
    2
    2
    895
    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.
    • P
      piby 180 last edited by

      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!

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

        @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

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
        $(document).ready(function () { app.coldLoad(); }); }