FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Build a Crypto Portfolio Tracker in Python: Live Prices, P&L & Allocation in 150 Lines
How-ToProgramming Languages

Build a Crypto Portfolio Tracker in Python: Live Prices, P&L & Allocation in 150 Lines

via Dev.to PythonOtto3h ago

Tags: python, crypto, bitcoin, programming I got tired of switching between 4 tabs to check my crypto portfolio. So I built a simple Python tracker that pulls live prices, calculates P&L, and shows portfolio allocation — no API key needed. Here's what it does: Fetches live prices from CoinGecko (free, no signup) Calculates profit/loss per coin and overall Shows portfolio allocation as percentages Saves history to a JSON file The Full Script import json import urllib.request import datetime import os PORTFOLIO_FILE = " portfolio.json " HISTORY_FILE = " history.json " # Your holdings — edit this DEFAULT_PORTFOLIO = { " bitcoin " : { " amount " : 0.1 , " avg_buy_price " : 35000 }, " ethereum " : { " amount " : 1.5 , " avg_buy_price " : 2200 }, " solana " : { " amount " : 10 , " avg_buy_price " : 120 }, } def load_portfolio (): if os . path . exists ( PORTFOLIO_FILE ): with open ( PORTFOLIO_FILE ) as f : return json . load ( f ) return DEFAULT_PORTFOLIO def save_portfolio ( portfolio ): wi

Continue reading on Dev.to Python

Opens in a new tab

Read Full Article
0 views

Related Articles

Botanical garden
How-To

Botanical garden

Dev.to Tutorial • 2h ago

Task 3: Delivery Man Task
How-To

Task 3: Delivery Man Task

Dev.to • 3h ago

I Wasted Months Memorizing Design Patterns — This One Trick Changed Everything
How-To

I Wasted Months Memorizing Design Patterns — This One Trick Changed Everything

Medium Programming • 3h ago

Top 5 Games to Improve Your Coding Skills
How-To

Top 5 Games to Improve Your Coding Skills

Medium Programming • 4h ago

I Got a $40 Parking Fine, So I’m Building an App That Fixes It
How-To

I Got a $40 Parking Fine, So I’m Building an App That Fixes It

Medium Programming • 7h ago

Discover More Articles