DEV Community

Cover image for Portfolio value tracker with PnL calculation
Lucas Gragg
Lucas Gragg

Posted on

Portfolio value tracker with PnL calculation

Packaged crypto price alert bot this week after running it in production for ~60 days. Notes on what worked and what didn't.

The problem

Never miss a price move again. Set custom alerts for any cryptocurrency across major exchanges and get instant notifications via Telegram, email, or Discord when your targets hit.

What's in the box

  • Real-time price monitoring across 10+ exchanges
  • Custom alert conditions (above, below, percent change)
  • Telegram, Discord, and email notifications
  • Portfolio watchlist with live price tracking
  • Historical alert log and price snapshots

Code sample

# Basic structure
class Bot:
    def __init__(self, config):
        self.config = config

    def run(self):
        while True:
            self.scan()
            self.execute()
Enter fullscreen mode Exit fullscreen mode

If you want the full working version with all the battle-tested edge cases
handled, I packaged it here: Crypto Price Alert Bot

Happy to answer questions about the architecture in the comments.

Top comments (0)