XAU / PAXG-XAUT Pairs Stationarity Analysis
This notebook will provide arbitrage indications for spot to asset-backed cryptocurrency pairs. In particular, the XAUt/USDt and PAXG/USDt pairs will be analyzed against spot gold - taking advantage of low volume pair trading. In addition, this notebook will aim to run statistical tests to identify stationarity and mean reversion.
Data Consolidation
Create a helper function to fetch the data from the pyth price oracle.
Run to view results
Run to view results
Data Cleaning
With the dataset from pyth, place the datasets into a dictionary to then be merged into one DataFrame, using time (in UNIX) as an index.
Run to view results
Normalize XAU, XAUt, and PAXG by taking the percent difference of the closing price of each bar.
Run to view results
Calculate the spread of each datapoint with respect to XAU (w/ a XAUt-PAXG spread).
Run to view results
Data Analysis
Let us plot the graph of PAXG, XAUt, and XAU - both raw and normalized; additionally plot the correlation of PAXG and XAUt with respect to XAU.
Run to view results
Run to view results
Analytically, we can show that XAU, XAUt, and PAXG all exhibit strong correlation. Since these datasets are meant to be directly proportional to each other, any variation we exhibit in this dataset is a theoretical risk-free profit. However, before we put these claims into practice, let us perform statistical tests to prove direct proportionality, stationarity, and mean reversion.
Run to view results
As this DataFrame is from January to Mid-May, on the assumption that this data isn't mean reverting [1], the expected loss for an unleveraged portfolio would be the spread between XAUt and PAXG. However, we see a strong positive correlation. To take advantage of spread trading, let us create three datasets - the spread between XAUt, PAXG w/ respect to XAU, and a XAUt-PAXG spread.
[1] A mean reverting series is a group of data that retains 'memory' - as a series deviate from a given mean, it tends to traverse back to the mean (hence 'reverting').
Run to view results
Augmented Dickey-Fuller Test
Run to view results
Hurst Exponent
Run to view results
Nice.