{ "cells": [ { "cell_type": "markdown", "id": "497d9b9dc9634500812f180231b90e8e", "metadata": {}, "source": [ "# Call/Put prices across strikes (futures, Black-76)\n", "\n", "Minimal example: compute **call** and **put** prices for a range of strikes and print a table.\n", "\n", "**Inputs**: futures `F`, maturity `T` (years), rate `r` (cc), volatility `sigma` (per √year).\n" ] }, { "cell_type": "code", "execution_count": null, "id": "a58dfe9237aa417481c613c2041a682e", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
strikecallput
070.029.7233700.021875
175.024.8449500.093704
280.020.1070350.306039
385.015.6524100.801663
490.011.6553131.754815
595.08.2700653.319816
6100.05.5811075.581107
7105.03.5819748.532224
8110.02.18924412.089743
9115.01.27715216.127900
10120.00.71324420.514241
11125.00.38254825.133794
12130.00.19771329.899208
\n", "
" ], "text/plain": [ " strike call put\n", "0 70.0 29.723370 0.021875\n", "1 75.0 24.844950 0.093704\n", "2 80.0 20.107035 0.306039\n", "3 85.0 15.652410 0.801663\n", "4 90.0 11.655313 1.754815\n", "5 95.0 8.270065 3.319816\n", "6 100.0 5.581107 5.581107\n", "7 105.0 3.581974 8.532224\n", "8 110.0 2.189244 12.089743\n", "9 115.0 1.277152 16.127900\n", "10 120.0 0.713244 20.514241\n", "11 125.0 0.382548 25.133794\n", "12 130.0 0.197713 29.899208" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import numpy as np\n", "import pandas as pd\n", "from volkit import price_euro_future\n", "\n", "# Parameters (edit these) -----------------------------\n", "F = 100.0 # futures price\n", "T = 0.50 # years\n", "r = 0.02 # continuous compounding\n", "sigma = 0.20 # Black vol (per √year)\n", "\n", "# Strike grid -----------------------------------------\n", "K = np.arange(70.0, 131.0, 5.0) # 70,75,...,130\n", "\n", "# Prices (broadcasting over K) ------------------------\n", "call = price_euro_future(F, K, T, r, sigma, cp=\"call\")\n", "put = price_euro_future(F, K, T, r, sigma, cp=\"put\")\n", "\n", "# Table ------------------------------------------------\n", "df = pd.DataFrame({\"strike\": K, \"call\": call, \"put\": put})\n", "df.round(6)" ] } ], "metadata": { "kernelspec": { "display_name": "volkit-eMyHUDBN-py3.11", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.8" } }, "nbformat": 4, "nbformat_minor": 5 }