Skip to content

Instantly share code, notes, and snippets.

@idealwebsolutions
Last active September 16, 2024 02:40
Show Gist options
  • Save idealwebsolutions/3ba119b621a1573e19e75cc118ef5350 to your computer and use it in GitHub Desktop.
Save idealwebsolutions/3ba119b621a1573e19e75cc118ef5350 to your computer and use it in GitHub Desktop.
Price spot endpoints for ETH and BTC using Coinbase API v2 (no auth required)
# Endpoints for Coinbase API
curl -s https://api.coinbase.com/v2/prices/eth-usd/spot -H 'CB-VERSION: 2015-04-08' | jq -r ".data.amount" | sed -E 's/(.+)/$\1/'
curl -s https://api.coinbase.com/v2/prices/btc-usd/spot -H 'CB-VERSION: 2015-04-08' | jq -r ".data.amount" | sed -E 's/(.+)/$\1/'
# Endpoints for Gemini Ticker API
curl -s https://api.gemini.com/v1/pubticker/ethusd | jq -r 'select(.ask != null)' | sed -E 's/(.+)/$\1/'
curl -s https://api.gemini.com/v1/pubticker/btcusd | jq -r 'select(.ask != null)' | sed -E 's/(.+)/$\1/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment