SNB & SARON
The SNB class provides access to Swiss National Bank policy rates and SARON (Swiss Average Rate Overnight), the CHF risk-free reference rate.
Policy Rate
SNB.get_policy_rate
Get the current SNB policy rate.
Returns: Current policy rate in percent (e.g. 0.5 means 0.5%).
Raises: SNBAPIError if the API call fails.
Example:
SNB.get_historical_rates
Get historical SNB policy rates.
Parameters:
| Parameter | Type | Description |
|---|---|---|
start |
str |
Start date YYYY-MM (optional) |
end |
str |
End date YYYY-MM (optional) |
provider |
str |
Data provider (default: 'snb_official') |
Returns: DataFrame with DatetimeIndex and rate column (float, percent).
Raises: ValueError if start > end.
Example:
SARON — Monthly average
SNB.get_saron
Get the current SARON monthly average. The SARON is the CHF risk-free reference rate, replacing LIBOR CHF since 2021.
Returns: Current SARON monthly average in percent.
Raises: SNBAPIError, FetchError.
Example:
saron = SNB.get_saron()
print(f"SARON: {saron}%")
# SARON: 0.52%
# Use as annual risk-free rate for Sharpe ratio
rf_annual = saron / 100
SNB.get_historical_saron
Get historical SARON monthly averages (data available from 2009).
Parameters:
| Parameter | Type | Description |
|---|---|---|
start |
str |
Start date YYYY-MM (optional) |
end |
str |
End date YYYY-MM (optional) |
Returns: DataFrame with DatetimeIndex and rate column.
Raises: ValueError if start > end, SNBAPIError.
Example:
SARON — Daily fixing
SNB.get_saron_daily
Get the latest SARON daily fixing. Published at the close of each business day. More granular than the monthly average — use for daily risk calculations.
Returns: Latest SARON daily fixing in percent.
Example:
saron = SNB.get_saron_daily()
print(f"SARON daily: {saron}%")
# SARON daily: 0.515%
# Daily risk-free rate for Sharpe ratio
rf_daily = saron / 100 / 252
print(f"Daily rf: {rf_daily:.8f}")
# Daily rf: 0.00000204
SNB.get_historical_saron_daily
Get historical SARON daily fixings (business days only, data from 2009).
Parameters:
| Parameter | Type | Description |
|---|---|---|
start |
str |
Start date YYYY-MM-DD (optional) |
end |
str |
End date YYYY-MM-DD (optional) |
Returns: DataFrame with DatetimeIndex (business days) and rate column.
Raises: ValueError if start > end, SNBAPIError.
Example:
# Cumulative compounded risk-free return
rf_cumulative = ((1 + saron["rate"] / 100 / 252)).cumprod()
Provider utilities
SNB.list_providers
List all registered SNB data providers.
Example:
Data source
All SNB data is fetched from the official SNB data portal (data.snb.ch).
| Dataset | SNB Cube |
|---|---|
| Policy Rate | snboffzisa |
| SARON monthly | zimoma |
| SARON daily | snbgwdzid |