← 返回题库
初级

期权内在价值

未完成
初级参考 完整示例代码供参考,建议自己理解后重新输入
def solve(option_type, strike_price, stock_price):
    if option_type == "call":
        intrinsic_value = max(stock_price - strike_price, 0)
    else:
        intrinsic_value = max(strike_price - stock_price, 0)
    time_value = 0
    return {"期权类型": option_type, "执行价": strike_price, "股价": stock_price, "内在价值": intrinsic_value}

示例

输入
solve("call", 100, 110)
期望输出
{'期权类型': 'call', '执行价': 100, '股价': 110, '内在价值': 10}
Python 代码 🔒 登录后使用
🔒

登录后即可练习

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