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 portfolio_toolkit.cli.cli portfolio print performance-summary 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.2.tar.gz (77.1 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.2-py3-none-any.whl (76.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for portfolio_toolkit-0.1.2.tar.gz
Algorithm Hash digest
SHA256 faf21b66927c850ac8018172c48c4fc7f6117174d22bb26b080369baef3b27a0
MD5 5feb116e250ed9acdf591429ab769867
BLAKE2b-256 6df72b80c99098be3cc87272b3f9a91b089fa3f58bf71d7c239d5a01ec79a483

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for portfolio_toolkit-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 05ac928e7c5a03e351d6c957f7b286272badaf6038c68c23cc2792084755f6ff
MD5 267922032bb5fed48e9d00cf12591222
BLAKE2b-256 24d868f5835979c599f797add779517acaef2be89f297d51396ef2a782829691

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