Security Options Strategy — 安全选项策略
v2.0.0针对中国市场的AI驱动选项策略工具,提供选项定价、希腊值、多腿策略(买方涵盖、保护性卖方、价差、跨式)等功能...
运行时依赖
安装命令
点击复制本土化适配说明
Security Options Strategy — 安全选项策略 安装说明: 安装命令:["openclaw skills install security-options-strategy"]
技能文档
期权策略大师——覆盖期权定价、Greeks计算、多腿策略分析、波动率交易。适用:期权交易者、风险管理人。
行业痛点 / 行业痛点 痛点 / 痛点 | 影响 | 本Skill解决方案 定价复杂 | BS模型参数选择困难 | 参数解释+敏感性分析 希腊字母难懂 | Delta/Gamma/Vega傻傻分不清 | 可视化Greeks图形 策略选择困难 | 不知道用什么策略应对市场 | 情景化策略推荐 保证金占用 | 资金效率低 | 最优保证金管理 风险敞口不清晰 | 极端行情爆仓 | 实时风险监控+预警
触发关键词 / 触发关键词 English Triggers: options strategy, options pricing, Greeks, volatility trading, China options, covered call, protective put, spread trading, straddles, collars 中文触发词(优先):期权策略 / 期权定价 / 希腊字母 / Delta / Gamma / Vega / 备兑开仓 / 保护性看跌 / 价差策略 / 跨式策略 / 勒式策略 / 波动率交易 / 50ETF期权 / 沪深300期权 / 期权开户 / 期权权限 / 权利仓 / 义务仓 / 做市商 / 波动率曲面
核心能力 / 核心能力
- 期权定价引擎 / Options Pricing Engine
import numpy as np
from scipy.stats import normclass OptionsPricer:
"""期权定价引擎"""
@staticmethod
def black_scholes(S, K, T, r, sigma, option_type='call'):
""" Black-Scholes期权定价
Args:
S: 标的资产价格
K: 行权价
T: 到期时间(年)
r: 无风险利率
sigma: 波动率
option_type: 'call' 或 'put'
"""
if T <= 0:
if option_type == 'call':
return max(S - K, 0)
else:
return max(K - S, 0)
d1 = (np.log(S / K) + (r + 0.5 sigma 2) T) / (sigma np.sqrt(T))
d2 = d1 - sigma np.sqrt(T)
if option_type == 'call':
price = S norm.cdf(d1) - K np.exp(-r T) norm.cdf(d2)
delta = norm.cdf(d1)
else:
price = K np.exp(-r T) norm.cdf(-d2) - S norm.cdf(-d1)
delta = norm.cdf(d1) - 1
# Greeks计算
gamma = norm.pdf(d1) / (S sigma np.sqrt(T))
vega = S norm.pdf(d1) np.sqrt(T) / 100
theta_call = (-S norm.pdf(d1) sigma / (2 np.sqrt(T)) - r K np.exp(-r T) norm.cdf(d2)) / 365
theta_put = (-S norm.pdf(d1) sigma / (2 np.sqrt(T)) + r K np.exp(-r T) norm.cdf(-d2)) / 365
return {
'price': round(price, 4),
'delta': round(delta, 4),
'gamma': round(gamma, 6),
'vega': round(vega, 4),
'theta': round(theta_call if option_type == 'call' else theta_put, 4),
'd1': round(d1, 4),
'd2': round(d2, 4)
}
@staticmethod
def implied_volatility(market_price, S, K, T, r, option_type='call'):
"""计算隐含波动率(牛顿迭代法)"""
sigma = 0.3
for _ in range(100):
bs_price = OptionsPricer.black_scholes(S, K, T, r, sigma, option_type)['price']
vega = OptionsPricer.black_scholes(S, K, T, r, sigma, option_type)['vega'] 100
diff = market_price - bs_price
if abs(diff) < 1e-6:
break
sigma = sigma + diff / vega
if sigma < 0.01 or sigma > 5:
return None
return round(sigma 100, 2)
- 期权策略分析 / Options Strategy Analysis
python
class OptionsStrategy:
"""期权策略分析"""
STRATEGIES = {
"covered_call": {
"name": "备兑开仓",
"description": "持有标的+卖出看涨期权",
"use_case": "预期横盘/小幅上涨,想增加收益",
"max_profit": "股价 - 行权价 + 权利金",
"max_loss": "无限(理论上)"
},
"protective_put": {
"name": "保护性看跌",
"description": "持有标的+买入看跌期权",
"use_case": "担心下跌,想锁定损失",
"max_profit": "无限",
"max_loss": "行权价 - 股价 + 权利金"
},
"bull_call_spread": {
"name": "牛市看涨价差",
"description": "买入低行权价看涨+卖出高行权价看涨",
"use_case": "看涨但涨幅有限",
"max_profit": "行权价差 - 净权利金",
"max_loss": "净权利金"
},
"bear_put_spread": {
"name": "熊市看跌价差",
"description": "买入高行权价看跌+卖出低行权价看跌",
"use_case": "看跌但跌幅有限",
"max_profit": "行权价差 - 净权利金",
"max_loss": "净权利金"
},
"straddle": {
"name": "跨式策略",
"description": "同时买入同行权价的看涨+看跌",
"use_case": "预期大幅波动但方向不明",
"max_profit": "无限(上涨)或标的 - 行权价(下跌)",
"max_loss": "两倍权利金"
},
"strangle": {
"name": "勒式策略",
"description": "买入高行权价看涨+低行权价看跌",
"use_case": "预期大幅波动但方向不明(成本低于跨式)",
"max_profit": "无限",
"max_loss": "两倍权利金"
},
"iron_condor": {
"name": "铁鹰策略",
"description": "卖出价差+买入更宽价差保护",
"use_case": "预期标的在一定范围内波动",
"max_profit": "净权利金",
"max_loss": "两个价差幅度 - 净权利金"
}
}def analyze_strategy(self, strategy_name): ```