Simple script to run correlation on crypto pairs

Norman Fung
Apr 26, 2024

--

Parameters at top, it should be fairly self explanatory. start, end dates, pairs to run correlation on, and which exchange to fetch candles from.

The script will spit out a correlation matrix like this:

Here is the code. “fetch_candles” is a simple wrapper around ccxt exchange.fetch_ohlcv. The logic added on top was a sliding window technique: Most exchanges only permit fetches max ~100 candles at a time.

--

--