TGViewer
Learn Python Coding Learn Python Coding @pythonre Β· 40.9K subscribers
Post #8890 1.2K
πŸ“‰ The bitcoin is falling, boss!

We will teach Python to monitor the cryptocurrency rate and notify if the rate is above or below the threshold.
We will connect the requests library and import time:
import requests
import time


We will create a function to get the BTC price in USD via the CoinGecko API:
def get_btc_price():
    url = "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd"
    r = requests.get(url)
    return r.json()["bitcoin"]["usd"]


Now β€” the main monitoring cycle. We will set a threshold and check the price every minute:
threshold = 65000  # specify your goal
while True:
    price = get_btc_price()
    print(f"BTC: ${price}")
    if price > threshold:
        print("πŸš€ Time to sell!")
        break
    time.sleep(60)


πŸ”₯ You can also easily adapt it for Ethereum, DOGE, or even Telegram Token β€” just replace bitcoin with the desired coin in the URL.

πŸšͺ @DataScience4
  • ❀ 8
More from @pythonre
  1. Oct 17, 2026😰 15-Hour "Python for Data Science" Course ⚑️ Learn Python for Data Science https://enghu…
  2. Oct 13, 2026https://substack.com/@husseinsheikho?utm_source=share&utm_medium=android&r=3hwnr8 Follow m…
  3. Oct 10, 2026πŸ“š Download 10 Python books for FREE: 1. Think Python β€” O’Reilly https://t.co/X7y3pX68IW 2…
  4. Oct 7, 2026Python Lists: A Quick Reference 🐍 * Definition: Lists are ordered, mutable collections th…
  5. Oct 7, 2026πŸ“± 270 tools for Python developers The repository contains: 🫑 Linters and formatters; πŸ«‘β€¦
  6. Oct 7, 2026Hands On Python Data Science - Data Science Bootcamp Master Python for Data Science with R…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook β†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 β†’