Just vibe-coded the real-time BTC/gold ratio in python, in case anyone else is interested:

# Bitcoin-to-Gold price ratio (BTC-USD / GC=F) from 2022-01-01 to today.

# Requires: pandas, yfinance, matplotlib

import datetime as dt

import pandas as pd

import yfinance as yf

import matplotlib.pyplot as plt

start = dt.datetime(2022, 1, 1)

end = dt.datetime.now()

tickers = {"Bitcoin": "BTC-USD", "Gold": "GC=F"} # GC=F = COMEX gold futures

raw = yf.download(

list(tickers.values()),

start=start,

end=end,

interval="1d",

progress=False,

auto_adjust=False,

)["Close"].rename(columns={v: k for k, v in tickers.items()})

# forward-fill gold so weekends & holidays have a price

prices = raw.ffill()

ratio = prices["Bitcoin"] / prices["Gold"]

ax = ratio.plot(figsize=(10, 6), title="BTC / Gold Price Ratio")

ax.set_xlabel("Date")

ax.set_ylabel("BTC price รท Gold price")

plt.tight_layout()

plt.show()

Reply to this note

Please Login to reply.

Discussion

No replies yet.