Calculating Periodic CPI Inflation Rates Using the Central Bank of Turkey EVDS API in Python and Excel

In financial auditing, commercial leasing contracts, and legal damages assessment, calculating accurate cumulative inflation across specific historical date ranges is critical. Rather than relying on static tables, using the Central Bank of Turkey (CBRT) Consumer Price Index (TÜFE, 2003=100) series via EVDS API allows you to compute exact periodic inflation programmatically.

The Inflation Calculation Formula

Inflation is the percentage change between index values at the start and end of a specified interval:

Inflation Rate (%) = ((Index_End - Index_Start) / Index_Start) * 100

Automating Cumulative Inflation Calculation in Python

import requests
import pandas as pd

API_KEY = "YOUR_EVDS_API_KEY"
SERIES = "TP.FG.J0" # TÜFE General Index (2003=100)

url = f"https://evds2.tcmb.gov.tr/service/evds/series={SERIES}&startDate=01-01-2023&endDate=01-11-2024&type=json"
res = requests.get(url, headers={"key": API_KEY})
data = res.json()["items"]

df = pd.DataFrame(data)
df["Index"] = pd.to_numeric(df[SERIES].str.replace(",", "."))
df = df.dropna(subset=["Index"])

# Calculate Monthly Inflation (%)
df["Monthly_Inflation_%"] = df["Index"].pct_change() * 100

# Calculate Annual Inflation (%) (12-month lag)
df["Annual_Inflation_%"] = df["Index"].pct_change(periods=12) * 100

print(df[["Tarih", "Index", "Monthly_Inflation_%", "Annual_Inflation_%"]].tail())
Scroll to Top