{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from black_76 import *" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# 数据截取自\n", "f = 3559.2 # IF2311价格\n", "k = 3600\n", "r = 0.02\n", "t = 15/365\n", "v = 0.148 # 隐含波动率14.8%\n", "cp = 1\n", "price = 25.4 # 期权价格" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# 从波动率计算价格和希腊值\n", "calculate_greeks(f, k, r, t, v, cp)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# 从价格计算波动率\n", "calculate_impv(price, f, k, r, t, cp)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.10.2" } }, "nbformat": 4, "nbformat_minor": 4 }