Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OptionChainProvider Backward Compatibility #8387

Open
4 tasks done
AlexCatarino opened this issue Oct 30, 2024 · 0 comments · May be fixed by #8395
Open
4 tasks done

OptionChainProvider Backward Compatibility #8387

AlexCatarino opened this issue Oct 30, 2024 · 0 comments · May be fixed by #8395
Labels

Comments

@AlexCatarino
Copy link
Member

AlexCatarino commented Oct 30, 2024

Expected Behavior

OptionChainProvider.GetOptionContractList provides the same symbols as OptionChain

Actual Behavior

In some cases GetOptionContractList returns an empty list while OptionChain is not empty

Potential Solution

GetOptionContractList wraps OptionChain.

Reproducing the Problem

The following algorithm logs the days GetOptionContractList returns an empty list while OptionChain is not empty. There are plenty of cases.

class CryingFluorescentPinkDogfish(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2023, 4, 29)
        self.set_cash(100000)
        spx = self.AddIndex('SPX').Symbol
        self.canonical_option = Symbol.CreateCanonicalOption(spx, 'SPX', Market.USA, '?SPX')
        self.Schedule.On(self.DateRules.EveryDay(spx), self.time_rules.before_market_close(spx, 120), self.buy)

    def buy(self):
        symbols = self.OptionChainProvider.GetOptionContractList(self.canonical_option, self.time)
       if not symbols:
            df = self.option_chain(self.canonical_option).data_frame
            if not df.empty:
                self.Log(f'{self.time} : Empty GetOptionContractList and OptionChain is {df.size}')

Checklist

  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue
@jhonabreul jhonabreul linked a pull request Nov 6, 2024 that will close this issue
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant