Cryptocurrency portfolio tracking and management application with Streamlit web interface.
- Real-time Portfolio Tracking - Monitor total portfolio value, invested amount, and profit/loss
- Multi-Portfolio Support - Manage multiple portfolios (Swissborg, Ledger, Binance, etc.)
- Portfolio Aggregation - View combined holdings across all portfolios
- Historical Balance Tracking - Track portfolio value over time with timestamp-based records
- Live Price Updates - Fetch current cryptocurrency prices via CoinMarketCap API
- Historical Market Data - Retrieve and store historical prices via MarketRaccoon API
- Multi-Currency Support - EUR/USD fiat currency conversion with file-based caching
- Price Interpolation - Fill missing historical prices for accurate valuations
- Interactive Graphs - Portfolio performance visualization with Plotly
- Pie Charts - Portfolio allocation and token distribution
- Time-Series Analysis - Value trends and performance metrics over time
- Performance Metrics - Investment returns, profit/loss, percentage gains
- Buy/Sell Operations - Track purchase and sale transactions
- Token Swaps - Record token exchange operations
- Transaction History - Complete audit trail of all operations
- Airdrop Support - Handle zero-cost token acquisitions (source = 0)
- CSV Import/Export - Bulk data import and backup capabilities
- AI-Powered Processing - Anthropic Claude integration for data extraction from screenshots
- Token Metadata Management - Track token status (active/delisted/migrated) with MarketRaccoon ID mapping
- SQLite Database - Robust local data storage with versioned schema migrations
- Data Deduplication - Automatic cleanup of duplicate historical entries
- Token Status Tracking - Manage delisted, deprecated, and migrated tokens
- Configurable Settings - Customizable configuration via JSON
- Debug Mode - Enhanced logging with sensitive data filtering
- Responsive UI - Wide layout with multi-page navigation
- Update Timestamps - Track last data refresh with time-since display
- Python 3.8+
- uv (ultra-fast Python package manager)
- Docker (optional, for containerized deployment)
- Clone the repository:
git clone https://github.com/hansipie/CryptoUpdate.git
cd CryptoUpdate- Install dependencies with uv:
uv syncConfigure settings.json at the root of the project:
{
"MarketRaccoon": { "url": "http://api.marketraccoon.eu", "token": "" },
"Coinmarketcap": { "token": "your-coinmarketcap-token" },
"AI": { "token": "your-anthropic-api-key" },
"Notion": { "token": "", "database": "", "parentpage": "" },
"Debug": { "flag": "False" },
"Local": { "archive_path": "archive", "data_path": "data", "sqlite_file": "db.sqlite3" },
"OperationsColors": { "green_threshold": 100, "orange_threshold": 50, "red_threshold": 0 },
"FiatCurrency": { "currency": "EUR" },
"UIPreferences": { "show_empty_portfolios": true, "graphs_selected_tokens": [] }
}Required API Keys:
- CoinMarketCap: For fetching current cryptocurrency prices
- Anthropic Claude (optional): For AI-powered data extraction from images
Note: Never commit settings.json with real API keys to version control.
uv run streamlit run app.pyThe web interface will be available at http://localhost:8501
# Build and run with docker compose
docker compose up
# With live reload
docker compose up --watchThe web interface will be available at http://localhost:8042 (mapped from container port 8080).
CryptoUpdate/
├── app.py # Main entry point and navigation
├── app_pages/ # Streamlit application pages
│ ├── 0_Home.py # Dashboard with metrics and graphs
│ ├── 1_Portfolios.py # Portfolio management
│ ├── 2_Graphs.py # Performance visualizations
│ ├── 3_Operations.py # Transaction management (Buy/Swap)
│ ├── 4_Import.py # CSV import/export
│ ├── 5_TokenMetadata.py # Token status and MarketRaccoon ID management
│ ├── 6_Settings.py # Configuration
│ └── X_Tests.py # Development testing page
├── modules/ # Core business logic
│ ├── database/ # Database layer
│ │ ├── migrations.py # Versioned schema migrations (v1–v5)
│ │ ├── tokensdb.py # Historical token data
│ │ ├── portfolios.py # Portfolio CRUD operations
│ │ ├── operations.py # Transaction history
│ │ ├── market.py # Market data storage
│ │ ├── apimarket.py # MarketRaccoon API integration
│ │ ├── swaps.py # Token swap transactions
│ │ ├── fiat_cache.py # Fiat currency caching
│ │ └── customdata.py # Key-value config storage
│ ├── aiprocessing.py # Anthropic Claude API integration
│ ├── cmc.py # CoinMarketCap API
│ ├── token_metadata.py # Token status tracking
│ ├── tools.py # Utility functions
│ ├── plotter.py # Plotly chart generation
│ └── configuration.py # Settings management
├── data/ # Application data (not committed)
│ └── db.sqlite3 # SQLite database
├── tests/ # Test files
├── Dockerfile # Docker configuration
├── pyproject.toml # Python project configuration
├── uv.lock # Locked dependencies
└── CLAUDE.md # Development instructions for Claude Code
- Python 3.8+: Programming language
- uv: Ultra-fast Python package manager and dependency resolver
- Streamlit: Web application framework for data apps
- Docker: Containerization for deployment
- Pandas: Data manipulation and analysis
- SQLite: Lightweight database with versioned migrations
- Plotly: Interactive charting and visualizations
- MarketRaccoon API: Historical cryptocurrency prices and fiat exchange rates
- CoinMarketCap API: Current cryptocurrency market data
- Anthropic Claude: AI-powered data extraction from images (optional)
- ruff: Fast Python linter and formatter
- pylint: Code quality checker
- pip-audit: Security vulnerability scanner
# Format code
uv run ruff format .
# Check linting
uv run ruff check .
# Fix linting issues automatically
uv run ruff check --fix .
# Run pylint (all tracked Python files)
uv run pylint $(git ls-files '*.py')
# Security audit
uv run pip-audituv add package-name # Add dependency
uv add --dev package-name # Add dev dependency
uv lock --upgrade # Update all dependencies
uv sync # Sync environment to lockfileThe application uses SQLite with versioned schema migrations (v1–v5, applied automatically at startup).
Tables:
- TokensDatabase: Historical token prices and holdings
- Portfolios: Portfolio definitions
- Portfolios_Tokens: Current token holdings per portfolio
- Operations: Transaction history (source=0 = airdrop, do not delete)
- Market: Historical cryptocurrency market data
- Currency: Fiat currency exchange rates
- Swaps: Token swap transactions (includes
notecolumn) - TokenMetadata: Token status, MarketRaccoon ID mapping (
id,token,mraccoon_id,name,status, ...) - Customdata: Key-value configuration store
- Memory-Efficient Queries: Use
pivot_table()instead of multiplemerge()operations on large datasets - Data Deduplication: Run
TokensDatabase.drop_duplicate()after bulk imports - Token Status: Always check token metadata before displaying in UI
- Airdrop Operations: Operations with
source = 0are valid (airdrops) — never delete them - Configuration: Never commit
settings.jsonwith real API tokens
- Home (0_Home.py): Dashboard with portfolio overview, metrics (invested/total value/profit), performance graphs, and price update functionality
- Portfolios (1_Portfolios.py): Manage multiple portfolios, view token allocations, and aggregate holdings
- Graphs (2_Graphs.py): Interactive performance visualizations with time-series charts and pie charts
- Operations (3_Operations.py): Record buy, sell, and swap transactions
- Import (4_Import.py): Bulk import/export portfolio data via CSV
- Token Metadata (5_TokenMetadata.py): Manage token status (active/delisted/deprecated/migrated) and MarketRaccoon ID mapping
- Settings (6_Settings.py): Configure application settings and API tokens
- Tests (X_Tests.py): Development testing interface
Contributions are welcome! Please follow these steps:
- Fork the project
- Create a feature branch (
git checkout -b feature/NewFeature) - Install dependencies with
uv sync - Make your changes following the code style guidelines in
CLAUDE.md - Run code quality checks:
uv run ruff check .anduv run ruff format . - Test your changes locally with
uv run streamlit run app.py - Commit your changes (
git commit -am 'Add NewFeature') - Push to the branch (
git push origin feature/NewFeature) - Open a Pull Request
See CLAUDE.md for detailed development guidelines and project-specific instructions.
This project is licensed under the terms specified in the LICENSE file.