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

Serializing curves and solvers relying on multi-currency instruments #392

Closed
ArnaudToma opened this issue Sep 16, 2024 · 4 comments · Fixed by #393
Closed

Serializing curves and solvers relying on multi-currency instruments #392

ArnaudToma opened this issue Sep 16, 2024 · 4 comments · Fixed by #393

Comments

@ArnaudToma
Copy link

Hi !
Upon trying to serialize my differents curves it triggered :

TypeError: cannot pickle 'rateslib.rs.FXRates' object

I understand from doc that serializing from FXRates is, for now, done by hand by calling to_json.

Do you recommend tweaking all the classes relying on FXRates to make them serializable or is there a workaround/improvement scheduled for this purpose ?

Thanks !

@attack68
Copy link
Owner

You are trying to serialize with Python's native pickle library?

@ArnaudToma
Copy link
Author

ArnaudToma commented Sep 16, 2024

I was trying to cache it with streamlit's inbuilt caching tag and when it showed signs of discomfort I also tried with joblib.
The problem is FXRates doesn't support serialization for now, so Curves can be serialized only if no dependence is made on an FXRates instance.

@attack68
Copy link
Owner

This is just an oversight. Ensuring Python classes designed in Rust have native Python function (such as pickling) is often learned via trail and error...

See PyO3/pyo3#4465

Is now fixed for 1.5.0

@ArnaudToma
Copy link
Author

Thanks a lot then !
Can't wait 🙂

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 a pull request may close this issue.

2 participants