Skip to content

Instantly share code, notes, and snippets.

@molly
Created January 31, 2023 15:15
Show Gist options
  • Save molly/07f852da688eb0e88fa687ec2bf1a3e8 to your computer and use it in GitHub Desktop.
Save molly/07f852da688eb0e88fa687ec2bf1a3e8 to your computer and use it in GitHub Desktop.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © mollywhite
//@version=5
indicator('GBTC premium')
btc = request.security('COINBASE:BTCUSD', timeframe.period, close)
gbtc = nz(request.security('OTC:GBTC', timeframe.period, close))
gbtcVolume = nz(request.security('OTC:GBTC', timeframe.period, volume))
btcPerGbtcShare = 0.00091152 // Value as of 2023-01-28, via https://grayscale.com/products/grayscale-bitcoin-trust/
premium = (gbtc / (btc * btcPerGbtcShare) - 1) * 100
plot(premium, style=plot.style_line, color=color.rgb(46,163,144,0), linewidth=2)
hline(0, title="Zero", color=color.gray, linestyle=hline.style_dashed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment