Backtrader Community

    • 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/

    How to handle option expirations ?

    General Code/Help
    2
    5
    1650
    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.
    • ?
      A Former User last edited by

      Would custom observer be a viable solution ?

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

        The answer to the question probably needs some extra background information.

        What is exactly meant with "handling of options expirations"?

        1 Reply Last reply Reply Quote 0
        • ?
          A Former User last edited by

          Multiple data feeds first one underlying and rest of the data streams are options at different strikes and expirations.

          Back testing runs from day T to day T+100. I buy a call option which expires T+25 on T+5 and never close the position.

          My question is how does the position close it self and adjust account value correctly ? I guess it would be different for cash settled options (easier maybe).

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

            Positions on assets don't close themselves. A buy action, for example, needs a corresponding sell action to close the position.

            One possibility to consider would be that data feeds could carry a tag to indicate an expiration datetime, which the broker could honour to close the position.

            But there is something puzzling in your message:

            • Back testing runs from day T to day T+100
            • On T+5 an option which expires on T+25 is bought
            • What happens during T+26 and T+100? Because the option is already gone at T+25?

            • Do you have something like continuous option prices?

            1 Reply Last reply Reply Quote 0
            • ?
              A Former User last edited by

              New positions can be opened closed between T+26 and T+100, but nothing related to expiring option. It doesn't get rolled or anything. I have continuous option prices(until expiration of course).

              Figuring/carrying expiration date is not my main concern. I am wondering how to sell at the correct value when it expires, last price of the option doesn't necessarily indicate correct settlement value.

              At each next do I check if it is past expiration for all open positions and then close accordingly ? How will the trade go thru if there is no data (because it's past expiration) ?

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors