Skip to main content

A professional command-line tool for tracking crypto and stock investments

Project description

Portfolio Tracker CLI

A professional command-line tool for tracking your cryptocurrency and stock investments across multiple platforms with beautiful, real-time reporting.

Portfolio Tracker CLI License PyPI

✨ Features

  • 📊 Real-time Portfolio Tracking: Monitor your investments with live price data
  • 🆔 Unique Transaction IDs: Each transaction gets a unique identifier for easy management
  • 💼 Multi-Platform Support: Track investments across Binance, OKX, Coinbase, and Fidelity
  • 📈 Beautiful Reports: Rich, color-coded tables showing detailed portfolio analysis
  • 🔄 Full CRUD Operations: Add, view, edit, and delete transactions
  • 🎨 Professional CLI: Beautiful terminal output with Rich library
  • 📱 Cross-Platform: Works on macOS, Linux, and Windows

🚀 Quick Start

Installation

# Install from PyPI
pip install portfolio-tracker-cli

# Or install from source
git clone https://github.com/yourusername/portfolio-tracker-cli.git
cd portfolio-tracker-cli
pip install -e .

Basic Usage

# Add a crypto transaction
portfolio add --symbol BTCUSD --platform binance --amount 4000 --qty 0.05

# Add a stock transaction
portfolio add --symbol AAPL --platform fidelity --amount 1500 --qty 10

# View your portfolio report
portfolio report

# List all transactions
portfolio list

# Edit a transaction
portfolio edit --id abc12345 --symbol ETHUSD --amount 2000

# Delete a transaction
portfolio delete --id abc12345

📋 Commands

add - Add New Transaction

Add a new investment transaction to your portfolio.

portfolio add --symbol <SYMBOL> --platform <PLATFORM> --amount <AMOUNT> --qty <QUANTITY>

Arguments:

  • --symbol: Investment symbol (e.g., BTCUSD, ETHUSD, AAPL, QQQM)
  • --platform: Trading platform (binance, okx, coinbase, fidelity)
  • --amount: Amount spent in USD
  • --qty: Quantity purchased

Examples:

# Buy Bitcoin on Binance
portfolio add --symbol BTCUSD --platform binance --amount 4000 --qty 0.05

# Buy Apple stock on Fidelity
portfolio add --symbol AAPL --platform fidelity --amount 1500 --qty 10

# Buy Ethereum on Coinbase
portfolio add --symbol ETHUSD --platform coinbase --amount 2000 --qty 0.1

report - Generate Portfolio Report

Generate a comprehensive portfolio report with real-time prices and P&L calculations.

portfolio report

Output includes:

  • 📊 Detailed breakdown by platform and symbol
  • 📈 Symbol summary (cross-platform averages)
  • 🏦 Asset class summary (crypto vs stocks)
  • 💰 Real-time profit/loss calculations
  • 🎨 Color-coded performance indicators

list - List All Transactions

Display all transactions in a beautiful table format.

portfolio list

Shows:

  • Transaction ID
  • Date and time
  • Symbol and platform
  • Amount and quantity
  • Asset class

edit - Edit Transaction

Modify an existing transaction by its ID.

portfolio edit --id <TRANSACTION_ID> [--symbol <NEW_SYMBOL>] [--platform <NEW_PLATFORM>] [--amount <NEW_AMOUNT>] [--qty <NEW_QUANTITY>]

Arguments:

  • --id: Transaction ID (required)
  • --symbol: New symbol (optional)
  • --platform: New platform (optional)
  • --amount: New amount (optional)
  • --qty: New quantity (optional)

Example:

# Change the amount of transaction abc12345
portfolio edit --id abc12345 --amount 2500

# Change symbol and platform
portfolio edit --id abc12345 --symbol ETHUSD --platform coinbase

delete - Delete Transaction

Remove a transaction from your portfolio.

portfolio delete --id <TRANSACTION_ID> [--force]

Arguments:

  • --id: Transaction ID (required)
  • --force: Skip confirmation prompt (optional)

Example:

# Delete with confirmation
portfolio delete --id abc12345

# Delete without confirmation
portfolio delete --id abc12345 --force

🏦 Supported Platforms

Platform Type Symbols Description
Binance Crypto BTCUSD, ETHUSD, BNBUSD, etc. Binance.US API
OKX Crypto BTC-USD, ETH-USD, etc. OKX Exchange API
Coinbase Crypto BTC-USD, ETH-USD, etc. Coinbase API
Fidelity Stocks/ETFs AAPL, QQQM, SPY, etc. Via Stooq data

📊 Data Storage

All portfolio data is stored locally in portfolio_data.json in your current directory. The file contains:

  • Unique transaction IDs
  • Transaction details (symbol, platform, amount, quantity)
  • Timestamps
  • Asset classification

Example data structure:

{
  "transactions": {
    "abc12345": {
      "id": "abc12345",
      "symbol": "BTCUSD",
      "platform": "binance",
      "amount": 4000.0,
      "qty": 0.05,
      "timestamp": "2024-01-15T10:30:00",
      "asset_class": "crypto"
    }
  },
  "last_updated": "2024-01-15T10:30:00"
}

🎨 Beautiful Output

The CLI uses the Rich library to provide beautiful, color-coded output:

  • Green: Positive P&L
  • Red: Negative P&L
  • Cyan: Headers and labels
  • Magenta: Table headers
  • Blue: Information panels

🔧 Configuration

The tool automatically creates necessary files in your current directory:

  • portfolio_data.json: Your portfolio data
  • portfolio_config.json: Configuration settings (future use)

🚀 Publishing to PyPI

To publish this tool to PyPI:

  1. Update setup_cli.py:

    • Change author information
    • Update GitHub repository URL
    • Modify package name if needed
  2. Build and upload:

    python setup_cli.py sdist bdist_wheel
    twine upload dist/*
    
  3. Install globally:

    pip install portfolio-tracker-cli
    

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

📞 Support

If you encounter any issues or have questions:

  1. Check the GitHub Issues
  2. Create a new issue with detailed information
  3. Include your operating system and Python version

Happy Investing! 📈💰

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

portfolio-tracker-cli-1.0.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

portfolio_tracker_cli-1.0.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file portfolio-tracker-cli-1.0.0.tar.gz.

File metadata

  • Download URL: portfolio-tracker-cli-1.0.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for portfolio-tracker-cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c378ac6db4b3979098348570af91b3ff535a0307cefd47253b16ef2b5b2a66c8
MD5 a74aebfca0d96374ca3320b20a021b95
BLAKE2b-256 83f1af90d5ce45203507a643b62d3d817b3426d92304bbfb12876a0d7533dc1a

See more details on using hashes here.

File details

Details for the file portfolio_tracker_cli-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for portfolio_tracker_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9647118bf1da8f45239cef88d8dbd5cc158152245e3e36d493832e7e9f448eb
MD5 c04ed0c0ba4c75e8c4a18171e4a7e2ae
BLAKE2b-256 10de8fcfb138a6bc17e05230be1e50153864820781d99654d3b8a2647359e63f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page