Created
May 12, 2024 22:18
-
-
Save 0xOsprey/b88419d6be86840eeba122e791b49e03 to your computer and use it in GitHub Desktop.
Raycast Script to retrieve and copy the current ETH price
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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