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

Is anyone successfully backtesting options with backtrader?

  • I have been consider purchasing data and moving my current strategy testing away from QuantConnect to something local for greater speed and efficient use of computing resources. I have backtrader up and running, yet options seem like they would require a major work around, unless I am missing something.


  • administrators

    To try to ascertain if you are missing something, sharing with us why you think that major workaround (or rework) would be needed, could actually help.

    We could then understand what you think you cannot do or where you feel that the limitations are (and if they are really there or not)

    With regards to speed and efficient use of computing: Python itself is slow due to the built-in dynamism and instrospection and its facilities to use multiple cores without multiple processes (and the associated huge overheaad to pass data around) are flawed.

    I like Python very much and what one can actually achieve, but I am also very realistic about where its limits are.

  • Sorry for the general nature of my question. I have not built anything that complex in backtrader while in both Qantopian and QuantConnect I have, with some help. In QuantConnect I am able to use the built in function OptionChainProvider and AddOptionContract, then us a custom function filter the contracts. I just don't see anything prebuilt in backtrader so I did not know if there was a "easy" system / way that the community was using it to test and trade options.

    I have been bumping into the python speed issues but did not realize it had to do with the language itself. Interesting to learn.


  • administrators

    backtrader allows you to trade options as OHLC timeseries. If the thing is about combining the multiple expiration dates, prices, and directions into a kind of matrix, there is no provision for it.

    There are things that could simulate it like what's used for the chaining of futures. See Docs - Cerebro and chaindata and rolloverdata.

    But it won't probably offer you the complexity needed to manage a matrix of Options.

  • @backtrader Got it, I will check it out.

Log in to reply