尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證Options premium pricer (BSM, American binomial tree, LSMC, Greeks, IV surface) - Traders@SMU HW1
翻譯準備中
取自儲存庫 README
正在載入完整 README。 以下為已儲存的摘錄。
Traders@SMU · HW 1. Black-Scholes-Merton, American binomial tree, Longstaff-Schwartz Monte Carlo, Greeks, implied volatility and volatility surfaces, as a Python package, a CLI and a website.檢視完整 README ↗
Traders@SMU · HW 1. Black-Scholes-Merton, American binomial tree, Longstaff-Schwartz Monte Carlo, Greeks, implied volatility and volatility surfaces, as a Python package, a CLI and a website.
Live site: https://ferrsir.github.io/options-pricer/
| HW requirement | Where |
|---|---|
| BSM pricer (+ dividend yield) | src/pricer/bsm.py |
| American options pricer (CRR tree, exercise-vs-continue at each node) | src/pricer/binomial.py |
| LSMC (regression on basis functions, compare to the tree) | src/pricer/lsmc.py |
| Greeks + visualizations (stretch) | bsm_greeks, viz.py, Greeks tab on the site |
| Slide sanity checks | checks.py, 31 tests in tests/ |
| Implied vol from a market premium | implied_vol, Your premium box on the site |
| Vol-surface picture from Yahoo Finance | python -m pricer surface NDX |
| Ticker → Yahoo data | data.py + site |
| How every number is derived | METHODOLOGY.md |
| Plain-English explanation of every term, number and graph | GUIDE.md (also the Guide tab on the site) |
| Type your own premium and see what happens | Your premium box, banner and What-if tab on the site |
git clone https://github.com/Ferrsir/options-pricer && cd options-pricer
python -m venv .venv && .venv\Scripts\activate # macOS/Linux: source .venv/bin/activate
pip install -e ".[dev]"
python -m pytest -q # 31 tests
# manual inputs: 1y ATM put, 5% rate, 20% vol; American tree + LSMC + charts
python -m pricer price --spot 100 --strike 100 --years 1 --rate 0.05 --vol 0.2 --type put --lsmc --out output/put
# from a ticker (spot, rate, dividend yield, historical vol pulled from Yahoo Finance)
python -m pricer price --ticker AAPL --strike 340 --days 30 --type call
# you saw a premium in the market: solve implied vol and price with it
python -m pricer price --ticker AAPL --strike 340 --days 30 --type call --premium 9.25
python -m pricer iv --premium 9.25 --spot 335 --strike 340 --days 30 --rate 0.04
Sample output (S=K=100, T=1, r=5%, σ=20% put):
BSM (European, closed form) 5.5735
European tree (1000 steps) 5.5715 (error vs BSM -0.00200)
American tree (1000 steps) 6.0896 (early-exercise premium +0.5181)
American LSMC (100000 paths) 6.0608 (± 0.0440 95% CI; biased slightly low)
python -m pricer surface NDX --out output/ndx_surface.png # any ticker with listed options
python -m pricer surface --demo # synthetic data, works offline
python -m pricer checks
python -m pricer serve # http://localhost:8000
docs/ is a static site (plain JS + Plotly, no build step) served by GitHub Pages. The pricing engine is re-implemented in JavaScript and agrees with Python to ~1e-12.
Ticker data: any optionable US ticker. Neither Yahoo Finance nor Cboe can be called from a web page (no CORS), so the site talks to a small API and degrades gracefully:
python -m pricer serve on your machine: Yahoo Finance first, Cboe's public delayed chains as the automatic fallback; the vol surface is built in Python.serverless/ (standard-library Python, Cboe data): quotes, chains and a compact multi-expiry payload. The browser builds the vol surface itself (docs/js/surface.js, a port of the Python pipeline, checked against it to ~1e-13). It is deployed on Vercel (https://options-pricer-api-five.vercel.app) and wired in through DEFAULT_API in docs/js/data.js.docs/data/snapshots.json: NDX, SPX, SPY, QQQ, AAPL, MSFT, NVDA, TSLA, AMZN, GOOGL, META, refreshed with python scripts/snapshot.py) when no API is reachable.src/pricer/ bsm.py binomial.py lsmc.py surface.py data.py viz.py checks.py cli.py server.py
tests/ 31 tests: reference values, parity, Greeks vs finite differences, tree convergence, LSMC, surface recovery, any-ticker data layer
docs/ the website (GitHub Pages) · scripts/snapshot.py, build_guide.py · METHODOLOGY.md, GUIDE.md
For AI agents (Claude Code, Codex) and contributors: read AGENTS.md first. It has the rules, commands and a handoff log the agents use to talk to each other.
Educational project, not investment advice. Market data from Yahoo Finance via yfinance, which may be delayed or inaccurate.