|
33 | 33 | "- [Initialize the ValidMind Library](#toc3_) \n",
|
34 | 34 | "- [Initialize the Python environment](#toc4_) \n",
|
35 | 35 | " - [Preview the documentation template](#toc4_1_) \n",
|
36 |
| - "- [Data preparation](#toc5_) \n", |
37 | 36 | "- [Model development](#toc6_) \n",
|
38 | 37 | " - [Synthetic data generation](#toc6_1_)\n",
|
39 | 38 | " - [Model Calibration](#toc6_2_) \n",
|
|
189 | 188 | " # api_key=\"...\",\n",
|
190 | 189 | " # api_secret=\"...\",\n",
|
191 | 190 | " # model=\"...\",\n",
|
192 |
| - ")" |
| 191 | + ")\n" |
193 | 192 | ]
|
194 | 193 | },
|
195 | 194 | {
|
|
206 | 205 | },
|
207 | 206 | {
|
208 | 207 | "cell_type": "code",
|
209 |
| - "execution_count": 4, |
| 208 | + "execution_count": 3, |
210 | 209 | "id": "29d2c1a0",
|
211 | 210 | "metadata": {},
|
212 | 211 | "outputs": [],
|
|
244 | 243 | "vm.preview_template()"
|
245 | 244 | ]
|
246 | 245 | },
|
247 |
| - { |
248 |
| - "cell_type": "markdown", |
249 |
| - "id": "0d22f562", |
250 |
| - "metadata": {}, |
251 |
| - "source": [ |
252 |
| - "<a id='toc5_'></a>\n", |
253 |
| - "## Data Preparation" |
254 |
| - ] |
255 |
| - }, |
256 |
| - { |
257 |
| - "cell_type": "markdown", |
258 |
| - "id": "b0267993", |
259 |
| - "metadata": {}, |
260 |
| - "source": [ |
261 |
| - "### Market Data Sources" |
262 |
| - ] |
263 |
| - }, |
264 |
| - { |
265 |
| - "cell_type": "markdown", |
266 |
| - "id": "7f0cd4bc", |
267 |
| - "metadata": {}, |
268 |
| - "source": [ |
269 |
| - "### Market Data Quality and Availability" |
270 |
| - ] |
271 |
| - }, |
272 | 246 | {
|
273 | 247 | "cell_type": "markdown",
|
274 | 248 | "id": "6d6a8447",
|
|
280 | 254 | },
|
281 | 255 | {
|
282 | 256 | "cell_type": "code",
|
283 |
| - "execution_count": 6, |
| 257 | + "execution_count": 5, |
284 | 258 | "id": "c3f5b0b9",
|
285 | 259 | "metadata": {},
|
286 | 260 | "outputs": [],
|
|
301 | 275 | },
|
302 | 276 | {
|
303 | 277 | "cell_type": "code",
|
304 |
| - "execution_count": 7, |
| 278 | + "execution_count": 6, |
305 | 279 | "id": "d3748656",
|
306 | 280 | "metadata": {},
|
307 | 281 | "outputs": [],
|
|
432 | 406 | },
|
433 | 407 | {
|
434 | 408 | "cell_type": "code",
|
435 |
| - "execution_count": 8, |
| 409 | + "execution_count": 7, |
436 | 410 | "id": "42cb9070",
|
437 | 411 | "metadata": {},
|
438 | 412 | "outputs": [],
|
|
448 | 422 | },
|
449 | 423 | {
|
450 | 424 | "cell_type": "code",
|
451 |
| - "execution_count": 9, |
| 425 | + "execution_count": 8, |
452 | 426 | "id": "c81282bd",
|
453 | 427 | "metadata": {},
|
454 | 428 | "outputs": [],
|
455 | 429 | "source": [
|
456 | 430 | "# Parameters for synthetic data\n",
|
457 |
| - "# Common\n", |
458 | 431 | "S0 = 100\n",
|
459 | 432 | "K = 100\n",
|
460 | 433 | "T = 1\n",
|
|
495 | 468 | },
|
496 | 469 | {
|
497 | 470 | "cell_type": "code",
|
498 |
| - "execution_count": 10, |
| 471 | + "execution_count": 9, |
499 | 472 | "id": "5e709e0e",
|
500 | 473 | "metadata": {},
|
501 | 474 | "outputs": [],
|
|
593 | 566 | },
|
594 | 567 | {
|
595 | 568 | "cell_type": "code",
|
596 |
| - "execution_count": 12, |
| 569 | + "execution_count": 11, |
597 | 570 | "id": "ac733262",
|
598 | 571 | "metadata": {},
|
599 | 572 | "outputs": [],
|
600 | 573 | "source": [
|
601 | 574 | "@vm.test(\"my_custom_tests.BenchmarkTest\")\n",
|
602 | 575 | "def benchmark_test(bs_model, sv_model, strikes, maturities):\n",
|
603 | 576 | " \"\"\"\n",
|
604 |
| - " Compaparison between blacksholes and stoachastic volatility model\n", |
| 577 | + " Comparison between Black Scholes and stochastic volatility model\n", |
605 | 578 | "\n",
|
606 | 579 | " \"\"\"\n",
|
607 | 580 | " bs_model_type = type(bs_model).__name__\n",
|
|
674 | 647 | },
|
675 | 648 | {
|
676 | 649 | "cell_type": "code",
|
677 |
| - "execution_count": 14, |
| 650 | + "execution_count": 13, |
678 | 651 | "id": "80492c82",
|
679 | 652 | "metadata": {},
|
680 | 653 | "outputs": [],
|
|
705 | 678 | },
|
706 | 679 | {
|
707 | 680 | "cell_type": "code",
|
708 |
| - "execution_count": 15, |
| 681 | + "execution_count": 14, |
709 | 682 | "id": "b2115371",
|
710 | 683 | "metadata": {},
|
711 | 684 | "outputs": [],
|
712 | 685 | "source": [
|
713 |
| - "# Example usage:\n", |
714 | 686 | "S0 = 100\n",
|
715 | 687 | "T = 1\n",
|
716 | 688 | "r = 0.05\n",
|
|
730 | 702 | },
|
731 | 703 | {
|
732 | 704 | "cell_type": "code",
|
733 |
| - "execution_count": 16, |
| 705 | + "execution_count": 15, |
734 | 706 | "id": "f6c98fbe",
|
735 | 707 | "metadata": {},
|
736 | 708 | "outputs": [],
|
|
743 | 715 | " plt.title(params[\"title\"])\n",
|
744 | 716 | " plt.legend()\n",
|
745 | 717 | " plt.grid(True)\n",
|
746 |
| - " plt.show() # close the plot to avoid displaying it" |
| 718 | + " plt.show() " |
747 | 719 | ]
|
748 | 720 | },
|
749 | 721 | {
|
|
783 | 755 | ")\n",
|
784 | 756 | "result.log()\n",
|
785 | 757 | "plot_results(\n",
|
786 |
| - " pd.DataFrame(result.metric.summary.results[0].data),\n", |
| 758 | + " pd.DataFrame(result.tables[0].data),\n", |
787 | 759 | " params={\n",
|
788 | 760 | " \"x\": \"strike\",\n",
|
789 | 761 | " \"y\":\"Option price\",\n",
|
|
795 | 767 | ")"
|
796 | 768 | ]
|
797 | 769 | },
|
| 770 | + { |
| 771 | + "cell_type": "code", |
| 772 | + "execution_count": null, |
| 773 | + "id": "b30e1b5a", |
| 774 | + "metadata": {}, |
| 775 | + "outputs": [], |
| 776 | + "source": [ |
| 777 | + "\n" |
| 778 | + ] |
| 779 | + }, |
798 | 780 | {
|
799 | 781 | "cell_type": "markdown",
|
800 | 782 | "id": "fe2c8f65",
|
|
831 | 813 | ")\n",
|
832 | 814 | "result.log()\n",
|
833 | 815 | "plot_results(\n",
|
834 |
| - " pd.DataFrame(result.metric.summary.results[0].data),\n", |
| 816 | + " pd.DataFrame(result.tables[0].data),\n", |
835 | 817 | " params={\n",
|
836 | 818 | " \"x\": \"barrier\",\n",
|
837 | 819 | " \"y\":\"Option price\",\n",
|
|
854 | 836 | },
|
855 | 837 | {
|
856 | 838 | "cell_type": "code",
|
857 |
| - "execution_count": 20, |
| 839 | + "execution_count": 18, |
858 | 840 | "id": "7bdd02ed",
|
859 | 841 | "metadata": {},
|
860 | 842 | "outputs": [],
|
|
1035 | 1017 | ")\n",
|
1036 | 1018 | "result.log()\n",
|
1037 | 1019 | "plot_results(\n",
|
1038 |
| - " pd.DataFrame(result.metric.summary.results[0].data),\n", |
| 1020 | + " pd.DataFrame(result.tables[0].data),\n", |
1039 | 1021 | " params={\n",
|
1040 | 1022 | " \"x\": \"kappa\",\n",
|
1041 | 1023 | " \"y\":\"Option price\",\n",
|
|
1083 | 1065 | ")\n",
|
1084 | 1066 | "result.log()\n",
|
1085 | 1067 | "plot_results(\n",
|
1086 |
| - " pd.DataFrame(result.metric.summary.results[0].data),\n", |
| 1068 | + " pd.DataFrame(result.tables[0].data),\n", |
1087 | 1069 | " params={\n",
|
1088 | 1070 | " \"x\": \"theta\",\n",
|
1089 | 1071 | " \"y\":\"Option price\",\n",
|
|
1131 | 1113 | ")\n",
|
1132 | 1114 | "result.log()\n",
|
1133 | 1115 | "plot_results(\n",
|
1134 |
| - " pd.DataFrame(result.metric.summary.results[0].data),\n", |
| 1116 | + " pd.DataFrame(result.tables[0].data),\n", |
1135 | 1117 | " params={\n",
|
1136 | 1118 | " \"x\": \"xi\",\n",
|
1137 | 1119 | " \"y\":\"Option price\",\n",
|
|
1179 | 1161 | ")\n",
|
1180 | 1162 | "result.log()\n",
|
1181 | 1163 | "plot_results(\n",
|
1182 |
| - " pd.DataFrame(result.metric.summary.results[0].data),\n", |
| 1164 | + " pd.DataFrame(result.tables[0].data),\n", |
1183 | 1165 | " params={\n",
|
1184 | 1166 | " \"x\": \"rho\",\n",
|
1185 | 1167 | " \"y\":\"Option price\",\n",
|
|
0 commit comments