跳转到内容

HISTORICAL_VOLATILITY

HISTORICAL_VOLATILITY 返回历史波动率数据。它不是普通 OHLC 价格 K 线,字段中的数值应按波动率理解。

官方参考:Historical Bar Data

app.reqHistoricalData(
1007,
contract,
"",
"1 M",
"1 day",
"HISTORICAL_VOLATILITY",
1,
1,
False,
[],
)
  • 观察标的历史波动水平。
  • 和期权隐含波动率做对比。
  • 给风控或仓位模型提供波动率输入。

不要把返回的 open/high/low/close 当成价格。它们表示波动率序列在对应周期内的数值变化。图表标题、数据库字段名和 API 返回解释都应明确标成 volatility。

波动率请求返回的是波动率数值。AAPL 日线参考输出:

BAR_TOTAL_COUNT=reqId=4208;name=historical_volatility;count=21
BAR=reqId=4208;name=historical_volatility;date=20260514;open=0.2586909801906515;high=0.2586909801906515;low=0.2586909801906515;close=0.2586909801906515;volume=1;wap=0.2586909801906514;barCount=0
BAR=reqId=4208;name=historical_volatility;date=20260515;open=0.2583417410175909;high=0.2583417410175909;low=0.2583417410175909;close=0.2583417410175909;volume=1;wap=0.2583417410175909;barCount=0

这种返回不像价格 K 线那样表示成交价格。写程序时应按波动率数据单独保存。