Skip to content

Refactor option greeks feature #2266

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

Merged
merged 1 commit into from
Feb 1, 2025
Merged

Refactor option greeks feature #2266

merged 1 commit into from
Feb 1, 2025

Conversation

faysou
Copy link
Collaborator

@faysou faysou commented Jan 29, 2025

Pull Request

Refactor option greeks feature

  • integrate option greeks calculation method in actor so calculations can be done synchronously in a strategy
  • maintained ability to publish greeks, store them in a catalog and load them from a catalog
  • added helper function for subscribing to greeks so a callback stores cached greeks loaded from a catalog
  • improved example so it doesn't need a delay to wait for loaded greeks when subscribing to them from a catalog, the trick is to add the greeks backtestdataconfig before other types of market data so it reaches actors before.
  • ability to compute shocked greeks and prices by shifting spot, vol, or time to expiry, this allows to have estimate of how portfolio greeks could evolve by varying the relevant market data variables. taking into account Futures correctly for this.
  • the reason to have the greeks functionality in actor, is that any subclass of actor, for example a class responsible for monitoring greeks, can easily access the functionality
  • added price field to PortfolioGreeks
  • Removed InterateRateData, keeping only InterestRateCurveData
  • InterestRateProvider caches InterestRateCurveData so it's then accessible the greeks computation function
  • Fixed a bug in the cache when using price with bars
  • Added GreeksCalculator class for greeks related function, accessible via actor.greeks.portfolio_greeks for example

Type of changs

  • New feature (non-breaking change which adds functionality)

How has this change been tested?

Tested using databento_option_greeks.py notebook, updated

Copy link
Member

@cjdsellers cjdsellers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good change moving greeks.py from risk to model.

I'm still unsure if actor is the right location for greeks calculations though, as this makes every actor a specialized greeks calculator too.

Copy link
Member

@cjdsellers cjdsellers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @faysou this is nicely done.

@faysou
Copy link
Collaborator Author

faysou commented Jan 31, 2025

I'm done with the changes mentioned above.

@cjdsellers cjdsellers merged commit e25786e into nautechsystems:develop Feb 1, 2025
13 checks passed
@faysou faysou deleted the optionrefactor branch February 15, 2025 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants