Skip to main content
Glama
kevynf

AKBridge MCP Server

by kevynf

volatility_yz_rv

Read-onlyIdempotent

Computes Yang-Zhang realized volatility from OHLC prices to quantify historical market risk. Input a DataFrame with Open, High, Low, Close columns and receive the realized volatility values.

Instructions

波动率-已实现波动率-Yang-Zhang 已实现波动率(Yang-Zhang Realized Volatility) https://github.com/hugogobato/Yang-Zhang-s-Realized-Volatility-Automated-Estimation-in-Python 论文地址:https://www.jstor.org/stable/10.1086/209650 基于以下公式计算: RV^2 = Vo + k*Vc + (1-k)*Vrs 其中:

  • Vo: 隔夜波动率,Vo = 1/(n-1)*sum(Oi-Obar)^2 Oi为标准化开盘价,Obar为标准化开盘价均值

  • Vc: 收盘波动率,Vc = 1/(n-1)*sum(ci-Cbar)^2 ci为标准化收盘价,Cbar为标准化收盘价均值

  • k: 权重系数,k = 0.34/(1.34+(n+1)/(n-1)) n为样本数量

  • Vrs: Rogers-Satchell波动率代理,Vrs = ui(ui-ci)+di(di-ci) ui = ln(Hi/Oi), ci = ln(Ci/Oi), di = ln(Li/Oi), oi = ln(Oi/Ci-1) Hi/Li/Ci/Oi分别为最高价/最低价/收盘价/开盘价

:param data: 包含 OHLC(开高低收) 价格的 pandas.DataFrame :type data: pandas.DataFrame :return: 包含 Yang-Zhang 实现波动率的 pandas.DataFrame :rtype: pandas.DataFrame

要求输入数据包含以下列:

  • Open: 开盘价

  • High: 最高价

  • Low: 最低价

  • Close: 收盘价

yang_zhang_rv formula is give as:

RV^2 = Vo + k*Vc + (1-k)*Vrs

where Vo = 1/(n-1)*sum(Oi-Obar)^2

with oi = normalized opening price at time t and Obar = mean of normalized opening prices

Vc = = 1/(n-1)*sum(ci-Cbar)^2

with ci = normalized close price at time t and Cbar = mean of normalized close prices

k = 0.34/(1.34+(n+1)/(n-1))

with n = total number of days or time periods considered

Vrs (Rogers & Satchell RV proxy) = ui(ui-ci)+di(di-ci)

with ui = ln(Hi/Oi), ci = ln(Ci/Oi), di=(Li/Oi), oi = ln(Oi/Ci-1)

where Hi = high price at time t and Li = low price at time t

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.2

TDQS

B3.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false and openWorldHint=true, so the safety profile is covered. The description adds the concrete input contract (must contain Open/High/Low/Close columns) and the return type, which is useful. It omits behavior around window length (n), NaNs, or whether output is a series or a single scalar.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is bloated: the entire formula is stated once in the prose and then again verbatim in the trailing code comment, plus two links and a variable glossary. It leads with derivation rather than the operation, and roughly half the text is redundant.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description must carry the return contract; it states the return is a DataFrame of Yang-Zhang RV but not its columns, shape, or whether it is rolling. Given the function's complexity, this is adequate but leaves real gaps for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the schema only says 'data' is an array of objects. The description compensates meaningfully by enumerating the required columns (Open, High, Low, Close) and calling it a pandas.DataFrame. It still doesn't specify the expected index/time column, but the core input semantics are conveyed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb+resource: it computes Yang-Zhang Realized Volatility from OHLC data, backed by the formula and paper citation. It is clearly distinguishable from generic quote/listing siblings, but it does not name or distinguish itself from related RV tools (article_oman_rv, rv_from_futures_zh_minute_sina).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no when-to-use guidance and no mention of the many alternative realized-volatility tools in the sibling set. The agent is given the math but not the condition under which this estimator should be chosen over the others.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools