← 返回题库
中级

BS期权定价

未完成
中级参考 代码结构已给出,请填写 ____ 处
def solve(____):
    import math
    from math import erf
    N = lambda x: ____ * (____ + erf(x / math.sqrt(____)))
    d1 = (math.log(____) + (____) * T) / (sigma * math.sqrt(____))
    d2 = d1 - sigma * math.sqrt(____)
    if option_type == "____":
        price = S * N(____) - K * math.exp(____) * N(____)
    else:
        price = K * math.exp(____) * N(____) - S * N(____)
    return {"____": option_type, "____": round(____)}

示例

输入
solve(100, 100, 0.05, 0.2, 1, "call")
期望输出
{'期权类型': 'call', '期权价格': 10.45}
Python 代码 🔒 登录后使用
🔒

登录后即可练习

注册免费账号,在浏览器中直接运行 Python 代码