How to Integrate PBoC LPR Data into Your App: Complete API Guide

How to Integrate PBoC LPR Data into Your App: Complete API Guide

Introduction

In the rapidly evolving world of fintech, access to accurate and timely interest rate data is crucial for developers, economists, and financial analysts. The People's Bank of China (PBoC) Loan Prime Rate (LPR) is a key indicator of borrowing costs in China, influencing lending rates across the economy. Integrating PBoC LPR data into your application can enhance financial analysis, improve decision-making, and provide valuable insights into market trends. This guide will walk you through the process of integrating PBoC LPR data using the Interest Rates API from interestratesapi.com, covering all necessary endpoints, code examples, and best practices.

Understanding the Interest Rates API

The Interest Rates API provides a comprehensive suite of endpoints to access various interest rate data, including central bank rates, interbank rates, and historical financial time series. The API is designed for developers building fintech applications, offering a straightforward way to retrieve and analyze interest rate data. The following sections will detail the API's endpoints, focusing on the PBoC LPR 1-Year rate, symbolized as PBOC_LPR_1Y.

API Endpoints Overview

The Interest Rates API consists of several endpoints that allow you to access different types of data. Below is a summary of the key endpoints relevant to integrating PBoC LPR data:

  • /symbols: Retrieve a catalogue of available rate symbols.
  • /latest: Get the latest value for specified symbols.
  • /historical: Fetch the value of a symbol on a specific date.
  • /timeseries: Access a series of values between two dates.
  • /fluctuation: Analyze change statistics over a specified range.
  • /ohlc: Obtain OHLC (Open, High, Low, Close) candlestick data.
  • /convert: Compare loan interest costs between two rates.

Step 1: Retrieve Available Symbols

The first step in integrating the PBoC LPR data is to retrieve the available symbols using the /symbols endpoint. This will help you confirm that the PBoC LPR is available for use.

cURL Example

curl "https://interestratesapi.com/api/v1/symbols?category=central_bank&base=CNY&api_key=YOUR_KEY"

Python Example

import requests

response = requests.get(
'https://interestratesapi.com/api/v1/symbols',
params=dict(category='central_bank', base='CNY', api_key='YOUR_KEY')
)

data = response.json()

JavaScript Example

const response = await fetch(
'https://interestratesapi.com/api/v1/symbols?category=central_bank&base=CNY&api_key=YOUR_KEY'
);

const data = await response.json();

PHP Example

$url = "https://interestratesapi.com/api/v1/symbols?category=central_bank&base=CNY&api_key=YOUR_KEY";
$response = file_get_contents($url);
$data = json_decode($response, true);

Response Example

{
"success": true,
"count": 1,
"symbols": [
{
"symbol": "PBOC_LPR_1Y",
"name": "PBoC Loan Prime Rate 1-Year",
"category": "central_bank",
"country_code": "CN",
"currency_code": "CNY",
"frequency": "monthly",
"description": "The interest rate at which banks lend to their best customers."
}
]
}

Step 2: Fetch the Latest PBoC LPR Value

Once you have confirmed the availability of the PBoC LPR symbol, the next step is to retrieve the latest value using the /latest endpoint.

cURL Example

curl "https://interestratesapi.com/api/v1/latest?symbols=PBOC_LPR_1Y&api_key=YOUR_KEY"

Python Example

response = requests.get(
'https://interestratesapi.com/api/v1/latest',
params=dict(symbols='PBOC_LPR_1Y', api_key='YOUR_KEY')
)

data = response.json()

JavaScript Example

const response = await fetch(
'https://interestratesapi.com/api/v1/latest?symbols=PBOC_LPR_1Y&api_key=YOUR_KEY'
);

const data = await response.json();

PHP Example

$url = "https://interestratesapi.com/api/v1/latest?symbols=PBOC_LPR_1Y&api_key=YOUR_KEY";
$response = file_get_contents($url);
$data = json_decode($response, true);

Response Example

{
"success": true,
"date": "2026-07-17",
"base": "CNY",
"rates": {
"PBOC_LPR_1Y": 5.33
},
"dates": {
"PBOC_LPR_1Y": "2026-07-17"
},
"currencies": {
"PBOC_LPR_1Y": "CNY"
}
}

Step 3: Access Historical Data

To analyze trends over time, you can access historical data for the PBoC LPR using the /historical endpoint. This allows you to retrieve the value on a specific date.

cURL Example

curl "https://interestratesapi.com/api/v1/historical?date=2025-06-15&symbols=PBOC_LPR_1Y&api_key=YOUR_KEY"

Python Example

response = requests.get(
'https://interestratesapi.com/api/v1/historical',
params=dict(date='2025-06-15', symbols='PBOC_LPR_1Y', api_key='YOUR_KEY')
)

data = response.json()

JavaScript Example

const response = await fetch(
'https://interestratesapi.com/api/v1/historical?date=2025-06-15&symbols=PBOC_LPR_1Y&api_key=YOUR_KEY'
);

const data = await response.json();

PHP Example

$url = "https://interestratesapi.com/api/v1/historical?date=2025-06-15&symbols=PBOC_LPR_1Y&api_key=YOUR_KEY";
$response = file_get_contents($url);
$data = json_decode($response, true);

Response Example

{
"success": true,
"date": "2025-06-15",
"base": "CNY",
"rates": {
"PBOC_LPR_1Y": 5.30
},
"currencies": {
"PBOC_LPR_1Y": "CNY"
}
}

Step 4: Retrieve Time Series Data

For a more comprehensive analysis, you can retrieve a time series of PBoC LPR values over a specified date range using the /timeseries endpoint.

cURL Example

curl "https://interestratesapi.com/api/v1/timeseries?start=2025-07-17&end=2026-07-17&symbols=PBOC_LPR_1Y&api_key=YOUR_KEY"

Python Example

response = requests.get(
'https://interestratesapi.com/api/v1/timeseries',
params=dict(start='2025-07-17', end='2026-07-17', symbols='PBOC_LPR_1Y', api_key='YOUR_KEY')
)

data = response.json()

JavaScript Example

const response = await fetch(
'https://interestratesapi.com/api/v1/timeseries?start=2025-07-17&end=2026-07-17&symbols=PBOC_LPR_1Y&api_key=YOUR_KEY'
);

const data = await response.json();

PHP Example

$url = "https://interestratesapi.com/api/v1/timeseries?start=2025-07-17&end=2026-07-17&symbols=PBOC_LPR_1Y&api_key=YOUR_KEY";
$response = file_get_contents($url);
$data = json_decode($response, true);

Response Example

{
"success": true,
"base": "CNY",
"start_date": "2025-07-17",
"end_date": "2026-07-17",
"rates": {
"PBOC_LPR_1Y": {
"2025-07-17": 5.30,
"2025-08-17": 5.32,
"2025-09-17": 5.33
}
},
"frequencies": {
"PBOC_LPR_1Y": "monthly"
},
"currencies": {
"PBOC_LPR_1Y": "CNY"
}
}

Step 5: Analyze Fluctuations

To understand how the PBoC LPR has changed over a specific period, you can use the /fluctuation endpoint. This endpoint provides statistics about the rate changes.

cURL Example

curl "https://interestratesapi.com/api/v1/fluctuation?start=2025-07-17&end=2026-07-17&symbols=PBOC_LPR_1Y&api_key=YOUR_KEY"

Python Example

response = requests.get(
'https://interestratesapi.com/api/v1/fluctuation',
params=dict(start='2025-07-17', end='2026-07-17', symbols='PBOC_LPR_1Y', api_key='YOUR_KEY')
)

data = response.json()

JavaScript Example

const response = await fetch(
'https://interestratesapi.com/api/v1/fluctuation?start=2025-07-17&end=2026-07-17&symbols=PBOC_LPR_1Y&api_key=YOUR_KEY'
);

const data = await response.json();

PHP Example

$url = "https://interestratesapi.com/api/v1/fluctuation?start=2025-07-17&end=2026-07-17&symbols=PBOC_LPR_1Y&api_key=YOUR_KEY";
$response = file_get_contents($url);
$data = json_decode($response, true);

Response Example

{
"success": true,
"rates": {
"PBOC_LPR_1Y": {
"start_date": "2025-07-17",
"end_date": "2026-07-17",
"start_value": 5.30,
"end_value": 5.33,
"change": 0.03,
"change_pct": 0.57,
"high": 5.35,
"low": 5.25
}
}
}

Step 6: Obtain OHLC Data

For applications requiring candlestick data, the /ohlc endpoint provides Open, High, Low, and Close values for the PBoC LPR over a specified period.

cURL Example

curl "https://interestratesapi.com/api/v1/ohlc?symbols=PBOC_LPR_1Y&period=monthly&start=2025-07-17&end=2026-07-17&api_key=YOUR_KEY"

Python Example

response = requests.get(
'https://interestratesapi.com/api/v1/ohlc',
params=dict(symbols='PBOC_LPR_1Y', period='monthly', start='2025-07-17', end='2026-07-17', api_key='YOUR_KEY')
)

data = response.json()

JavaScript Example

const response = await fetch(
'https://interestratesapi.com/api/v1/ohlc?symbols=PBOC_LPR_1Y&period=monthly&start=2025-07-17&end=2026-07-17&api_key=YOUR_KEY'
);

const data = await response.json();

PHP Example

$url = "https://interestratesapi.com/api/v1/ohlc?symbols=PBOC_LPR_1Y&period=monthly&start=2025-07-17&end=2026-07-17&api_key=YOUR_KEY";
$response = file_get_contents($url);
$data = json_decode($response, true);

Response Example

{
"success": true,
"period": "monthly",
"start_date": "2025-07-17",
"end_date": "2026-07-17",
"rates": {
"PBOC_LPR_1Y": [
{
"period": "2025-07",
"open": 5.30,
"high": 5.35,
"low": 5.25,
"close": 5.33,
"data_points": 30
}
]
}
}

Step 7: Compare Loan Interest Costs

The final step in integrating PBoC LPR data is to compare loan interest costs using the /convert endpoint. This allows you to analyze the cost differences between the PBoC LPR and another rate.

cURL Example

curl "https://interestratesapi.com/api/v1/convert?from=PBOC_LPR_1Y&to=ECB_MRO&amount=100000&term_months=12&api_key=YOUR_KEY"

Python Example

response = requests.get(
'https://interestratesapi.com/api/v1/convert',
params=dict(from='PBOC_LPR_1Y', to='ECB_MRO', amount=100000, term_months=12, api_key='YOUR_KEY')
)

data = response.json()

JavaScript Example

const response = await fetch(
'https://interestratesapi.com/api/v1/convert?from=PBOC_LPR_1Y&to=ECB_MRO&amount=100000&term_months=12&api_key=YOUR_KEY'
);

const data = await response.json();

PHP Example

$url = "https://interestratesapi.com/api/v1/convert?from=PBOC_LPR_1Y&to=ECB_MRO&amount=100000&term_months=12&api_key=YOUR_KEY";
$response = file_get_contents($url);
$data = json_decode($response, true);

Response Example

{
"success": true,
"amount": 100000,
"term_months": 12,
"from": {
"symbol": "PBOC_LPR_1Y",
"rate": 5.33,
"date": "2026-07-17",
"total_interest": 5330.00,
"total_payment": 105330.00
},
"to": {
"symbol": "ECB_MRO",
"rate": 4.50,
"date": "2026-07-17",
"total_interest": 4500.00,
"total_payment": 104500.00
},
"difference": {
"rate_spread": 0.83,
"interest_saved": 830.00
}
}

Error Handling

When integrating with the Interest Rates API, it's essential to handle potential errors gracefully. Below are common error responses you may encounter:

  • 401: Missing or invalid api_key.
  • 403: Account without an active plan.
  • 404: No symbols matched or no data for the requested date/range.
  • 422: Validation error (e.g., wrong date format, invalid symbol).
  • 429: Request quota exhausted.

For error handling, check the success field in the response. If it is false, handle the error message accordingly. For rate limits, pay attention to the following headers:

  • X-RateLimit-Limit: The maximum number of requests allowed in a given time period.
  • X-RateLimit-Remaining: The number of requests remaining in the current time period.
  • X-RateLimit-Reset: The time when the rate limit will reset.

Building a Mini Project: Node.js/Express Endpoint

To demonstrate the integration of PBoC LPR data, let's create a simple Node.js/Express application that fetches, caches, and serves the PBoC LPR rate data.

Setup

First, ensure you have Node.js and Express installed. Create a new project and install the necessary packages:

npm init -y
npm install express axios

Code Example

const express = require('express');
const axios = require('axios');
const app = express();
const PORT = process.env.PORT || 3000;

app.get('/pboclpr', async (req, res) => {
try {
const response = await axios.get(
'https://interestratesapi.com/api/v1/latest',
{ params: { symbols: 'PBOC_LPR_1Y', api_key: 'YOUR_KEY' } }
);
res.json(response.data);
} catch (error) {
res.status(500).json({ error: 'Failed to fetch data' });
}
});

app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});

This simple Express endpoint fetches the latest PBoC LPR data and serves it as JSON. You can expand this project by adding caching mechanisms, error handling, and more endpoints as needed.

Conclusion

Integrating PBoC LPR data into your application using the Interest Rates API from interestratesapi.com is a straightforward process that can significantly enhance your financial analysis capabilities. By following the steps outlined in this guide, you can access real-time and historical interest rate data, analyze fluctuations, and compare loan costs effectively. For more information and to explore additional features, visit Explore Interest Rates API features and Get started with Interest Rates API.

Ready to get started?

Get your API key and start validating bank data in minutes.

Get API Key

Related posts