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/

    Backtesting Options based on Futures

    Indicators/Strategies/Analyzers
    data futures options
    2
    5
    110
    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.
    • Shravan Venkataraman
      Shravan Venkataraman last edited by

      Hi,

      Here's what I want to accomplish.

      I want to go over futures data, apply a particular strategy (say moving average crossover) and at the specific time point of the crossover, I want to buy and sell using options (synthetic futures or long call/put).

      So, essentially what I want to be able to do is, supply a timeseries of OHLC data of options of the underlying (say NIFTY50) along with the different strike prices and optiontype (PE/CE) and enter/exit trades in backtest based on that.

      So, essentially, my options timeseries data csv file header is as follows:

      Date, Expiry, OptionType, StrikePrice, Open, High, Low, Close

      How do I use this to backtest options with the OHLC format?

      I remember the admin mentioning about being able to test options with OHLC format. Any direction on this could really help.

      Thanks a ton!

      1 Reply Last reply Reply Quote 0
      • R
        rajanprabu last edited by

        Hey Shravan,

        You can just inherit the GenericCSV class and add additional lines. have a look at this post.

        1 Reply Last reply Reply Quote 0
        • Shravan Venkataraman
          Shravan Venkataraman last edited by

          Hi,

          Thanks Rajan. I am onto it. However, is there a way we can introduce a line which takes in string as input?

          1 Reply Last reply Reply Quote 0
          • R
            rajanprabu last edited by

            Hey,

            I just looked int to the source code for GenericCSVData and BT converts anything other than date to float values. In case if you just want to feed CE/PE.. maybe take them as +1 and -1 ? would that solve your issue ?

            1 Reply Last reply Reply Quote 1
            • Shravan Venkataraman
              Shravan Venkataraman last edited by

              Yes, that's what I have done for now. Thank you for the prompt response!

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