HSG-MCS-HS21_Julia/Problemsets/Solutions/PS10b_OptionDeltas_Solution.ipynb

646 lines
182 KiB
Plaintext
Raw Normal View History

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Load Packages and Extra Functions"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"printyellow (generic function with 1 method)"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"using Printf, Distributions, OffsetArrays, FiniteDiff\n",
"\n",
"#using FiniteDiff: finite_difference_derivative as derivative #could do this instead\n",
"\n",
"include(\"jlFiles/OptionsCalculations.jl\")\n",
"include(\"jlFiles/printmat.jl\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"using Plots\n",
"#pyplot(size=(600,400))\n",
"gr(size=(480,320))\n",
"default(fmt = :svg)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# The Black-Scholes Model\n",
"\n",
"The next cell calculates call `C` and put prices `P` from the Black-Scholes formula.\n",
"\n",
"The key parameters are:\n",
"`(S,K,m,y,σ) = (current undelying price, strike price,time to expiration,interest rate, volatility)`"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"call price at K=42: 2.893 \n",
"\n",
"put price at K=42: 1.856 \n",
"\n"
]
}
],
"source": [
"(S,K,m,y,σ) = (42,42,0.5,0.05,0.2)\n",
"\n",
"C = OptionBlackSPs(S,K,m,y,σ)\n",
"printlnPs(\"call price at K=$K: \",C,\"\\n\")\n",
"\n",
"P = OptionBlackSPs(S,K,m,y,σ,0,true)\n",
"printlnPs(\"put price at K=$K: \",P,\"\\n\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Task 1\n",
"\n",
"For a range of different prices of the underlying asset `S=30:60`, calculate the call and put prices and plot them (with `S` on the hoizontal axis)."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"480\" height=\"320\" viewBox=\"0 0 1920 1280\">\n",
"<defs>\n",
" <clipPath id=\"clip940\">\n",
" <rect x=\"0\" y=\"0\" width=\"1920\" height=\"1280\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<path clip-path=\"url(#clip940)\" d=\"\n",
"M0 1280 L1920 1280 L1920 0 L0 0 Z\n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<defs>\n",
" <clipPath id=\"clip941\">\n",
" <rect x=\"384\" y=\"0\" width=\"1345\" height=\"1280\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<path clip-path=\"url(#clip940)\" d=\"\n",
"M197.427 1106.38 L1872.76 1106.38 L1872.76 123.472 L197.427 123.472 Z\n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<defs>\n",
" <clipPath id=\"clip942\">\n",
" <rect x=\"197\" y=\"123\" width=\"1676\" height=\"984\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<polyline clip-path=\"url(#clip942)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 244.842,1106.38 244.842,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip942)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 771.675,1106.38 771.675,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip942)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 1298.51,1106.38 1298.51,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip942)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 1825.34,1106.38 1825.34,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip940)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 197.427,1106.38 1872.76,1106.38 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip940)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 244.842,1106.38 244.842,1087.48 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip940)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 771.675,1106.38 771.675,1087.48 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip940)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1298.51,1106.38 1298.51,1087.48 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip940)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1825.34,1106.38 1825.34,1087.48 \n",
" \"/>\n",
"<path clip-path=\"url(#clip940)\" d=\"M233.685 1146.31 Q237.042 1147.02 238.917 1149.29 Q240.815 1151.56 240.815 1154.89 Q240.815 1160.01 237.296 1162.81 Q233.778 1165.61 227.296 1165.61 Q225.12 1165.61 222.806 1165.17 Q220.514 1164.75 218.06 1163.9 L218.06 1159.38 Q220.005 1160.52 222.319 1161.1 Q224.634 1161.68 227.157 1161.68 Q231.555 1161.68 233.847 1159.94 Q236.162 1158.2 236.162 1154.89 Q236.162 1151.84 234.009 1150.13 Q231.88 1148.39 228.06 1148.39 L224.032 1148.39 L224.032 1144.55 L228.245 1144.55 Q231.694 1144.55 233.523 1143.18 Q235.352 1141.79 235.352 1139.2 Q235.352 1136.54 233.454 1135.13 Q231.579 1133.69 228.06 1133.69 Q226.139 1133.69 223.94 1134.11 Q221.741 1134.52 219.102 1135.4 L219.102 1131.24 Q221.764 1130.5 224.079 1130.13 Q226.417 1129.75 228.477 1129.75 Q233.801 1129.75 236.903 1132.19 Q240.004 1134.59 240.004 1138.71 Q240.004 1141.58 238.361 1143.57 Q236.717 1145.54 233.685 1146.31 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M259.68 1133.46 Q256.069 1133.46 254.241 1137.02 Q252.435 1140.56 252.435 1147.69 Q252.435 1154.8 254.241 1158.37 Q256.069 1161.91 259.68 1161.91 Q263.315 1161.91 265.12 1158.37 Q266.949 1154.8 266.949 1147.69 Q266.949 1140.56 265.12 1137.02 Q263.315 1133.46 259.68 1133.46 M259.68 1129.75 Q265.49 1129.75 268.546 1134.36 Q271.625 1138.94 271.625 1147.69 Q271.625 1156.42 268.546 1161.03 Q265.49 1165.61 259.68 1165.61 Q253.87 1165.61 250.791 1161.03 Q247.736 1156.42 247.736 1147.69 Q247.736 1138.94 250.791 1134.36 Q253.87 1129.75 259.68 1129.75 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M759.847 1134.45 L748.041 1152.9 L759.847 1152.9 L759.847 1134.45 M758.62 1130.38 L764.499 1130.38 L764.499 1152.9 L769.43 1152.9 L769.43 1156.79 L764.499 1156.79 L764.499 1164.94 L759.847 1164.94 L759.847 1156.79 L744.245 1156.79 L744.245 1152.28 L758.62 1130.38 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M787.161 1133.46 Q783.55 1133.46 781.722 1137.02 Q779.916 1140.56 779.916 1147.69 Q779.916 1154.8 781.722 1158.37 Q783.55 1161.91 787.161 1161.91 Q790.796 1161.91 792.601 1158.37 Q794.43 1154.8 794.43 1147.69 Q794.43 1140.56 792.601 1137.02 Q790.796 1133.46 787.161 1133.46 M787.161 1129.75 Q792.971 1129.75 796.027 1134.36 Q799.106 1138.94 799.106 1147.69 Q799.106 1156.42 796.027 1161.03 Q792.971 1165.61 787.161 1165.61 Q781.351 1165.61 778.272 1161.03 Q775.217 1156.42 775.217 1147.69 Q775.217 1138.94 778.272 1134.36 Q781.351 1129.75 787.161 1129.75 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M1273.21 1130.38 L1291.56 1130.38 L1291.56 1134.32 L1277.49 1134.32 L1277.49 1142.79 Q1278.51 1142.44 1279.53 1142.28 Q1280.55 1142.09 1281.56 1142.09 Q1287.35 1142.09 1290.73 1145.26 Q1294.11 1148.44 1294.11 1153.85 Q1294.11 1159.43 1290.64 1162.53 Q1287.17 1165.61 1280.85 1165.61 Q1278.67 1165.61 1276.4 1165.24 Q1274.16 1164.87 1271.75 1164.13 L1271.75 1159.43 Q1273.83 1160.56 1276.05 1161.12 Q1278.28 1161.68 1280.75 1161.68 Q1284.76 1161.68 1287.1 1159.57 Q1289.43 1157.46 1289.43 1153.85 Q1289.43 1150.24 1287.1 1148.13 Q1284.76 1146.03 1280.75 1146.03 Q1278.88 1146.03 1277 1146.44 Q1275.15 1146.86 1273.21 1147.74 L1273.21 1130.38 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M1313.32 1133.46 Q1309.71 1133.46 1307.88 1137.02 Q1306.08 1140.56 1306.08 1147.69 Q1306.08 1154.8 1307.88 1158.37 Q1309.71 1161.91 1313.32 1161.91 Q1316.96 1161.91 1318.76 1158.37 Q1320.59 1154.8 1320.59 1147.69 Q1320.59 1140.56 1318.76 1137.02 Q1316.96 1133.46 1313.32 1133.46 M1313.32 1129.75 Q1319.13 1129.75 1322.19 1134.36 Q1325.27 1138.94 1325.27 1147.69 Q1325.27 1156.42 1322.19 1161.03 Q1319.13 1165.61 1313.32 1165.61 Q1307.51 1165.61 1304.43 1161.03 Q1301.38 1156.42 1301.38 1147.69 Q1301.38 1138.94 1304.43 1134.36 Q1307.51 1129.75 1313.32 1129.75 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#cli
" 197.427,1078.92 1872.76,1078.92 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip942)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 197.427,835.38 1872.76,835.38 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip942)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 197.427,591.835 1872.76,591.835 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip942)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 197.427,348.29 1872.76,348.29 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip940)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 197.427,1106.38 197.427,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip940)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 197.427,1078.92 216.325,1078.92 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip940)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 197.427,835.38 216.325,835.38 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip940)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 197.427,591.835 216.325,591.835 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip940)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 197.427,348.29 216.325,348.29 \n",
" \"/>\n",
"<path clip-path=\"url(#clip940)\" d=\"M156.683 1064.72 Q153.072 1064.72 151.243 1068.29 Q149.438 1071.83 149.438 1078.96 Q149.438 1086.07 151.243 1089.63 Q153.072 1093.17 156.683 1093.17 Q160.317 1093.17 162.123 1089.63 Q163.952 1086.07 163.952 1078.96 Q163.952 1071.83 162.123 1068.29 Q160.317 1064.72 156.683 1064.72 M156.683 1061.02 Q162.493 1061.02 165.549 1065.63 Q168.627 1070.21 168.627 1078.96 Q168.627 1087.69 165.549 1092.29 Q162.493 1096.88 156.683 1096.88 Q150.873 1096.88 147.794 1092.29 Q144.739 1087.69 144.739 1078.96 Q144.739 1070.21 147.794 1065.63 Q150.873 1061.02 156.683 1061.02 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M147.725 818.1 L166.081 818.1 L166.081 822.035 L152.007 822.035 L152.007 830.507 Q153.026 830.16 154.044 829.998 Q155.063 829.812 156.081 829.812 Q161.868 829.812 165.248 832.984 Q168.627 836.155 168.627 841.572 Q168.627 847.15 165.155 850.252 Q161.683 853.331 155.364 853.331 Q153.188 853.331 150.919 852.961 Q148.674 852.59 146.266 851.849 L146.266 847.15 Q148.35 848.285 150.572 848.84 Q152.794 849.396 155.271 849.396 Q159.276 849.396 161.614 847.289 Q163.952 845.183 163.952 841.572 Q163.952 837.961 161.614 835.854 Q159.276 833.748 155.271 833.748 Q153.396 833.748 151.521 834.164 Q149.669 834.581 147.725 835.461 L147.725 818.1 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M117.331 605.18 L124.97 605.18 L124.97 578.814 L116.66 580.481 L116.66 576.222 L124.924 574.555 L129.6 574.555 L129.6 605.18 L137.239 605.18 L137.239 609.115 L117.331 609.115 L117.331 605.18 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M156.683 577.634 Q153.072 577.634 151.243 581.198 Q149.438 584.74 149.438 591.87 Q149.438 598.976 151.243 602.541 Q153.072 606.082 156.683 606.082 Q160.317 606.082 162.123 602.541 Q163.952 598.976 163.952 591.87 Q163.952 584.74 162.123 581.198 Q160.317 577.634 156.683 577.634 M156.683 573.93 Q162.493 573.93 165.549 578.536 Q168.627 583.12 168.627 591.87 Q168.627 600.596 165.549 605.203 Q162.493 609.786 156.683 609.786 Q150.873 609.786 147.794 605.203 Q144.739 600.596 144.739 591.87 Q144.739 583.12 147.794 578.536 Q150.873 573.93 156.683 573.93 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M118.327 361.635 L125.966 361.635 L125.966 335.269 L117.656 336.936 L117.656 332.677 L125.919 331.01 L130.595 331.01 L130.595 361.635 L138.234 361.635 L138.234 365.57 L118.327 365.57 L118.327 361.635 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M147.725 331.01 L166.081 331.01 L166.081 334.945 L152.007 334.945 L152.007 343.417 Q153.026 343.07 154.044 342.908 Q155.063 342.723 156.081 342.723 Q161.868 342.723 165.248 345.894 Q168.627 349.066 168.627 354.482 Q168.627 360.061 165.155 363.163 Q161.683 366.241 155.364 366.241 Q153.188 366.241 150.919 365.871 Q148.674 365.501 146.266 364.76 L146.266 360.061 Q148.35 361.195 150.572 361.751 Q152.794 362.306 155.271 362.306 Q159.276 362.306 161.614 360.2 Q163.952 358.093 163.952 354.482 Q163.952 350.871 161.614 348.765 Q159.276 346.658 155.271 346.658 Q153.396 346.658 151.521 347.075 Q149.669 347.492 147.725 348.371 L147.725 331.01 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M42.0621 789.569 Q42.0621 794.28 45.7542 797.017 Q49.4145 799.754 55.812 799.754 Q62.2095 799.754 65.9017 797.049 Q69.5619 794.312 69.5619 789.569 Q69.5619 784.89 65.8698 782.153 Q62.1777 779.416 55.812 779.416 Q49.4781 779.416 45.786 782.153 Q42.0621 784.89 42.0621 789.569 M37.0968 789.569 Q37.0968 781.93 42.0621 777.57 Q47.0273 773.209 55.812 773.209 Q64.5649 773.209 69.5619 777.57 Q74.5272 781.93 74.5272 789.569 Q74.5272 797.24 69.5619 801.6 Q64.5649 805.929 55.812 805.929 Q47.0273 805.929 42.0621 801.6 Q37.0968 797.24 37.0968 789.569 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M68.257 757.83
" 244.842,1077.75 297.526,1076.67 350.209,1074.86 402.892,1071.98 455.576,1067.67 508.259,1061.49 560.942,1053.04 613.625,1041.91 666.309,1027.78 718.992,1010.41 \n",
" 771.675,989.657 824.359,965.493 877.042,937.996 929.725,907.332 982.408,873.739 1035.09,837.503 1087.77,798.938 1140.46,758.363 1193.14,716.089 1245.82,672.405 \n",
" 1298.51,627.572 1351.19,581.817 1403.87,535.334 1456.56,488.286 1509.24,440.802 1561.92,392.989 1614.61,344.929 1667.29,296.686 1719.97,248.309 1772.66,199.835 \n",
" 1825.34,151.29 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip942)\" style=\"stroke:#0000ff; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 244.842,543.758 297.526,591.386 350.209,638.28 402.892,684.113 455.576,728.505 508.259,771.038 560.942,811.292 613.625,848.875 666.309,883.456 718.992,914.794 \n",
" 771.675,942.749 824.359,967.295 877.042,988.507 929.725,1006.55 982.408,1021.67 1035.09,1034.14 1087.77,1044.28 1140.46,1052.42 1193.14,1058.85 1245.82,1063.88 \n",
" 1298.51,1067.75 1351.19,1070.71 1403.87,1072.93 1456.56,1074.59 1509.24,1075.82 1561.92,1076.72 1614.61,1077.36 1667.29,1077.83 1719.97,1078.16 1772.66,1078.4 \n",
" 1825.34,1078.56 \n",
" \"/>\n",
"<path clip-path=\"url(#clip940)\" d=\"\n",
"M1556.37 311.756 L1816.91 311.756 L1816.91 156.236 L1556.37 156.236 Z\n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<polyline clip-path=\"url(#clip940)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1556.37,311.756 1816.91,311.756 1816.91,156.236 1556.37,156.236 1556.37,311.756 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip940)\" style=\"stroke:#ff0000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1574.98,208.076 1686.67,208.076 \n",
" \"/>\n",
"<path clip-path=\"url(#clip940)\" d=\"M1725.79 200.425 L1725.79 204.407 Q1723.99 203.411 1722.16 202.925 Q1720.35 202.416 1718.5 202.416 Q1714.36 202.416 1712.07 205.055 Q1709.78 207.671 1709.78 212.416 Q1709.78 217.161 1712.07 219.8 Q1714.36 222.416 1718.5 222.416 Q1720.35 222.416 1722.16 221.93 Q1723.99 221.421 1725.79 220.425 L1725.79 224.36 Q1724.01 225.194 1722.09 225.61 Q1720.19 226.027 1718.04 226.027 Q1712.18 226.027 1708.73 222.346 Q1705.28 218.666 1705.28 212.416 Q1705.28 206.073 1708.76 202.439 Q1712.25 198.805 1718.32 198.805 Q1720.28 198.805 1722.16 199.222 Q1724.03 199.615 1725.79 200.425 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M1744.98 212.323 Q1739.82 212.323 1737.83 213.504 Q1735.84 214.684 1735.84 217.532 Q1735.84 219.8 1737.32 221.143 Q1738.83 222.462 1741.4 222.462 Q1744.94 222.462 1747.07 219.962 Q1749.22 217.439 1749.22 213.272 L1749.22 212.323 L1744.98 212.323 M1753.48 210.564 L1753.48 225.356 L1749.22 225.356 L1749.22 221.421 Q1747.76 223.782 1745.59 224.916 Q1743.41 226.027 1740.26 226.027 Q1736.28 226.027 1733.92 223.805 Q1731.58 221.559 1731.58 217.809 Q1731.58 213.434 1734.5 211.212 Q1737.44 208.99 1743.25 208.99 L1749.22 208.99 L1749.22 208.573 Q1749.22 205.634 1747.27 204.036 Q1745.35 202.416 1741.86 202.416 Q1739.64 202.416 1737.53 202.948 Q1735.42 203.481 1733.48 204.546 L1733.48 200.61 Q1735.82 199.708 1738.02 199.268 Q1740.21 198.805 1742.3 198.805 Q1747.92 198.805 1750.7 201.722 Q1753.48 204.638 1753.48 210.564 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M1762.25 189.337 L1766.51 189.337 L1766.51 225.356 L1762.25 225.356 L1762.25 189.337 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M1775.42 189.337 L1779.68 189.337 L1779.68 225.356 L1775.42 225.356 L1775.42 189.337 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><polyline clip-path=\"url(#clip940)\" style=\"stroke:#0000ff; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1574.98,259.916 1686.67,259.916 \n",
" \"/>\n",
"<path clip-path=\"url(#clip940)\" d=\"M1709.57 273.307 L1709.57 287.057 L1705.28 287.057 L1705.28 251.27 L1709.57 251.27 L1709.57 255.205 Q1710.91 252.89 1712.95 251.779 Q1715.01 250.645 1717.85 250.645 Q1722.58 250.645 1725.52 254.395 Q1728.48 258.145 1728.48 264.256 Q1728.48 270.367 1725.52 274.117 Q1722.58 277.867 1717.85 277.867 Q1715.01 277.867 1712.95 276.756 Q1710.91 275.622 1709.57 273.307 M1724.06 264.256 Q1724.06 259.557 1722.11 256.895 Q1720.19 254.21 1716.81 254.21 Q1713.43 254.21 1711.49 256.895 Q1709.57 259.557 1709.57 264.256 Q1709.57 268.955 1711.49 271.64 Q1713.43 274.302 1716.81 274.302 Q1720.19 274.302 1722.11 271.64 Q1724.06 268.955 1724.06 264.256 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M1735.1 266.964 L1735.1 251.27 L1739.36 251.27 L1739.36 266.802 Q1739.36 270.483 1740.79 272.335 Q1742.23 274.163 1745.1 274.163 Q1748.55 274.163 1750.54 271.964 Q1752.55 269.765 1752.55 265.969 L1752.55 251.27 L1756.81 251.27 L1756.81 277.196 L1752.55 277.196 L1752.55 273.214 Q1751 275.575 1748.94 276.733 Q1746.9 277.867 1744.2 277.867 Q1739.73 277.867 1737.41 275.089 Q1735.1 272.311 1735.1 266.964 M1745.82 250.645 L1745.82 250.645 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip940)\" d=\"M1769.8 243.909 L1769.8 251.27 L1778.57 251.27 L1778.57 254.58 L1769.8 254.58 L1769.8 268.654 Q1769.8 271.825 1770.65 272.728 Q1771.53 273.631 1774.2 273.631 L1778.57 273.631 L1778.57 277.196 L1774.2 277.196 Q1769.27 277.196 1767.39 275.367 Q1765.52 273.515 1765.52 268.654 L1765.52 254.58 L1762.39 254.58 L1762.39 251.27 L1765.52 251.27 L1765.52 243.909 L1769.8 243.909 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /></svg>\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"S_range = range(30.0,60,step=1) #different spot prices\n",
"C_S_range = OptionBlackSPs.(S_range,K,m,y,σ)\n",
"P_S_range = OptionBlackSPs.(S_range,K,m,y,σ,0,true)\n",
"\n",
"p1 = plot( S_range,[C_S_range P_S_range],\n",
" linecolor = [:red :blue],\n",
" label = [\"call\" \"put\"],\n",
" title = \"Black-Scholes call option price, K = $K\",\n",
" xlabel = \"current asset price\",\n",
" ylabel = \"option price\" )\n",
"display(p1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# The Binomial Option Pricing Model\n",
"\n",
"The next cell contains functions to implement a binomial option pricing model for European style (exercise at expiration only) and American style (exercise any day) options. We use the CRR (Cox-Ross-Rubinstein) parameterisation.\n",
"\n",
"The key parameters are the same as before, but also `n` which is the number of time steps used in the calculations (which defaults to 250)."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"BOPM_American (generic function with 3 methods)"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"\"\"\n",
"CRRparams(σ,m,n,y)\n",
"\n",
" BOPM parameters according to CRR\n",
"\"\"\"\n",
"function CRRparams(σ,m,y,n)\n",
" h = m/n #time step size (in years)\n",
" u = exp(σ*sqrt(h)) #up move\n",
" d = exp(-σ*sqrt(h)) #down move\n",
" p = (exp(y*h) - d)/(u-d) #rn prob of up move\n",
" return h,u,d,p\n",
"end \n",
"\n",
"function BOPM_European(S,K,m,y,σ,isPut=false,n=250)\n",
" (h,u,d,p) = CRRparams(σ,m,y,n)\n",
" STree = BuildSTree(S,n,u,d)\n",
" price = EuOptionPrice(STree,K,y,h,p,isPut)[0][]\n",
" return price\n",
"end\n",
"\n",
"function BOPM_American(S,K,m,y,σ,isPut=false,n=250)\n",
" (h,u,d,p) = CRRparams(σ,m,y,n)\n",
" STree = BuildSTree(S,n,u,d)\n",
" price = AmOptionPrice(STree,K,y,h,p,isPut)[1][0][1]\n",
" return price\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"call (Eu) 2.891\n",
"put (Eu) 1.854\n",
"call (Am) 2.891\n",
"put (Am) 1.954\n",
"\n",
"\u001b[31m\u001b[1mNotice that c_e=c_a but that p_a>=p_e\u001b[22m\u001b[39m\n"
]
}
],
"source": [
"c_e = BOPM_European(S,K,m,y,σ,false) #call price, European style\n",
"p_e = BOPM_European(S,K,m,y,σ,true) #put price, European\n",
"\n",
"c_a = BOPM_American(S,K,m,y,σ,false) #call, American\n",
"p_a = BOPM_American(S,K,m,y,σ,true) #put, American\n",
"\n",
"printmat([c_e,p_e,c_a,p_a],rowNames=[\"call (Eu)\",\"put (Eu)\",\"call (Am)\",\"put (Am)\"])\n",
"\n",
"printred(\"Notice that c_e=c_a but that p_a>=p_e\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Task 2\n",
"\n",
"Redo the calculation of p_e and p_a for `S=30:60` and plot the prices."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"480\" height=\"320\" viewBox=\"0 0 1920 1280\">\n",
"<defs>\n",
" <clipPath id=\"clip980\">\n",
" <rect x=\"0\" y=\"0\" width=\"1920\" height=\"1280\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<path clip-path=\"url(#clip980)\" d=\"\n",
"M0 1280 L1920 1280 L1920 0 L0 0 Z\n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<defs>\n",
" <clipPath id=\"clip981\">\n",
" <rect x=\"384\" y=\"0\" width=\"1345\" height=\"1280\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<path clip-path=\"url(#clip980)\" d=\"\n",
"M242.659 1106.38 L1872.76 1106.38 L1872.76 123.472 L242.659 123.472 Z\n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<defs>\n",
" <clipPath id=\"clip982\">\n",
" <rect x=\"242\" y=\"123\" width=\"1631\" height=\"984\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<polyline clip-path=\"url(#clip982)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 288.794,1106.38 288.794,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip982)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 801.403,1106.38 801.403,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip982)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 1314.01,1106.38 1314.01,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip982)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 1826.62,1106.38 1826.62,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip980)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 242.659,1106.38 1872.76,1106.38 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip980)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 288.794,1106.38 288.794,1087.48 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip980)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 801.403,1106.38 801.403,1087.48 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip980)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1314.01,1106.38 1314.01,1087.48 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip980)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1826.62,1106.38 1826.62,1087.48 \n",
" \"/>\n",
"<path clip-path=\"url(#clip980)\" d=\"M277.636 1146.31 Q280.993 1147.02 282.868 1149.29 Q284.766 1151.56 284.766 1154.89 Q284.766 1160.01 281.247 1162.81 Q277.729 1165.61 271.247 1165.61 Q269.071 1165.61 266.757 1165.17 Q264.465 1164.75 262.011 1163.9 L262.011 1159.38 Q263.956 1160.52 266.271 1161.1 Q268.585 1161.68 271.108 1161.68 Q275.507 1161.68 277.798 1159.94 Q280.113 1158.2 280.113 1154.89 Q280.113 1151.84 277.96 1150.13 Q275.831 1148.39 272.011 1148.39 L267.983 1148.39 L267.983 1144.55 L272.196 1144.55 Q275.645 1144.55 277.474 1143.18 Q279.303 1141.79 279.303 1139.2 Q279.303 1136.54 277.405 1135.13 Q275.53 1133.69 272.011 1133.69 Q270.09 1133.69 267.891 1134.11 Q265.692 1134.52 263.053 1135.4 L263.053 1131.24 Q265.715 1130.5 268.03 1130.13 Q270.368 1129.75 272.428 1129.75 Q277.752 1129.75 280.854 1132.19 Q283.956 1134.59 283.956 1138.71 Q283.956 1141.58 282.312 1143.57 Q280.669 1145.54 277.636 1146.31 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M303.631 1133.46 Q300.02 1133.46 298.192 1137.02 Q296.386 1140.56 296.386 1147.69 Q296.386 1154.8 298.192 1158.37 Q300.02 1161.91 303.631 1161.91 Q307.266 1161.91 309.071 1158.37 Q310.9 1154.8 310.9 1147.69 Q310.9 1140.56 309.071 1137.02 Q307.266 1133.46 303.631 1133.46 M303.631 1129.75 Q309.442 1129.75 312.497 1134.36 Q315.576 1138.94 315.576 1147.69 Q315.576 1156.42 312.497 1161.03 Q309.442 1165.61 303.631 1165.61 Q297.821 1165.61 294.743 1161.03 Q291.687 1156.42 291.687 1147.69 Q291.687 1138.94 294.743 1134.36 Q297.821 1129.75 303.631 1129.75 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M789.574 1134.45 L777.769 1152.9 L789.574 1152.9 L789.574 1134.45 M788.347 1130.38 L794.227 1130.38 L794.227 1152.9 L799.157 1152.9 L799.157 1156.79 L794.227 1156.79 L794.227 1164.94 L789.574 1164.94 L789.574 1156.79 L773.972 1156.79 L773.972 1152.28 L788.347 1130.38 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M816.889 1133.46 Q813.278 1133.46 811.449 1137.02 Q809.643 1140.56 809.643 1147.69 Q809.643 1154.8 811.449 1158.37 Q813.278 1161.91 816.889 1161.91 Q820.523 1161.91 822.329 1158.37 Q824.157 1154.8 824.157 1147.69 Q824.157 1140.56 822.329 1137.02 Q820.523 1133.46 816.889 1133.46 M816.889 1129.75 Q822.699 1129.75 825.754 1134.36 Q828.833 1138.94 828.833 1147.69 Q828.833 1156.42 825.754 1161.03 Q822.699 1165.61 816.889 1165.61 Q811.079 1165.61 808 1161.03 Q804.944 1156.42 804.944 1147.69 Q804.944 1138.94 808 1134.36 Q811.079 1129.75 816.889 1129.75 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M1288.71 1130.38 L1307.07 1130.38 L1307.07 1134.32 L1292.99 1134.32 L1292.99 1142.79 Q1294.01 1142.44 1295.03 1142.28 Q1296.05 1142.09 1297.07 1142.09 Q1302.85 1142.09 1306.23 1145.26 Q1309.61 1148.44 1309.61 1153.85 Q1309.61 1159.43 1306.14 1162.53 Q1302.67 1165.61 1296.35 1165.61 Q1294.17 1165.61 1291.91 1165.24 Q1289.66 1164.87 1287.25 1164.13 L1287.25 1159.43 Q1289.34 1160.56 1291.56 1161.12 Q1293.78 1161.68 1296.26 1161.68 Q1300.26 1161.68 1302.6 1159.57 Q1304.94 1157.46 1304.94 1153.85 Q1304.94 1150.24 1302.6 1148.13 Q1300.26 1146.03 1296.26 1146.03 Q1294.38 1146.03 1292.51 1146.44 Q1290.66 1146.86 1288.71 1147.74 L1288.71 1130.38 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M1328.83 1133.46 Q1325.22 1133.46 1323.39 1137.02 Q1321.58 1140.56 1321.58 1147.69 Q1321.58 1154.8 1323.39 1158.37 Q1325.22 1161.91 1328.83 1161.91 Q1332.46 1161.91 1334.27 1158.37 Q1336.1 1154.8 1336.1 1147.69 Q1336.1 1140.56 1334.27 1137.02 Q1332.46 1133.46 1328.83 1133.46 M1328.83 1129.75 Q1334.64 1129.75 1337.69 1134.36 Q1340.77 1138.94 1340.77 1147.69 Q1340.77 1156.42 1337.69 1161.03 Q1334.64 1165.61 1328.83 1165.61 Q1323.02 1165.61 1319.94 1161.03 Q1316.88 1156.42 1316.88 1147.69 Q1316.88 1138.94 1319.94 1134.36 Q1323.02 1129.75 1328.83 1129.75 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\
" 242.659,1079.12 1872.76,1079.12 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip982)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 242.659,885.825 1872.76,885.825 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip982)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 242.659,692.527 1872.76,692.527 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip982)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 242.659,499.228 1872.76,499.228 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip982)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 242.659,305.929 1872.76,305.929 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip980)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 242.659,1106.38 242.659,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip980)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 242.659,1079.12 261.556,1079.12 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip980)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 242.659,885.825 261.556,885.825 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip980)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 242.659,692.527 261.556,692.527 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip980)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 242.659,499.228 261.556,499.228 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip980)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 242.659,305.929 261.556,305.929 \n",
" \"/>\n",
"<path clip-path=\"url(#clip980)\" d=\"M156.683 1064.92 Q153.072 1064.92 151.243 1068.49 Q149.438 1072.03 149.438 1079.16 Q149.438 1086.27 151.243 1089.83 Q153.072 1093.37 156.683 1093.37 Q160.317 1093.37 162.123 1089.83 Q163.952 1086.27 163.952 1079.16 Q163.952 1072.03 162.123 1068.49 Q160.317 1064.92 156.683 1064.92 M156.683 1061.22 Q162.493 1061.22 165.549 1065.83 Q168.627 1070.41 168.627 1079.16 Q168.627 1087.89 165.549 1092.49 Q162.493 1097.08 156.683 1097.08 Q150.873 1097.08 147.794 1092.49 Q144.739 1087.89 144.739 1079.16 Q144.739 1070.41 147.794 1065.83 Q150.873 1061.22 156.683 1061.22 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M176.845 1090.52 L181.729 1090.52 L181.729 1096.4 L176.845 1096.4 L176.845 1090.52 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M201.914 1064.92 Q198.303 1064.92 196.475 1068.49 Q194.669 1072.03 194.669 1079.16 Q194.669 1086.27 196.475 1089.83 Q198.303 1093.37 201.914 1093.37 Q205.549 1093.37 207.354 1089.83 Q209.183 1086.27 209.183 1079.16 Q209.183 1072.03 207.354 1068.49 Q205.549 1064.92 201.914 1064.92 M201.914 1061.22 Q207.724 1061.22 210.78 1065.83 Q213.859 1070.41 213.859 1079.16 Q213.859 1087.89 210.78 1092.49 Q207.724 1097.08 201.914 1097.08 Q196.104 1097.08 193.025 1092.49 Q189.97 1087.89 189.97 1079.16 Q189.97 1070.41 193.025 1065.83 Q196.104 1061.22 201.914 1061.22 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M151.706 899.17 L168.026 899.17 L168.026 903.105 L146.081 903.105 L146.081 899.17 Q148.743 896.416 153.327 891.786 Q157.933 887.133 159.114 885.791 Q161.359 883.268 162.239 881.531 Q163.141 879.772 163.141 878.082 Q163.141 875.328 161.197 873.592 Q159.276 871.856 156.174 871.856 Q153.975 871.856 151.521 872.619 Q149.091 873.383 146.313 874.934 L146.313 870.212 Q149.137 869.078 151.591 868.499 Q154.044 867.92 156.081 867.92 Q161.452 867.92 164.646 870.606 Q167.84 873.291 167.84 877.781 Q167.84 879.911 167.03 881.832 Q166.243 883.73 164.137 886.323 Q163.558 886.994 160.456 890.212 Q157.354 893.406 151.706 899.17 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M177.84 897.226 L182.725 897.226 L182.725 903.105 L177.84 903.105 L177.84 897.226 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M192.956 868.545 L211.312 868.545 L211.312 872.481 L197.238 872.481 L197.238 880.953 Q198.257 880.605 199.275 880.443 Q200.294 880.258 201.312 880.258 Q207.099 880.258 210.479 883.43 Q213.859 886.601 213.859 892.017 Q213.859 897.596 210.387 900.698 Q206.914 903.777 200.595 903.777 Q198.419 903.777 196.15 903.406 Q193.905 903.036 191.498 902.295 L191.498 897.596 Q193.581 898.73 195.803 899.286 Q198.025 899.841 200.502 899.841 Q204.507 899.841 206.845 897.735 Q209.183 895.629 209.183 892.017 Q209.183 888.406 206.845 886.3 Q204.507 884.193 200.502 884.193 Q198.627 884.193 196.752 884.61 Q194.9 885.027 192.956 885.906 L192.956 868.545 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M146.729 675.247 L165.086 675.247 L165.086 679.182 L151.012 679.182 L151.012 687.654 Q152.03 687.307 153.049 687.145 Q154.067 686.96 155.086 686.96 Q160.873 686.96 164.252 690.131 Q167.632 693.302 167.632 698.719 Q167.632 704.297 164.16 707.399 Q160.688 710.478 154.368 710.478 Q152.192 710.478 149.924 710.108 Q147.679 709.737 145.271 708.996 L145.271 704.297 Q147.354 705.432 149.577 705.987 Q151.799 706.543 154.276 706.543 Q158.28 706.543 160.618 704.436 Q162.956 702.33 162.956 698.719 Q162.956 695.108 160.618 693.001 Q158.28 690.895 154.276 690.895 Q152.401 690.895 150.526 691.311 Q148.674 691.728 146.729 692.608 L146.729 675.247 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M176.845 703.927 L181.729 703.927 L181.729 709.807 L176.845 709.807 L176.845 703.927 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path
" 288.794,229.638 340.054,305.276 391.315,379.698 442.576,452.421 493.837,522.924 545.098,590.44 596.359,654.252 647.62,714.053 698.881,768.745 750.142,818.622 \n",
" 801.403,862.88 852.664,901.792 903.925,935.781 955.185,964.122 1006.45,988.09 1057.71,1008.04 1108.97,1024.2 1160.23,1036.99 1211.49,1047.18 1262.75,1055.19 \n",
" 1314.01,1061.38 1365.27,1066.11 1416.53,1069.67 1467.79,1072.32 1519.06,1074.24 1570.32,1075.65 1621.58,1076.68 1672.84,1077.41 1724.1,1077.94 1775.36,1078.31 \n",
" 1826.62,1078.56 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip982)\" style=\"stroke:#0000ff; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 288.794,151.29 340.054,228.61 391.315,305.929 442.576,383.249 493.837,460.568 545.098,537.888 596.359,613.344 647.62,682.384 698.881,744.605 750.142,800.208 \n",
" 801.403,849.056 852.664,891.452 903.925,928.017 955.185,958.491 1006.45,983.973 1057.71,1005.03 1108.97,1022.04 1160.23,1035.47 1211.49,1046.1 1262.75,1054.42 \n",
" 1314.01,1060.84 1365.27,1065.73 1416.53,1069.41 1467.79,1072.13 1519.06,1074.12 1570.32,1075.57 1621.58,1076.62 1672.84,1077.38 1724.1,1077.91 1775.36,1078.29 \n",
" 1826.62,1078.55 \n",
" \"/>\n",
"<path clip-path=\"url(#clip980)\" d=\"\n",
"M1416.09 311.756 L1818.42 311.756 L1818.42 156.236 L1416.09 156.236 Z\n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<polyline clip-path=\"url(#clip980)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1416.09,311.756 1818.42,311.756 1818.42,156.236 1416.09,156.236 1416.09,311.756 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip980)\" style=\"stroke:#ff0000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1434.21,208.076 1542.88,208.076 \n",
" \"/>\n",
"<path clip-path=\"url(#clip980)\" d=\"M1560.99 190.796 L1582.84 190.796 L1582.84 194.731 L1565.67 194.731 L1565.67 204.962 L1582.13 204.962 L1582.13 208.897 L1565.67 208.897 L1565.67 221.421 L1583.26 221.421 L1583.26 225.356 L1560.99 225.356 L1560.99 190.796 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M1590.32 215.124 L1590.32 199.43 L1594.58 199.43 L1594.58 214.962 Q1594.58 218.643 1596.02 220.495 Q1597.45 222.323 1600.32 222.323 Q1603.77 222.323 1605.76 220.124 Q1607.77 217.925 1607.77 214.129 L1607.77 199.43 L1612.03 199.43 L1612.03 225.356 L1607.77 225.356 L1607.77 221.374 Q1606.22 223.735 1604.16 224.893 Q1602.13 226.027 1599.42 226.027 Q1594.95 226.027 1592.64 223.249 Q1590.32 220.471 1590.32 215.124 M1601.04 198.805 L1601.04 198.805 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M1635.83 203.411 Q1635.11 202.995 1634.26 202.81 Q1633.42 202.601 1632.4 202.601 Q1628.79 202.601 1626.85 204.962 Q1624.93 207.3 1624.93 211.698 L1624.93 225.356 L1620.64 225.356 L1620.64 199.43 L1624.93 199.43 L1624.93 203.458 Q1626.27 201.097 1628.42 199.962 Q1630.58 198.805 1633.65 198.805 Q1634.09 198.805 1634.63 198.874 Q1635.16 198.921 1635.81 199.036 L1635.83 203.411 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M1649.3 202.416 Q1645.88 202.416 1643.89 205.101 Q1641.89 207.763 1641.89 212.416 Q1641.89 217.069 1643.86 219.754 Q1645.85 222.416 1649.3 222.416 Q1652.7 222.416 1654.7 219.731 Q1656.69 217.046 1656.69 212.416 Q1656.69 207.81 1654.7 205.124 Q1652.7 202.416 1649.3 202.416 M1649.3 198.805 Q1654.86 198.805 1658.03 202.416 Q1661.2 206.027 1661.2 212.416 Q1661.2 218.782 1658.03 222.416 Q1654.86 226.027 1649.3 226.027 Q1643.72 226.027 1640.55 222.416 Q1637.4 218.782 1637.4 212.416 Q1637.4 206.027 1640.55 202.416 Q1643.72 198.805 1649.3 198.805 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M1672.38 221.467 L1672.38 235.217 L1668.1 235.217 L1668.1 199.43 L1672.38 199.43 L1672.38 203.365 Q1673.72 201.05 1675.76 199.939 Q1677.82 198.805 1680.67 198.805 Q1685.39 198.805 1688.33 202.555 Q1691.29 206.305 1691.29 212.416 Q1691.29 218.527 1688.33 222.277 Q1685.39 226.027 1680.67 226.027 Q1677.82 226.027 1675.76 224.916 Q1673.72 223.782 1672.38 221.467 M1686.87 212.416 Q1686.87 207.717 1684.93 205.055 Q1683.01 202.37 1679.63 202.37 Q1676.25 202.37 1674.3 205.055 Q1672.38 207.717 1672.38 212.416 Q1672.38 217.115 1674.3 219.8 Q1676.25 222.462 1679.63 222.462 Q1683.01 222.462 1684.93 219.8 Q1686.87 217.115 1686.87 212.416 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M1720.53 211.328 L1720.53 213.411 L1700.95 213.411 Q1701.22 217.809 1703.58 220.124 Q1705.97 222.416 1710.2 222.416 Q1712.66 222.416 1714.95 221.814 Q1717.26 221.212 1719.53 220.009 L1719.53 224.036 Q1717.24 225.008 1714.83 225.518 Q1712.43 226.027 1709.95 226.027 Q1703.75 226.027 1700.11 222.416 Q1696.5 218.805 1696.5 212.647 Q1696.5 206.282 1699.93 202.555 Q1703.38 198.805 1709.21 198.805 Q1714.44 198.805 1717.47 202.185 Q1720.53 205.541 1720.53 211.328 M1716.27 210.078 Q1716.22 206.583 1714.3 204.499 Q1712.4 202.416 1709.26 202.416 Q1705.69 202.416 1703.54 204.43 Q1701.41 206.444 1701.08 210.101 L1716.27 210.078 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M1739.3 212.323 Q1734.14 212.323 1732.15 213.504 Q1730.16 214.684 1730.16 217.532 Q1730.16 219.8 1731.64 221.143 Q1733.14 222.462 1735.71 222.462 Q1739.26 222.462 1741.38 219.962 Q1743.54 217.439 1743.54 213.272 L1743.54 212.323 L1739.3 212.323 M1747.8 210.564 L1747.8 225.356 L1743.54 225.356 L1743.54 221.421 Q1742.08 223.782 1739.9 224.916 Q1737.73 226.027 1734.58 226.027 Q1730.6 226.027 1728.24 223.805 Q1725.9 221.559 1725.9 217.809 Q1725.9 213.434 1728.82 211.212 Q1731.76 208.99 1737.57 208.99 L1743.54 208.99 L1743.54 208.573 Q1743.54 205.634 1741.59 204.036 Q1739.67 202.416 1736.1
" 1434.21,259.916 1542.88,259.916 \n",
" \"/>\n",
"<path clip-path=\"url(#clip980)\" d=\"M1576.83 247.242 L1570.48 264.441 L1583.19 264.441 L1576.83 247.242 M1574.19 242.636 L1579.49 242.636 L1592.66 277.196 L1587.8 277.196 L1584.65 268.33 L1569.07 268.33 L1565.92 277.196 L1560.99 277.196 L1574.19 242.636 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M1617.71 256.247 Q1619.3 253.376 1621.52 252.011 Q1623.75 250.645 1626.76 250.645 Q1630.81 250.645 1633.01 253.492 Q1635.2 256.316 1635.2 261.548 L1635.2 277.196 L1630.92 277.196 L1630.92 261.687 Q1630.92 257.96 1629.6 256.154 Q1628.28 254.349 1625.58 254.349 Q1622.27 254.349 1620.34 256.548 Q1618.42 258.747 1618.42 262.543 L1618.42 277.196 L1614.14 277.196 L1614.14 261.687 Q1614.14 257.937 1612.82 256.154 Q1611.5 254.349 1608.75 254.349 Q1605.48 254.349 1603.56 256.571 Q1601.64 258.77 1601.64 262.543 L1601.64 277.196 L1597.36 277.196 L1597.36 251.27 L1601.64 251.27 L1601.64 255.298 Q1603.1 252.913 1605.14 251.779 Q1607.17 250.645 1609.97 250.645 Q1612.8 250.645 1614.77 252.08 Q1616.76 253.515 1617.71 256.247 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M1665.88 263.168 L1665.88 265.251 L1646.29 265.251 Q1646.57 269.649 1648.93 271.964 Q1651.32 274.256 1655.55 274.256 Q1658.01 274.256 1660.3 273.654 Q1662.61 273.052 1664.88 271.849 L1664.88 275.876 Q1662.59 276.848 1660.18 277.358 Q1657.77 277.867 1655.3 277.867 Q1649.09 277.867 1645.46 274.256 Q1641.85 270.645 1641.85 264.487 Q1641.85 258.122 1645.27 254.395 Q1648.72 250.645 1654.56 250.645 Q1659.79 250.645 1662.82 254.025 Q1665.88 257.381 1665.88 263.168 M1661.62 261.918 Q1661.57 258.423 1659.65 256.339 Q1657.75 254.256 1654.6 254.256 Q1651.04 254.256 1648.89 256.27 Q1646.76 258.284 1646.43 261.941 L1661.62 261.918 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M1687.89 255.251 Q1687.17 254.835 1686.32 254.65 Q1685.48 254.441 1684.46 254.441 Q1680.85 254.441 1678.91 256.802 Q1676.99 259.14 1676.99 263.538 L1676.99 277.196 L1672.7 277.196 L1672.7 251.27 L1676.99 251.27 L1676.99 255.298 Q1678.33 252.937 1680.48 251.802 Q1682.64 250.645 1685.71 250.645 Q1686.15 250.645 1686.69 250.714 Q1687.22 250.761 1687.87 250.876 L1687.89 255.251 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M1692.36 251.27 L1696.62 251.27 L1696.62 277.196 L1692.36 277.196 L1692.36 251.27 M1692.36 241.177 L1696.62 241.177 L1696.62 246.571 L1692.36 246.571 L1692.36 241.177 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M1724.19 252.265 L1724.19 256.247 Q1722.38 255.251 1720.55 254.765 Q1718.75 254.256 1716.89 254.256 Q1712.75 254.256 1710.46 256.895 Q1708.17 259.511 1708.17 264.256 Q1708.17 269.001 1710.46 271.64 Q1712.75 274.256 1716.89 274.256 Q1718.75 274.256 1720.55 273.77 Q1722.38 273.261 1724.19 272.265 L1724.19 276.2 Q1722.4 277.034 1720.48 277.45 Q1718.58 277.867 1716.43 277.867 Q1710.57 277.867 1707.13 274.186 Q1703.68 270.506 1703.68 264.256 Q1703.68 257.913 1707.15 254.279 Q1710.64 250.645 1716.71 250.645 Q1718.68 250.645 1720.55 251.062 Q1722.43 251.455 1724.19 252.265 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip980)\" d=\"M1743.38 264.163 Q1738.21 264.163 1736.22 265.344 Q1734.23 266.524 1734.23 269.372 Q1734.23 271.64 1735.71 272.983 Q1737.22 274.302 1739.79 274.302 Q1743.33 274.302 1745.46 271.802 Q1747.61 269.279 1747.61 265.112 L1747.61 264.163 L1743.38 264.163 M1751.87 262.404 L1751.87 277.196 L1747.61 277.196 L1747.61 273.261 Q1746.15 275.622 1743.98 276.756 Q1741.8 277.867 1738.65 277.867 Q1734.67 277.867 1732.31 275.645 Q1729.97 273.399 1729.97 269.649 Q1729.97 265.274 1732.89 263.052 Q1735.83 260.83 1741.64 260.83 L1747.61 260.83 L1747.61 260.413 Q1747.61 257.474 1745.67 255.876 Q1743.75 254.256 1740.25 254.256 Q1738.03 254.256 1735.92 254.788 Q1733.82 255.321 1731.87 256.386 L1731.87 252.45 Q1734.21 251.548 1736.41 251.108 Q1738.61 250.645 1740.69 250.645
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"p_e = BOPM_European.(S_range,K,m,y,σ,true)\n",
"p_a = BOPM_American.(S_range,K,m,y,σ,true)\n",
"\n",
"p1 = plot( S_range,[p_e p_a],\n",
" linecolor = [:red :blue],\n",
" label = [\"European\" \"American\"],\n",
" title = \"BOPM put option prices, K=$K\",\n",
" xlabel = \"current asset price\",\n",
" ylabel = \"option price\" )\n",
"display(p1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Delta\n",
"\n",
"To hedge an option contract (eg. if we are short one option contract), we buy $\\Delta$ units of the underlying asset, where $\\Delta$ is the partial derivative of the option price with respect to the price of the underlying asset.\n",
"\n",
"Calculate $\\Delta$ for both the European and American puts, using the BOPM function. Do the calculation for each value in `S_range` and plot the results.\n",
"\n",
"To calculate the derivatives we use \n",
"`FiniteDiff.finite_difference_derivative(the function,an S value)`"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"L = length(S_range)\n",
"(Δp_e,Δp_a) = [fill(NaN,L) for _=1:2]\n",
"for i = 1:L\n",
" Δp_e[i] = FiniteDiff.finite_difference_derivative( z->BOPM_European(z,K,m,y,σ,true),S_range[i] )\n",
" Δp_a[i] = FiniteDiff.finite_difference_derivative( z->BOPM_American(z,K,m,y,σ,true),S_range[i] )\n",
"end\n",
"\n",
" #this would also work, no need for a loop\n",
" #FiniteDiff.finite_difference_derivative( z->BOPM_European.(z,K,m,y,σ,true),S_range,Val{:central} )"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"480\" height=\"320\" viewBox=\"0 0 1920 1280\">\n",
"<defs>\n",
" <clipPath id=\"clip020\">\n",
" <rect x=\"0\" y=\"0\" width=\"1920\" height=\"1280\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<path clip-path=\"url(#clip020)\" d=\"\n",
"M0 1280 L1920 1280 L1920 0 L0 0 Z\n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<defs>\n",
" <clipPath id=\"clip021\">\n",
" <rect x=\"384\" y=\"0\" width=\"1345\" height=\"1280\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<path clip-path=\"url(#clip020)\" d=\"\n",
"M282.566 1106.38 L1872.76 1106.38 L1872.76 123.472 L282.566 123.472 Z\n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<defs>\n",
" <clipPath id=\"clip022\">\n",
" <rect x=\"282\" y=\"123\" width=\"1591\" height=\"984\"/>\n",
" </clipPath>\n",
"</defs>\n",
"<polyline clip-path=\"url(#clip022)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 327.571,1106.38 327.571,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip022)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 827.631,1106.38 827.631,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip022)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 1327.69,1106.38 1327.69,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip022)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 1827.75,1106.38 1827.75,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip020)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 282.566,1106.38 1872.76,1106.38 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip020)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 327.571,1106.38 327.571,1087.48 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip020)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 827.631,1106.38 827.631,1087.48 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip020)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1327.69,1106.38 1327.69,1087.48 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip020)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1827.75,1106.38 1827.75,1087.48 \n",
" \"/>\n",
"<path clip-path=\"url(#clip020)\" d=\"M316.414 1146.31 Q319.77 1147.02 321.645 1149.29 Q323.544 1151.56 323.544 1154.89 Q323.544 1160.01 320.025 1162.81 Q316.507 1165.61 310.025 1165.61 Q307.849 1165.61 305.534 1165.17 Q303.243 1164.75 300.789 1163.9 L300.789 1159.38 Q302.733 1160.52 305.048 1161.1 Q307.363 1161.68 309.886 1161.68 Q314.284 1161.68 316.576 1159.94 Q318.891 1158.2 318.891 1154.89 Q318.891 1151.84 316.738 1150.13 Q314.608 1148.39 310.789 1148.39 L306.761 1148.39 L306.761 1144.55 L310.974 1144.55 Q314.423 1144.55 316.252 1143.18 Q318.081 1141.79 318.081 1139.2 Q318.081 1136.54 316.182 1135.13 Q314.307 1133.69 310.789 1133.69 Q308.868 1133.69 306.669 1134.11 Q304.47 1134.52 301.831 1135.4 L301.831 1131.24 Q304.493 1130.5 306.808 1130.13 Q309.145 1129.75 311.206 1129.75 Q316.53 1129.75 319.632 1132.19 Q322.733 1134.59 322.733 1138.71 Q322.733 1141.58 321.09 1143.57 Q319.446 1145.54 316.414 1146.31 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M342.409 1133.46 Q338.798 1133.46 336.969 1137.02 Q335.164 1140.56 335.164 1147.69 Q335.164 1154.8 336.969 1158.37 Q338.798 1161.91 342.409 1161.91 Q346.043 1161.91 347.849 1158.37 Q349.678 1154.8 349.678 1147.69 Q349.678 1140.56 347.849 1137.02 Q346.043 1133.46 342.409 1133.46 M342.409 1129.75 Q348.219 1129.75 351.275 1134.36 Q354.354 1138.94 354.354 1147.69 Q354.354 1156.42 351.275 1161.03 Q348.219 1165.61 342.409 1165.61 Q336.599 1165.61 333.52 1161.03 Q330.465 1156.42 330.465 1147.69 Q330.465 1138.94 333.52 1134.36 Q336.599 1129.75 342.409 1129.75 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M815.802 1134.45 L803.997 1152.9 L815.802 1152.9 L815.802 1134.45 M814.576 1130.38 L820.455 1130.38 L820.455 1152.9 L825.386 1152.9 L825.386 1156.79 L820.455 1156.79 L820.455 1164.94 L815.802 1164.94 L815.802 1156.79 L800.201 1156.79 L800.201 1152.28 L814.576 1130.38 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M843.117 1133.46 Q839.506 1133.46 837.677 1137.02 Q835.872 1140.56 835.872 1147.69 Q835.872 1154.8 837.677 1158.37 Q839.506 1161.91 843.117 1161.91 Q846.751 1161.91 848.557 1158.37 Q850.386 1154.8 850.386 1147.69 Q850.386 1140.56 848.557 1137.02 Q846.751 1133.46 843.117 1133.46 M843.117 1129.75 Q848.927 1129.75 851.983 1134.36 Q855.061 1138.94 855.061 1147.69 Q855.061 1156.42 851.983 1161.03 Q848.927 1165.61 843.117 1165.61 Q837.307 1165.61 834.228 1161.03 Q831.173 1156.42 831.173 1147.69 Q831.173 1138.94 834.228 1134.36 Q837.307 1129.75 843.117 1129.75 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M1302.39 1130.38 L1320.75 1130.38 L1320.75 1134.32 L1306.67 1134.32 L1306.67 1142.79 Q1307.69 1142.44 1308.71 1142.28 Q1309.73 1142.09 1310.75 1142.09 Q1316.53 1142.09 1319.91 1145.26 Q1323.29 1148.44 1323.29 1153.85 Q1323.29 1159.43 1319.82 1162.53 Q1316.35 1165.61 1310.03 1165.61 Q1307.85 1165.61 1305.58 1165.24 Q1303.34 1164.87 1300.93 1164.13 L1300.93 1159.43 Q1303.01 1160.56 1305.24 1161.12 Q1307.46 1161.68 1309.94 1161.68 Q1313.94 1161.68 1316.28 1159.57 Q1318.62 1157.46 1318.62 1153.85 Q1318.62 1150.24 1316.28 1148.13 Q1313.94 1146.03 1309.94 1146.03 Q1308.06 1146.03 1306.19 1146.44 Q1304.33 1146.86 1302.39 1147.74 L1302.39 1130.38 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M1342.51 1133.46 Q1338.89 1133.46 1337.07 1137.02 Q1335.26 1140.56 1335.26 1147.69 Q1335.26 1154.8 1337.07 1158.37 Q1338.89 1161.91 1342.51 1161.91 Q1346.14 1161.91 1347.95 1158.37 Q1349.77 1154.8 1349.77 1147.69 Q1349.77 1140.56 1347.95 1137.02 Q1346.14 1133.46 1342.51 1133.46 M1342.51 1129.75 Q1348.32 1129.75 1351.37 1134.36 Q1354.45 1138.94 1354.45 1147.69 Q1354.45 1156.42 1351.37 1161.03 Q1348.32 1165.61 1342.51 1165.61 Q1336.7 1165.61 1333.62 1161.03 Q1330.56 1156.42 1330.56 1147.69 Q1330.56 1138.94 1333.62 1134.36 Q1336.7 1129.75 1342.51 1129.75 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" />
" 282.566,1078.56 1872.76,1078.56 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip022)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 282.566,845.98 1872.76,845.98 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip022)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 282.566,613.399 1872.76,613.399 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip022)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 282.566,380.817 1872.76,380.817 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip022)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:2; stroke-opacity:0.1; fill:none\" points=\"\n",
" 282.566,148.236 1872.76,148.236 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip020)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 282.566,1106.38 282.566,123.472 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip020)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 282.566,1078.56 301.464,1078.56 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip020)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 282.566,845.98 301.464,845.98 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip020)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 282.566,613.399 301.464,613.399 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip020)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 282.566,380.817 301.464,380.817 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip020)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 282.566,148.236 301.464,148.236 \n",
" \"/>\n",
"<path clip-path=\"url(#clip020)\" d=\"M116.66 1079.01 L146.336 1079.01 L146.336 1082.95 L116.66 1082.95 L116.66 1079.01 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M157.239 1091.91 L164.877 1091.91 L164.877 1065.54 L156.567 1067.21 L156.567 1062.95 L164.831 1061.28 L169.507 1061.28 L169.507 1091.91 L177.146 1091.91 L177.146 1095.84 L157.239 1095.84 L157.239 1091.91 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M186.59 1089.96 L191.475 1089.96 L191.475 1095.84 L186.59 1095.84 L186.59 1089.96 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M211.66 1064.36 Q208.049 1064.36 206.22 1067.93 Q204.414 1071.47 204.414 1078.6 Q204.414 1085.7 206.22 1089.27 Q208.049 1092.81 211.66 1092.81 Q215.294 1092.81 217.099 1089.27 Q218.928 1085.7 218.928 1078.6 Q218.928 1071.47 217.099 1067.93 Q215.294 1064.36 211.66 1064.36 M211.66 1060.66 Q217.47 1060.66 220.525 1065.26 Q223.604 1069.85 223.604 1078.6 Q223.604 1087.32 220.525 1091.93 Q217.47 1096.51 211.66 1096.51 Q205.849 1096.51 202.771 1091.93 Q199.715 1087.32 199.715 1078.6 Q199.715 1069.85 202.771 1065.26 Q205.849 1060.66 211.66 1060.66 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M241.822 1064.36 Q238.21 1064.36 236.382 1067.93 Q234.576 1071.47 234.576 1078.6 Q234.576 1085.7 236.382 1089.27 Q238.21 1092.81 241.822 1092.81 Q245.456 1092.81 247.261 1089.27 Q249.09 1085.7 249.09 1078.6 Q249.09 1071.47 247.261 1067.93 Q245.456 1064.36 241.822 1064.36 M241.822 1060.66 Q247.632 1060.66 250.687 1065.26 Q253.766 1069.85 253.766 1078.6 Q253.766 1087.32 250.687 1091.93 Q247.632 1096.51 241.822 1096.51 Q236.011 1096.51 232.933 1091.93 Q229.877 1087.32 229.877 1078.6 Q229.877 1069.85 232.933 1065.26 Q236.011 1060.66 241.822 1060.66 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M117.656 846.432 L147.331 846.432 L147.331 850.367 L117.656 850.367 L117.656 846.432 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M167.424 831.779 Q163.813 831.779 161.984 835.344 Q160.178 838.885 160.178 846.015 Q160.178 853.121 161.984 856.686 Q163.813 860.228 167.424 860.228 Q171.058 860.228 172.864 856.686 Q174.692 853.121 174.692 846.015 Q174.692 838.885 172.864 835.344 Q171.058 831.779 167.424 831.779 M167.424 828.075 Q173.234 828.075 176.289 832.682 Q179.368 837.265 179.368 846.015 Q179.368 854.742 176.289 859.348 Q173.234 863.932 167.424 863.932 Q161.614 863.932 158.535 859.348 Q155.479 854.742 155.479 846.015 Q155.479 837.265 158.535 832.682 Q161.614 828.075 167.424 828.075 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M187.586 857.381 L192.47 857.381 L192.47 863.26 L187.586 863.26 L187.586 857.381 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M201.475 828.7 L223.697 828.7 L223.697 830.691 L211.15 863.26 L206.266 863.26 L218.072 832.635 L201.475 832.635 L201.475 828.7 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M232.863 828.7 L251.22 828.7 L251.22 832.635 L237.146 832.635 L237.146 841.108 Q238.164 840.76 239.183 840.598 Q240.201 840.413 241.22 840.413 Q247.007 840.413 250.386 843.584 Q253.766 846.756 253.766 852.172 Q253.766 857.751 250.294 860.853 Q246.821 863.932 240.502 863.932 Q238.326 863.932 236.058 863.561 Q233.812 863.191 231.405 862.45 L231.405 857.751 Q233.488 858.885 235.71 859.441 Q237.933 859.996 240.409 859.996 Q244.414 859.996 246.752 857.89 Q249.09 855.783 249.09 852.172 Q249.09 848.561 246.752 846.455 Q244.414 844.348 240.409 844.348 Q238.535 844.348 236.66 844.765 Q234.808 845.182 232.863 846.061 L232.863 828.7 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M116.66 613.85 L146.336 613.85 L146.336 617.785 L116.66 617.785 L116.66 613.85
" 327.571,1061.79 377.577,1048.11 427.583,1038.41 477.589,1011.6 527.595,972.886 577.601,948.442 627.607,888.825 677.613,853.749 727.619,774.239 777.625,730.656 \n",
" 827.631,638.769 877.637,591.863 927.643,522.562 977.649,456.086 1027.65,414.701 1077.66,376.159 1127.67,308.964 1177.67,280.672 1227.68,255.952 1277.68,234.696 \n",
" 1327.69,216.709 1377.7,201.729 1427.7,189.453 1477.71,171.696 1527.71,165.561 1577.72,160.846 1627.73,157.281 1677.73,154.629 1727.74,152.688 1777.74,152.688 \n",
" 1827.75,151.29 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip022)\" style=\"stroke:#0000ff; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 327.571,1078.56 377.577,1078.56 427.583,1078.56 477.589,1078.56 527.595,1078.56 577.601,1078.56 627.607,1021.06 677.613,944.264 727.619,854.392 777.625,785.233 \n",
" 827.631,689.823 877.637,625.512 927.643,558.483 977.649,478.585 1027.65,429.042 1077.66,385.443 1127.67,320.412 1177.67,287.479 1227.68,260.089 1277.68,237.397 \n",
" 1327.69,218.388 1377.7,202.853 1427.7,190.163 1477.71,175.861 1527.71,166.675 1577.72,161.64 1627.73,157.689 1677.73,155.02 1727.74,152.957 1777.74,152.727 \n",
" 1827.75,151.316 \n",
" \"/>\n",
"<path clip-path=\"url(#clip020)\" d=\"\n",
"M1421.86 311.756 L1819.75 311.756 L1819.75 156.236 L1421.86 156.236 Z\n",
" \" fill=\"#ffffff\" fill-rule=\"evenodd\" fill-opacity=\"1\"/>\n",
"<polyline clip-path=\"url(#clip020)\" style=\"stroke:#000000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1421.86,311.756 1819.75,311.756 1819.75,156.236 1421.86,156.236 1421.86,311.756 \n",
" \"/>\n",
"<polyline clip-path=\"url(#clip020)\" style=\"stroke:#ff0000; stroke-linecap:butt; stroke-linejoin:round; stroke-width:4; stroke-opacity:1; fill:none\" points=\"\n",
" 1439.53,208.076 1545.54,208.076 \n",
" \"/>\n",
"<path clip-path=\"url(#clip020)\" d=\"M1563.21 190.796 L1585.06 190.796 L1585.06 194.731 L1567.89 194.731 L1567.89 204.962 L1584.34 204.962 L1584.34 208.897 L1567.89 208.897 L1567.89 221.421 L1585.48 221.421 L1585.48 225.356 L1563.21 225.356 L1563.21 190.796 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M1592.54 215.124 L1592.54 199.43 L1596.8 199.43 L1596.8 214.962 Q1596.8 218.643 1598.23 220.495 Q1599.67 222.323 1602.54 222.323 Q1605.99 222.323 1607.98 220.124 Q1609.99 217.925 1609.99 214.129 L1609.99 199.43 L1614.25 199.43 L1614.25 225.356 L1609.99 225.356 L1609.99 221.374 Q1608.44 223.735 1606.38 224.893 Q1604.34 226.027 1601.64 226.027 Q1597.17 226.027 1594.85 223.249 Q1592.54 220.471 1592.54 215.124 M1603.26 198.805 L1603.26 198.805 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M1638.05 203.411 Q1637.33 202.995 1636.47 202.81 Q1635.64 202.601 1634.62 202.601 Q1631.01 202.601 1629.07 204.962 Q1627.14 207.3 1627.14 211.698 L1627.14 225.356 L1622.86 225.356 L1622.86 199.43 L1627.14 199.43 L1627.14 203.458 Q1628.49 201.097 1630.64 199.962 Q1632.79 198.805 1635.87 198.805 Q1636.31 198.805 1636.84 198.874 Q1637.38 198.921 1638.02 199.036 L1638.05 203.411 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M1651.52 202.416 Q1648.09 202.416 1646.1 205.101 Q1644.11 207.763 1644.11 212.416 Q1644.11 217.069 1646.08 219.754 Q1648.07 222.416 1651.52 222.416 Q1654.92 222.416 1656.91 219.731 Q1658.9 217.046 1658.9 212.416 Q1658.9 207.81 1656.91 205.124 Q1654.92 202.416 1651.52 202.416 M1651.52 198.805 Q1657.07 198.805 1660.25 202.416 Q1663.42 206.027 1663.42 212.416 Q1663.42 218.782 1660.25 222.416 Q1657.07 226.027 1651.52 226.027 Q1645.94 226.027 1642.77 222.416 Q1639.62 218.782 1639.62 212.416 Q1639.62 206.027 1642.77 202.416 Q1645.94 198.805 1651.52 198.805 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M1674.6 221.467 L1674.6 235.217 L1670.32 235.217 L1670.32 199.43 L1674.6 199.43 L1674.6 203.365 Q1675.94 201.05 1677.98 199.939 Q1680.04 198.805 1682.88 198.805 Q1687.61 198.805 1690.55 202.555 Q1693.51 206.305 1693.51 212.416 Q1693.51 218.527 1690.55 222.277 Q1687.61 226.027 1682.88 226.027 Q1680.04 226.027 1677.98 224.916 Q1675.94 223.782 1674.6 221.467 M1689.09 212.416 Q1689.09 207.717 1687.14 205.055 Q1685.22 202.37 1681.84 202.37 Q1678.46 202.37 1676.52 205.055 Q1674.6 207.717 1674.6 212.416 Q1674.6 217.115 1676.52 219.8 Q1678.46 222.462 1681.84 222.462 Q1685.22 222.462 1687.14 219.8 Q1689.09 217.115 1689.09 212.416 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M1722.75 211.328 L1722.75 213.411 L1703.16 213.411 Q1703.44 217.809 1705.8 220.124 Q1708.19 222.416 1712.42 222.416 Q1714.88 222.416 1717.17 221.814 Q1719.48 221.212 1721.75 220.009 L1721.75 224.036 Q1719.46 225.008 1717.05 225.518 Q1714.64 226.027 1712.17 226.027 Q1705.96 226.027 1702.33 222.416 Q1698.72 218.805 1698.72 212.647 Q1698.72 206.282 1702.14 202.555 Q1705.59 198.805 1711.43 198.805 Q1716.66 198.805 1719.69 202.185 Q1722.75 205.541 1722.75 211.328 M1718.49 210.078 Q1718.44 206.583 1716.52 204.499 Q1714.62 202.416 1711.47 202.416 Q1707.91 202.416 1705.76 204.43 Q1703.63 206.444 1703.3 210.101 L1718.49 210.078 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M1741.52 212.323 Q1736.36 212.323 1734.37 213.504 Q1732.38 214.684 1732.38 217.532 Q1732.38 219.8 1733.86 221.143 Q1735.36 222.462 1737.93 222.462 Q1741.47 222.462 1743.6 219.962 Q1745.75 217.439 1745.75 213.272 L1745.75 212.323 L1741.52 212.323 M1750.01 210.564 L1750.01 225.356 L1745.75 225.356 L1745.75 221.421 Q1744.3 223.782 1742.12 224.916 Q1739.94 226.027 1736.8 226.027 Q1732.82 226.027 1730.45 223.805 Q1728.12 221.559 1728.12 217.809 Q1728.12 213.434 1731.03 211.212 Q1733.97 208.99 1739.78 208.99 L1745.75 208.99 L1745.75 208.573 Q1745.75 205.634 1743.81 204.036 Q1741.8
" 1439.53,259.916 1545.54,259.916 \n",
" \"/>\n",
"<path clip-path=\"url(#clip020)\" d=\"M1579.04 247.242 L1572.7 264.441 L1585.41 264.441 L1579.04 247.242 M1576.4 242.636 L1581.7 242.636 L1594.88 277.196 L1590.01 277.196 L1586.87 268.33 L1571.29 268.33 L1568.14 277.196 L1563.21 277.196 L1576.4 242.636 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M1619.92 256.247 Q1621.52 253.376 1623.74 252.011 Q1625.96 250.645 1628.97 250.645 Q1633.02 250.645 1635.22 253.492 Q1637.42 256.316 1637.42 261.548 L1637.42 277.196 L1633.14 277.196 L1633.14 261.687 Q1633.14 257.96 1631.82 256.154 Q1630.5 254.349 1627.79 254.349 Q1624.48 254.349 1622.56 256.548 Q1620.64 258.747 1620.64 262.543 L1620.64 277.196 L1616.36 277.196 L1616.36 261.687 Q1616.36 257.937 1615.04 256.154 Q1613.72 254.349 1610.96 254.349 Q1607.7 254.349 1605.78 256.571 Q1603.86 258.77 1603.86 262.543 L1603.86 277.196 L1599.58 277.196 L1599.58 251.27 L1603.86 251.27 L1603.86 255.298 Q1605.32 252.913 1607.35 251.779 Q1609.39 250.645 1612.19 250.645 Q1615.01 250.645 1616.98 252.08 Q1618.97 253.515 1619.92 256.247 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M1668.09 263.168 L1668.09 265.251 L1648.51 265.251 Q1648.79 269.649 1651.15 271.964 Q1653.53 274.256 1657.77 274.256 Q1660.22 274.256 1662.51 273.654 Q1664.83 273.052 1667.1 271.849 L1667.1 275.876 Q1664.81 276.848 1662.4 277.358 Q1659.99 277.867 1657.51 277.867 Q1651.31 277.867 1647.68 274.256 Q1644.07 270.645 1644.07 264.487 Q1644.07 258.122 1647.49 254.395 Q1650.94 250.645 1656.77 250.645 Q1662.01 250.645 1665.04 254.025 Q1668.09 257.381 1668.09 263.168 M1663.83 261.918 Q1663.79 258.423 1661.87 256.339 Q1659.97 254.256 1656.82 254.256 Q1653.26 254.256 1651.1 256.27 Q1648.97 258.284 1648.65 261.941 L1663.83 261.918 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M1690.11 255.251 Q1689.39 254.835 1688.53 254.65 Q1687.7 254.441 1686.68 254.441 Q1683.07 254.441 1681.13 256.802 Q1679.2 259.14 1679.2 263.538 L1679.2 277.196 L1674.92 277.196 L1674.92 251.27 L1679.2 251.27 L1679.2 255.298 Q1680.55 252.937 1682.7 251.802 Q1684.85 250.645 1687.93 250.645 Q1688.37 250.645 1688.9 250.714 Q1689.44 250.761 1690.08 250.876 L1690.11 255.251 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M1694.57 251.27 L1698.83 251.27 L1698.83 277.196 L1694.57 277.196 L1694.57 251.27 M1694.57 241.177 L1698.83 241.177 L1698.83 246.571 L1694.57 246.571 L1694.57 241.177 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M1726.4 252.265 L1726.4 256.247 Q1724.6 255.251 1722.77 254.765 Q1720.96 254.256 1719.11 254.256 Q1714.97 254.256 1712.68 256.895 Q1710.38 259.511 1710.38 264.256 Q1710.38 269.001 1712.68 271.64 Q1714.97 274.256 1719.11 274.256 Q1720.96 274.256 1722.77 273.77 Q1724.6 273.261 1726.4 272.265 L1726.4 276.2 Q1724.62 277.034 1722.7 277.45 Q1720.8 277.867 1718.65 277.867 Q1712.79 277.867 1709.34 274.186 Q1705.89 270.506 1705.89 264.256 Q1705.89 257.913 1709.37 254.279 Q1712.86 250.645 1718.93 250.645 Q1720.89 250.645 1722.77 251.062 Q1724.64 251.455 1726.4 252.265 Z\" fill=\"#000000\" fill-rule=\"evenodd\" fill-opacity=\"1\" /><path clip-path=\"url(#clip020)\" d=\"M1745.59 264.163 Q1740.43 264.163 1738.44 265.344 Q1736.45 266.524 1736.45 269.372 Q1736.45 271.64 1737.93 272.983 Q1739.44 274.302 1742 274.302 Q1745.55 274.302 1747.68 271.802 Q1749.83 269.279 1749.83 265.112 L1749.83 264.163 L1745.59 264.163 M1754.09 262.404 L1754.09 277.196 L1749.83 277.196 L1749.83 273.261 Q1748.37 275.622 1746.19 276.756 Q1744.02 277.867 1740.87 277.867 Q1736.89 277.867 1734.53 275.645 Q1732.19 273.399 1732.19 269.649 Q1732.19 265.274 1735.11 263.052 Q1738.05 260.83 1743.86 260.83 L1749.83 260.83 L1749.83 260.413 Q1749.83 257.474 1747.88 255.876 Q1745.96 254.256 1742.47 254.256 Q1740.25 254.256 1738.14 254.788 Q1736.03 255.321 1734.09 256.386 L1734.09 252.45 Q1736.43 251.548 1738.63 251.108 Q1740.82 250.645 1742.91 250.645 Q1748.53 250.
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"p1 = plot( S_range,[Δp_e Δp_a],\n",
" linecolor = [:red :blue],\n",
" label = [\"European\" \"American\"],\n",
" title = \"Δ of BOPM put option prices, K=$K\",\n",
" xlabel = \"current asset price\",\n",
" ylabel = \"Δ\" )\n",
"display(p1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"@webio": {
"lastCommId": null,
"lastKernelId": null
},
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Julia 1.7.0",
"language": "julia",
"name": "julia-1.7"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.7.0"
}
},
"nbformat": 4,
"nbformat_minor": 4
}