Skip to content

fix(options): discount zero-volatility forward value - #1066

Open
pengpengyi92 wants to merge 1 commit into
HKUDS:mainfrom
pengpengyi92:codex/fix-zero-volatility-forward-value
Open

fix(options): discount zero-volatility forward value#1066
pengpengyi92 wants to merge 1 commit into
HKUDS:mainfrom
pengpengyi92:codex/fix-zero-volatility-forward-value

Conversation

@pengpengyi92

Copy link
Copy Markdown

Summary

  • Price European options with T > 0 and sigma <= 0 at discounted forward intrinsic value instead of immediate spot intrinsic value.
  • Return delta, theta, and rho from the same deterministic forward state; gamma and vega remain zero.
  • Add regression coverage for exercise-state changes, put-call parity, and call/put sensitivities.

Why

With zero volatility and time remaining, the terminal spot is deterministic: S_T = S * exp((r - q)T). The current shared pricing primitive groups that case with expiry and returns immediate intrinsic value. That can misprice both the amount and the exercise side, and it violates discounted put-call parity.

For example, S=100, K=102, T=1, r=5%, q=2%, sigma=0 is spot-OTM but deterministic-forward-ITM for the call. The current branch prices the call at zero and the put at 2; the corrected branch prices discounted forward intrinsic instead.

Changes

  • Separate expiry/non-positive spot or strike handling from the zero-volatility path.
  • Reuse discounted spot and strike values for deterministic pricing.
  • Derive zero-volatility delta, theta, and rho from the active discounted-forward payoff.
  • Keep public signatures and normal positive-volatility behavior unchanged.

Out of scope: implied-volatility solver policy, live trading, broker connectors, MCP, network behavior, secrets, and deployment.

Test Plan

  • Full non-E2E suite: attempted locally, but collection is blocked by missing optional fastmcp, yfinance, and ccxt dependencies (48 collection errors before test execution).
  • pytest agent/tests/quantlib/test_options.py agent/tests/test_options_pricing_degenerate.py agent/tests/test_options_bs_nonpositive_strike.py agent/tests/test_options_portfolio_correctness.py -q — 156 passed.
  • pytest agent/tests/quantlib -q — 994 passed, 61 skipped.
  • ruff check agent/src/quantlib/options.py agent/tests/quantlib/test_options.py — clean.
  • New regression tests added.

Risk and Rollback

The change is confined to the shared Black-Scholes primitive and its tests. It does not touch protected agent/session/provider areas or any order, broker, credential, network, or deployment path. A single-commit revert restores previous behavior.

Checklist

  • No changes to protected areas (src/agent/, src/session/, src/providers/) without prior discussion
  • No hardcoded values (API keys, file paths, magic numbers)
  • Code follows CONTRIBUTING.md guidelines
  • Documentation updated for the corrected degenerate-input contract

Signed-off-by: PP1 <74917296+pengpengyi92@users.noreply.github.com>
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.

1 participant