Introduction
The Brazilian SELIC rate, set by the Central Bank of Brazil, is a critical benchmark for interest rates in the country. It influences various financial instruments and is a key indicator for economic health. For developers building fintech applications, economists, and quantitative analysts, accessing historical data on the SELIC rate is essential for analysis, forecasting, and decision-making. The Interest Rates API provides a robust solution for retrieving this data through various endpoints, allowing users to fetch timeseries data, historical values, and perform detailed financial analyses.
Understanding the SELIC Rate
The SELIC (Sistema Especial de Liquidação e de Custódia) rate is Brazil's primary interest rate, used as a tool for monetary policy. It is the rate at which the Central Bank lends to financial institutions and is crucial for controlling inflation and stabilizing the economy. Understanding its historical trends and fluctuations can provide valuable insights into Brazil's economic landscape.
Accessing this data programmatically through the Interest Rates API allows developers to integrate real-time and historical SELIC rate data into their applications, enabling advanced financial modeling and analysis.
Key API Endpoints for SELIC Rate Data
The Interest Rates API offers several endpoints that are particularly useful for working with the SELIC rate. Below, we will explore these endpoints in detail, providing examples and discussing their practical applications.
1. Timeseries Data Retrieval
The /timeseries endpoint is essential for fetching a series of SELIC rate data over a specified date range. This is particularly useful for analyzing trends and patterns over time.
Endpoint Details
To retrieve timeseries data, you need to specify the start and end dates, along with the symbol for the SELIC rate.
GET https://interestratesapi.com/api/v1/timeseries?start=2025-09-07&end=2026-09-07&symbols=SELIC&api_key=YOUR_KEY
Example Response
{
"success": true,
"base": "USD",
"start_date": "2025-09-07",
"end_date": "2026-09-07",
"rates": {
"SELIC": {
"2025-01-02": 5.33,
"2025-01-03": 5.33,
"2025-01-06": 5.33
}
},
"frequencies": {
"SELIC": "daily"
},
"currencies": {
"SELIC": "USD"
}
}
This response provides daily SELIC rates between the specified dates, allowing for comprehensive time series analysis.
Implementation Example
Here’s how you can implement this in Python:
import requests
response = requests.get(
'https://interestratesapi.com/api/v1/timeseries',
params=dict(start='2025-09-07', end='2026-09-07', symbols='SELIC', api_key='YOUR_KEY')
)
data = response.json()
print(data)
2. Historical Data Retrieval
The /historical endpoint allows users to retrieve the SELIC rate for a specific date. This is particularly useful for point-in-time analysis, especially when assessing the impact of historical economic events.
Endpoint Details
GET https://interestratesapi.com/api/v1/historical?date=2025-06-15&symbols=SELIC&api_key=YOUR_KEY
Example Response
{
"success": true,
"date": "2025-06-15",
"base": "USD",
"rates": {
"SELIC": 5.33
},
"currencies": {
"SELIC": "USD"
}
}
This response provides the SELIC rate for June 15, 2025, allowing users to analyze specific historical data points.
Implementation Example
import requests
response = requests.get(
'https://interestratesapi.com/api/v1/historical',
params=dict(date='2025-06-15', symbols='SELIC', api_key='YOUR_KEY')
)
data = response.json()
print(data)
3. OHLC Data for Candlestick Charts
The /ohlc endpoint provides Open, High, Low, and Close (OHLC) data, which is essential for creating candlestick charts. This is particularly useful for visualizing the SELIC rate trends over time.
Endpoint Details
GET https://interestratesapi.com/api/v1/ohlc?symbols=SELIC&period=monthly&start=2025-09-07&end=2026-09-07&api_key=YOUR_KEY
Example Response
{
"success": true,
"period": "monthly",
"start_date": "2025-09-07",
"end_date": "2026-09-07",
"rates": {
"SELIC": [
{
"period": "2025-01",
"open": 5.50,
"high": 5.50,
"low": 5.33,
"close": 5.33,
"data_points": 23
}
]
}
}
This response provides monthly OHLC data for the SELIC rate, which can be used to create candlestick charts for visual analysis.
Implementation Example
Here’s how to create a candlestick chart using Chart.js:
const response = await fetch(
'https://interestratesapi.com/api/v1/ohlc?symbols=SELIC&period=monthly&start=2025-09-07&end=2026-09-07&api_key=YOUR_KEY'
);
const data = await response.json();
// Assuming you have a canvas element with id 'myChart'
const ctx = document.getElementById('myChart').getContext('2d');
const chart = new Chart(ctx, {
type: 'candlestick',
data: {
datasets: [{
label: 'SELIC Rate',
data: data.rates.SELIC
}]
},
options: {}
});
Building a Data Pipeline with SELIC Rate Data
For financial analysts and data engineers, building a data pipeline to fetch, process, and store SELIC rate data can streamline analysis and reporting. Below is a comprehensive example of how to fetch SELIC data, convert it into a pandas DataFrame, and export it as a CSV or Parquet file.
Python Data Pipeline Example
import requests
import pandas as pd
# Fetch timeseries data
response = requests.get(
'https://interestratesapi.com/api/v1/timeseries',
params=dict(start='2025-09-07', end='2026-09-07', symbols='SELIC', api_key='YOUR_KEY')
)
data = response.json()
# Convert to DataFrame
dates = data['rates']['SELIC']
df = pd.DataFrame(list(dates.items()), columns=['Date', 'SELIC Rate'])
df['Date'] = pd.to_datetime(df['Date'])
# Export to CSV
df.to_csv('selic_rates.csv', index=False)
# Export to Parquet
df.to_parquet('selic_rates.parquet', index=False)
Common Pitfalls in Time Series Analysis
When working with time series data, several challenges can arise, particularly with financial data like the SELIC rate. Here are some common pitfalls to be aware of:
- Missing Dates: Financial data may not be available for every day, especially on weekends and holidays. It’s crucial to handle these gaps appropriately in your analysis.
- Frequency Considerations: Understanding the frequency of the data (daily vs. monthly) is vital for accurate analysis. Monthly data may not capture daily fluctuations.
- Data Points Interpretation: The number of data points can vary based on the frequency and the time range selected. Ensure you understand how this affects your analysis.
Conclusion
The Brazilian SELIC rate is a vital economic indicator, and accessing its historical data through the Interest Rates API provides developers and analysts with powerful tools for financial analysis. By leveraging the various endpoints available, users can perform comprehensive time series analyses, visualize trends, and build robust data pipelines.
For more information on how to get started, visit Get started with Interest Rates API and explore the features available to enhance your financial applications.




