Skip to main content

A comprehensive toolkit for portfolio analysis and management

Project description

Portfolio-tools Library Documentation

Documentation Tests Python

This library provides tools for financial analysis, portfolio management, and market data visualization with comprehensive multi-currency support and FIFO cost calculation.

📚 Documentation

📖 Full Documentation - Complete API reference, user guides, and examples

Quick Documentation Links

Building Documentation Locally

# Install documentation dependencies
pip install sphinx sphinx-rtd-theme

# Build documentation
./manage_docs.sh build

# Serve documentation locally
./manage_docs.sh serve

# Auto-rebuild on changes
./manage_docs.sh watch

Code Quality

This project maintains high code quality standards using:

  • Black - Code formatting
  • isort - Import sorting
  • flake8 - Linting
  • pytest - Testing

Quick Quality Checks

# Run all quality checks
./check_quality.sh

# Auto-format code
./format_code.sh

# Individual tools
black portfolio_toolkit/      # Format code
isort portfolio_toolkit/      # Sort imports
flake8 portfolio_toolkit/     # Lint code
pytest tests/              # Run tests

Configuration

Code quality tools are configured in pyproject.toml and setup.cfg:

  • Line length: 88 characters
  • Black and isort profiles: compatible
  • flake8 ignores: E203, E501, W503

Installation

Install from the project root (local development):

pip install .

Or in editable mode (recommended for development):

pip install -e .

To uninstall:

pip uninstall portfolio-toolkit

Testing

Running Tests

# Run all tests and checks
./run_tests.sh

# Run specific test suites
./run_tests.sh unit         # Unit tests only
./run_tests.sh coverage     # Tests with coverage report
./run_tests.sh examples     # Validate example portfolios
./run_tests.sh cli          # Test CLI commands
./run_tests.sh lint         # Code quality checks

Manual Testing

# Run unit tests directly
python -m pytest tests/ -v

# Validate example portfolios
python tests/validate_examples.py

# Test CLI commands
portfolio-tools print-positions -f tests/examples/basic_portfolio.json

# Or using the module directly
python -m cli.cli print-positions -f tests/examples/basic_portfolio.json

Documentation

# Local development
./manage_docs.sh build      # Build documentation
./manage_docs.sh serve      # Serve locally
./manage_docs.sh watch      # Auto-rebuild on changes

# Deploy
./manage_docs.sh deploy     # Deploy to GitHub Pages

To Do

  • Add unit and integration tests for all modules
  • Document all public methods with usage examples
  • Support multi-currency portfolios and automatic currency conversion
  • Add support for more data providers (e.g., Alpha Vantage, IEX Cloud)
  • Allow loading portfolios from Excel and ODS files natively
  • Implement portfolio performance metrics (Sharpe, Sortino, drawdown, etc.)
  • Add interactive visualizations (e.g., with Plotly or Dash)
  • Document all public methods with usage examples
  • Add export to PDF/Excel reports
  • Allow portfolio rebalancing and optimization simulations
  • Add risk analysis and Value at Risk (VaR)
  • Improve CLI interface for task automation (migrated to Click framework)

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_toolkit-0.1.0.tar.gz (72.6 kB view details)

Uploaded Source

Built Distribution

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

portfolio_toolkit-0.1.0-py3-none-any.whl (64.9 kB view details)

Uploaded Python 3

File details

Details for the file portfolio_toolkit-0.1.0.tar.gz.

File metadata

  • Download URL: portfolio_toolkit-0.1.0.tar.gz
  • Upload date:
  • Size: 72.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for portfolio_toolkit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cb7e6def38b658d186c6955bc559ba0f1b355c694d480975d3366c5d463e56b5
MD5 2ea08d99d8002004f6af5b0a361c2d19
BLAKE2b-256 4dab1f1e8d264af63ffe7e0079dcdab17432e2a1eb0fdcabc4eafc22edfff66c

See more details on using hashes here.

File details

Details for the file portfolio_toolkit-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for portfolio_toolkit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b60a1dd268dcf41edfba0f96b22638e9fa26b060abb77a96beebafa12261b38d
MD5 ef0b4dfa957f70d06fb6c47dc29ce7b3
BLAKE2b-256 efe8be7df218ca11e307d2efb91ae7a50ce2a4dce16baa5e8c7ceacc100fdc9c

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