估值需要一个反映现金流所在国家的股权风险溢价。Narwhal 为每个国家返回成熟市场溢价、国家违约利差、国家风险溢价及其合计,并提供使用同一溢价的公司资本成本路径。
读取某个国家的股权风险溢价
curl -s "https://api.narwhalapi.com/v1/economics/BRA/equity-risk-premium" \
-H "Authorization: Bearer $NARWHAL_API_KEY"{
"country": "BRA",
"as_of": "2026-11-01",
"unit": "percent",
"mature_erp": "3.2973",
"country_default_spread": "2.1300",
"volatility_ratio": "1.5211",
"country_risk_premium": "3.2400",
"total_erp": "6.5373",
"basis": {
"mature_erp": "observed",
"country_default_spread": "table",
"volatility_ratio": "table",
"country_risk_premium": "table",
"total_erp": "table"
},
"methodology_url": "https://narwhalapi.com/methodology/equity-risk-premium"
}所有数字均以百分比表示,as_of 是这些数字所描述的日期。五个数字层层递进,如股权风险溢价方法说明所述。
mature_erp是成熟市场(即美国)的隐含溢价。每个国家的响应中它都相同。country_default_spread是该国因违约风险而比成熟市场多支付的收益率。volatility_ratio是股票波动率除以政府债券波动率。country_risk_premium是利差乘以该比率。以巴西为例,2.13 乘以 1.5211 等于 3.24。total_erp是mature_erp加上country_risk_premium。以巴西为例,3.2973 加 3.24 等于 6.5373。
basis 对象说明各部分是 observed、modelled 还是 table。table 值来自公开的国家风险表。这些行与该表一样新,因此在表更新时才会变动,而不是随每次债券收益率变动。美国响应的利差为 0,volatility_ratio 为 null,因为美国就是成熟市场,所以它的 total_erp 等于 mature_erp。
把溢价换算成权益成本
一个国家项目的权益成本,等于无风险利率加上贝塔乘以现金流发生国的总溢价。方法说明指出这些数字以美元计,所以应使用美国无风险利率。脚本从收益率曲线路径读取美国 10 年期收益率,取你给定的贝塔,再从 GET /v1/economics/equity-risk-premium 读取所有国家,并在使用该行之前检查 mature_erp 加 country_risk_premium 是否等于 total_erp。
- 选择输入值 无风险利率来自 API。贝塔 1.2 只是一个占位值,请换成你自己的估计,因为溢价路径不提供贝塔。
- 运行脚本 它会打印国家数量以及四个国家的权益成本。
import os from decimal import Decimal import requests HEAD = {"Authorization": f"Bearer {os.environ['NARWHAL_API_KEY']}"} API = "https://api.narwhalapi.com" def get(path, **params): r = requests.get(API + path, params=params, headers=HEAD, timeout=15) r.raise_for_status() return r.json() # Risk-free rate: the 10 year US yield, in percent rf = Decimal(get("/v1/economics/USA/yield-curve", maturity="10y")["yields"][0]["yield_percent"]) beta = Decimal("1.2") # your own estimate for the project countries = {c["country"]: c for c in get("/v1/economics/equity-risk-premium")["countries"]} print(len(countries), "countries") for code in ("USA", "IDN", "BRA", "ZAF"): c = countries[code] mature, crp, total = (Decimal(c[k]) for k in ("mature_erp", "country_risk_premium", "total_erp")) assert mature + crp == total print(f"{code} as_of {c['as_of']} mature {mature} crp {crp} total {total} " f"cost of equity {rf + beta * total:.2f}%") - 查看结果 10 年期收益率为 4.91%。脚本在列表的 175 个国家中,返回美国的权益成本为 8.87%,印度尼西亚 11.82,巴西 12.75,南非 13.55。
这些是美元折现率。本币折现率需要加上两种货币之间的通胀差,如方法说明所述。
获取上市公司的贝塔、债务成本和 WACC
对于上市股票,资本成本路径做同样的计算,并继续算出 WACC。它在一次回答中返回贝塔、无风险利率、所用的溢价、权益成本、债务成本、税率和权重。默认的溢价是 Narwhal 自己为该股票所在国家给出的合计值。你也可以通过 erp 传入自己的值。资本成本方法说明列出了公式和拒绝情形。
curl -s "https://api.narwhalapi.com/v1/equities/XNAS:MSFT/cost-of-capital" \
-H "Authorization: Bearer $NARWHAL_API_KEY"{
"id": "XNAS:MSFT",
"currency": "USD",
"beta": {
"window": "2y",
"frequency": "weekly",
"observations": 103,
"raw": "1.1507",
"adjusted": "1.1010",
"used": "raw"
},
"risk_free": {
"rate": "4.9100",
"source": "yield_curve",
"as_of": "2026-11-02"
},
"equity_risk_premium": {
"rate": "3.2973",
"source": "narwhal",
"country": "USA",
"as_of": "2026-11-01",
"basis": "observed"
},
"cost_of_equity": "8.7042",
"cost_of_debt": {
"pre_tax": "8.1917",
"after_tax": "6.0922",
"period": "ttm"
},
"tax_rate": {
"rate": "25.6300",
"basis": "table"
},
"weights": {
"equity": "99.0666",
"debt": "0.9334"
},
"wacc": "8.6798",
"warnings": [],
"methodology_url": "https://narwhalapi.com/methodology/cost-of-capital"
}cost_of_equity 的 8.7042 等于无风险利率 4.91 加上原始贝塔 1.1507 乘以溢价 3.2973。权重为权益 99.0666%、债务 0.9334%,wacc 为 8.6798%。完整响应会为每个输入值附上依据和日期,需要留意的数字会在 warnings 中给出条目,这里该列表为空。
溢价会随时间变化吗?
会。历史路径列出较早的日期。印度尼西亚在 as_of 为 2026-10-28 时 total_erp 为 5.6830,在 as_of 为 2026-11-01 时为 5.7573,而 country_default_spread 保持在 1.6200。mature_erp 从 3.2230 变为 3.2973,由此带动了合计值。
请在估值中使用的任何利率旁保存 as_of 日期,以便日后追溯该数字。需要了解溢价在不同日期之间如何变动时,请读取历史路径。
资本成本路径无法回答时会怎样?
它返回 422 并指出问题,而不是填补缺口。对 AAPL 的调用返回了 inputs_unavailable,详情是没有利息费用数据。该路径同样会拒绝银行和保险公司。在路径支持的地方传入你自己的 erp、risk_free 或 tax_rate,并在代码中处理 422。
覆盖哪些国家?
在上面的运行中,列表路径返回了 175 个国家。只有当某个国家的所有输入值都可用时它才会出现,所以缺少某个代码意味着没有该行,而不是零。巴西、印度尼西亚、南非和美国都有返回。
发布于。