Skip to content

new example: Asian option pricing using 2D PDE (Pawel Magnuszewski's MSc project draft, to be submitted to arXiv soon) #543

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

Open
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

pawelmagnu
Copy link
Collaborator

No description provided.

@pawelmagnu
Copy link
Collaborator Author

@slayoo can we merge?

@slayoo
Copy link
Member

slayoo commented Apr 27, 2025

@slayoo can we merge?

@pawelmagnu, at minimum, I suggest we address the following here before merging:

  • notebook: add at least minimal explanation (text narrative) of what is happening inside
  • notebook: fix advector field plotting (currently left/bottom cell-wall advectors are plotted at cell centers)
  • notebook: remove plotting logic from the run_numeric_and_mc simulation function
  • notebook: CI-conditionally introduce lower-resolution simulation settings to speed CI execution (currently it takes 320s to run the notebook)
  • tests: add a smoke test (e.g., checking for match against MC)
  • docs: add an entry to example gallery
  • MC: remove the os.environ["NUMBA_OPT"] = "3" setting (it is set in CI scripts, and no one expects such thing to happen on import)
  • MC: add a reference from where the code originates
  • asian_option.py: address instead of disabling pylint hints: too-few-public-methods, too-many-lines, global-statement, abstract-method
  • asian_option.py: move the MPDATA settings to the notebook
  • asian_option.py: remove default argument values and pass S_min/S_max from calling scope instead of hardcoding
  • asian_option.py: if we want to commit the American and European MPDATA solution code, let's at least create a separate notebook that uses it (e.g., Fig 1 version with euro and amer MPDATA solution as a supplementary figure) - currently this code is never run on CI, hence no guarantee it is even runnable
  • asian_option.py: since we are now always using Extrapolated bc, we can move it to the base class
  • re-enable all CI checks temporarily disabled for CI speed-up

last but not least, let's make the code below (notebook) a two-liner!

history = [simulation.solver.advectee.get().copy()]
for i in range(nt//2):
    simulation.step()
history.append(simulation.solver.advectee.get().copy())
for i in range(nt//2):
    simulation.step()
history.append(simulation.solver.advectee.get().copy())

@pawelmagnu
Copy link
Collaborator Author

notebook: CI-conditionally introduce lower-resolution simulation settings to speed CI execution (currently it takes 320s to run the notebook)

It already is a lower-resolution version

tests: add a smoke test (e.g., checking for match against MC)

we do not aim for match with MC as this notebook is only a PoC, further tests will be in future notebooks and PRs

Copy link

codecov bot commented Apr 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.85%. Comparing base (4d99b5f) to head (df0071e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #543   +/-   ##
=======================================
  Coverage   91.85%   91.85%           
=======================================
  Files          30       30           
  Lines        1485     1485           
=======================================
  Hits         1364     1364           
  Misses        121      121           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

slayoo added 2 commits April 29, 2025 12:10
…n with UPWIND; removing duplicate simulation run; code cleanups
@slayoo slayoo changed the title Asian option arxiv paper new example: Asian option pricing using 2D PDE (Pawel Magnuszewski's MSc project draft, to be submitted to arXiv soon) Apr 29, 2025
slayoo and others added 10 commits April 29, 2025 17:35
…operly handle extrapolation

- remove obsolete narrative text in code comments
- fix imshow extents axes origin at (-dx/2, -dy/2)
- contour isoline levels fixed to show zero isoline for terminal condition
- fix Fig2 x2ticks (and move then dx/2 from the grid lines)
- code cleanups
- add (a), (b), (c), (d) labels for plots, remove all but top and bottom tick labels, but keep ticks everywhere
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