Backtesting International ETF Premiums in Python With Point-in-Time Inputs
An international ETF backtest can show excellent premium convergence even when the simulated ETF trades lose money. One common cause is a moving reference value. Another is using a quote or FX update that had occurred at the exchange but had not reached the strategy. A small regression fixture can catch both. This article was drafted using an AI writing tool. The data below is synthetic, and the…
This article discusses a backtesting framework for international ETF premiums using Python and point-in-time inputs. The primary focus is on ensuring accurate data selection and handling late or stale observations. The code provided defines an Observation class to store event and receipt timestamps, as well as the value. The latest_at function filters observations based on a cutoff time and maximum age, selecting the latest eligible observation.
The usd_per_foreign_return function calculates the conversion rate between foreign and USD values, while the premium function computes the premium based on quote and reference values. The short_etf_pnl function calculates the profit and loss (P&L) for a short ETF position. A verify function is included to demonstrate the usage of these functions with example data.
Brief written by urgent.news; may contain errors — check the original.
Source: dev.to