When you need historical exchange rates inside a report or spreadsheet workflow, the useful part is usually not a large SDK. It is a small, copyable request that can be scheduled, cached, and checked.
This post collects three minimal FXpeek examples:
- fetch a JSON history series in JavaScript
- save a CSV file in Python
- download a CSV file with curl
FXpeek provides reference exchange rates for lookup, charting, CSV export, and lightweight reporting workflows. These are not transaction quotes.
JavaScript: fetch 30 days of history
async function getFxHistory(from, to, days = 30) {
const url = new URL('https://fxpeek.com/api/history');
url.searchParams.set('from', from);
url.searchParams.set('to', to);
url.searchParams.set('days', String(days));
const res = await fetch(url);
if (!res.ok) {
throw new Error(`FXpeek API error: ${res.status}`);
}
return res.json();
}
const data = await getFxHistory('CNY', 'TRY', 30);
console.log(data.rates.slice(0, 3));
Use this when you want to power a small chart, report preview, internal reconciliation tool, or spreadsheet add-on.
Python: save a CSV file
import requests
url = "https://fxpeek.com/api/csv"
params = {"from": "CNY", "to": "TRY", "days": 365}
res = requests.get(url, params=params, timeout=20)
res.raise_for_status()
with open("cny-try-365d.csv", "wb") as f:
f.write(res.content)
The CSV format is intentionally simple:
date,base,target,rate
2026-05-28,CNY,TRY,6.7699
2026-05-29,CNY,TRY,6.7811
2026-06-01,CNY,TRY,6.7839
That makes it easy to import into Excel, Google Sheets, pandas, or BI tools.
Shell: quick CSV download
curl -L 'https://fxpeek.com/api/csv?from=CNY&to=TRY&days=365' \
-o cny-try-365d.csv
API docs and examples
API docs:
Public GitHub examples:
https://github.com/Jenpo/historical-exchange-rate-api-examples
Public Gist:
https://gist.github.com/Jenpo/f2b04bb5416d503641fb3da94861f533
Notes
- Rates are reference data, not executable transaction quotes.
- The first public batch focuses on data-backed currency pairs.
- For trading, settlement, tax filing, or regulated accounting, validate your source and licensing requirements first.
For further actions, you may consider blocking this person and/or reporting abuse
