Building Forex Returns Series from Intraday Data
Summary
This tutorial describes a workflow for retrieving intraday foreign exchange aggregates from a market data API, formatting timestamps, plotting closing prices, and calculating percentage returns. It illustrates the process with a major pair and a less frequently traded exotic pair over a month. The examples show how to request data for multiple symbols, convert millisecond timestamps into a time index, and use the close-price series to derive returns.
A central data-handling lesson concerns gaps in trading activity. Plotting observations against a regular datetime axis can visually connect prices across periods with no trades, making the series appear interpolated. The article suggests using timestamp labels to display observations without those connecting gaps and cautions that backfilling prices introduces look-ahead bias. Forward filling avoids future information but can invent trades that did not occur, so missing observations should be interpreted in context. The tutorial is a narrow data preparation example; its comparison of pair variation is visual and does not establish a trading edge or evaluate a strategy.
Key ideas
- Intraday FX data can be requested for multiple currency pairs and organized into separate time series.
- Millisecond timestamps should be converted into a usable time index before analysis.
- A regular datetime plot may visually bridge gaps where no trades occurred.
- Backfilling prices can introduce look-ahead bias, while forward filling may imply trades that never happened.
- Returns can be calculated as percentage changes in close prices, but this workflow does not test a trading strategy.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.