Skip to content

Instantly share code, notes, and snippets.

@0xOsprey
Created May 12, 2024 22:18
Show Gist options
  • Save 0xOsprey/b88419d6be86840eeba122e791b49e03 to your computer and use it in GitHub Desktop.
Save 0xOsprey/b88419d6be86840eeba122e791b49e03 to your computer and use it in GitHub Desktop.
Raycast Script to retrieve and copy the current ETH price
#!/usr/bin/python3
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title ETH Price
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🤑
# Documentation:
# @raycast.description Gets ETH Price from Coingecko
# @raycast.author Joe Coll
# @raycast.authorURL https://github.com/0xOsprey
import requests, pyperclip
response = requests.get("https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=usd")
if response.status_code == 200:
data = response.json()
price = str(round(float(data['ethereum']['usd']),2))
print("${}".format(price))
pyperclip.copy(price)
else:
print('Error:', response.status_code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment