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

Refactor option greeks #1964

Merged
merged 1 commit into from
Sep 28, 2024
Merged

Conversation

faysou
Copy link
Collaborator

@faysou faysou commented Sep 27, 2024

Pull Request

Added greeks functions as pyo3
Removed ffi bindings for greeks functions
Made reading of interest rates more generic using messages
Converted greeks.pyx containing GreeksCalculator to greeks.py for easier development
Added InterestRateData and InterestRateCurveData classes
Added quadratic interpolation function without adding a new dependency in math.pyx for interpolating interest rate curves
Added greeks tests using pyo3 functions
Fixed bug in BacktestNode when using BacktestDataConfig with a Bar
Added raise_exception optional argument to BacktestNode.run in order to have access to the call stack when a bug happens
Added possibility to serialise numpy arrays using @customdataclass (see InterestRateCurveData)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

How has this change been tested?

Tests for greeks values, test notebook already included running

There seems to be a problem for loading custom data unrelated to the pull request, because _run_streaming in BacktestNode only works with backend_session that doesn't support custom_data. When using chunk_size = None in BacktestRunConfig, loading custom data doesn't seem to work as well. It's not due to changes in the current pull request, the option strategy example is more a way to test various aspects of a backtest in terms of saving and loading custom data.

@faysou faysou force-pushed the greeks_improvements branch from b27c90d to fd88195 Compare September 28, 2024 19:39
@faysou faysou marked this pull request as ready for review September 28, 2024 19:42
@faysou faysou force-pushed the greeks_improvements branch from fd88195 to 4957af4 Compare September 28, 2024 20:46
@faysou faysou force-pushed the greeks_improvements branch from 4957af4 to e6253b6 Compare September 28, 2024 21:32
@@ -225,7 +225,7 @@ fn test_imply_vol_and_greeks_accuracy_call() {
let tolerance = 1e-5;
assert!(
(implied_result.vol - sigma).abs() < tolerance,
"Implied volatility difference exceeds tolerance"
"Vol difference exceeds tolerance"
Copy link
Member

Choose a reason for hiding this comment

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

Probably fine, but I always find "vol" vague as it can mean several different things (in this context fairly obvious though).

Calculate the cost of retrieving data from the Databento API for the given
parameters.

Args:
Copy link
Member

Choose a reason for hiding this comment

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

numpydoc spec, but I can refine this once on develop branch.

@cjdsellers cjdsellers merged commit 0069992 into nautechsystems:develop Sep 28, 2024
10 checks passed
@faysou faysou deleted the greeks_improvements branch October 7, 2024 18:27
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