Skip to main content

IBM Quantum-powered portfolio optimization CLI tool

Project description

Q VEST - IBM Quantum Portfolio Prediction CLI

Python Version License PyPI

Q VEST is a quantum-powered investment portfolio optimization CLI tool that leverages IBM Quantum computers to find optimal asset allocations using advanced quantum algorithms.

๐Ÿš€ Features

  • Quantum-Enhanced Portfolio Optimization: Uses IBM Quantum computers with QAOA-inspired algorithms
  • Real-Time Market Data: Fetches live market data from Yahoo Finance
  • Secure API Key Management: Stores IBM Quantum credentials securely in ~/.qvest/config.json
  • Interactive CLI: User-friendly command-line interface with step-by-step guidance
  • Multiple Sectors: Pre-built portfolios for Tech, Healthcare, Finance, Energy, plus custom options
  • Risk Analysis: Comprehensive risk metrics and quantum advantage reporting
  • Fallback Support: Classical optimization backup when quantum resources are unavailable

๐Ÿ“ฆ Installation

Install qvest globally using pip:

pip install qvest

๐Ÿ”‘ Setup

1. Get IBM Quantum API Key

  1. Visit IBM Quantum
  2. Create a free account or sign in
  3. Go to your Account Settings
  4. Copy your API Token

2. Configure qvest

On first run, qvest will automatically prompt for your API key:

qvest

Or configure manually:

qvest config

๐Ÿ›  Usage

Run Portfolio Optimization

# Start portfolio optimization with interactive prompts
qvest

Configuration Management

# Show configuration status
qvest config --status

# Update configuration
qvest config --update

# Clear all configuration
qvest config --clear

Command Line Options

# Show version
qvest --version

# Show help
qvest --help

๐ŸŽฏ Interactive Workflow

When you run qvest, you'll be guided through:

  1. Sector Selection: Choose from Tech, Healthcare, Finance, Energy, or Custom assets
  2. Risk Level: Set your risk tolerance (1-10 scale)
  3. Investment Amount: Enter your investment amount in USD
  4. Time Horizon: Specify prediction horizon in years
  5. Algorithm Mode: Choose Pure Quantum or Quantum+Classical optimization

Example session:

         โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
        โ–ˆโ–ˆโ•”โ•โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ•šโ•โ•โ–ˆโ–ˆโ•”โ•โ•โ•
        โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—   โ–ˆโ–ˆโ•‘   
        โ–ˆโ–ˆโ•‘โ–„โ–„ โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ•”โ•โ–ˆโ–ˆโ•”โ•โ•โ•  โ•šโ•โ•โ•โ•โ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘   
        โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ• โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ•”โ• โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘   โ–ˆโ–ˆโ•‘   
         โ•šโ•โ•โ–€โ–€โ•โ•   โ•šโ•โ•โ•โ•  โ•šโ•โ•โ•โ•โ•โ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•   โ•šโ•โ•   

                 QVEST BY Minhal Rizvi

        Welcome to Q VEST - Your Quantum Investment Advisor

Please select a market sector:
1. Tech
2. Healthcare
3. Finance
4. Energy
5. Custom
Enter your choice (1-5): 1
Enter risk level (1-10): 7
Enter investment amount (USD): 10000
Enter prediction horizon (years): 5

Select execution mode:
1. Normal (Quantum + classical refinement)
2. Pure Quantum (bitstring allocation only)
Enter your choice (1-2) [2]: 2

๐Ÿ“Š Output

qvest provides comprehensive results including:

  • Portfolio Allocation: Percentage allocation for each asset
  • Expected Return: Projected annual return
  • Risk Metrics: Portfolio volatility and risk analysis
  • Quantum Advantage: Performance comparison vs classical methods

Example output:

โœ… Prediction result:
==================================================
๐Ÿงฎ Algorithm: Pure Quantum QAOA
๐Ÿ’ฐ Expected Return: 12.34%
๐Ÿ“Š Portfolio Allocation:
   โ€ข AAPL: 35.2%
   โ€ข MSFT: 28.7%
   โ€ข NVDA: 21.1%
   โ€ข GOOGL: 15.0%
โšก Quantum Advantage: 2.3x speedup
==================================================

๐Ÿ”ง Configuration File

qvest stores configuration in ~/.qvest/config.json:

{
  "ibm_quantum_token": "your_api_token_here",
  "ibm_quantum_instance": "hub/group/project"
}

The file is automatically created with secure permissions (600) on Unix systems.

๐ŸŒ Supported Assets

Predefined Sectors

  • Tech: AAPL, MSFT, NVDA, AMZN, GOOGL
  • Healthcare: JNJ, PFE, UNH, MRK, ABBV
  • Finance: JPM, BAC, GS, WFC, MS
  • Energy: XOM, CVX, SHEL, TTE, COP

Custom Assets

Enter any valid stock ticker symbols separated by commas.

๐Ÿ”ฌ Quantum Algorithms

qvest uses quantum optimization algorithms including:

  • QAOA (Quantum Approximate Optimization Algorithm): For portfolio optimization
  • Quantum Superposition: For exploring multiple allocation states simultaneously
  • Quantum Entanglement: For capturing asset correlations
  • Variational Quantum Eigensolver (VQE): For risk-return optimization

โš™๏ธ Requirements

  • Python 3.8+
  • IBM Quantum API Key (free)
  • Internet connection for market data

๐Ÿ›ก Security

  • API keys are stored locally in ~/.qvest/config.json
  • File permissions are set to user-only access (600)
  • No sensitive data is transmitted except to IBM Quantum services
  • All API calls use secure HTTPS connections

๐Ÿ› Troubleshooting

API Key Issues

# Check configuration status
qvest config --status

# Update API key
qvest config --update

Connection Problems

  • Ensure you have an active internet connection
  • Verify your IBM Quantum API key is valid
  • Check if IBM Quantum services are operational

Market Data Issues

  • qvest automatically falls back to simulated data if Yahoo Finance is unavailable
  • Ensure asset tickers are valid (e.g., AAPL, not Apple)

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

๐Ÿ“ž Support

โš ๏ธ Disclaimer

This tool is for educational and research purposes only. The results should not be considered as financial advice. Always consult with qualified financial advisors before making investment decisions.


Made with โšก by Minhal Rizvi

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

qvest-1.0.1.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

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

qvest-1.0.1-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file qvest-1.0.1.tar.gz.

File metadata

  • Download URL: qvest-1.0.1.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for qvest-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4f053083517060b269dc682dbd08bb580886a0560031bf24713b67f45ee6995d
MD5 e3a051981e80e1adaee72c5a66f30b6f
BLAKE2b-256 2bef64ef9937cda7834d12eee46bdef6bde532a5b048ab1249384009adc64c35

See more details on using hashes here.

File details

Details for the file qvest-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: qvest-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for qvest-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a2853856b1ceb43281e13bb1faa586f83d61299060829a8427f3920e99404684
MD5 94eceb6629ffff1497bca93c79ed88b7
BLAKE2b-256 9be3367b829e24d0f7f5859a8f15f3f27904ba5e0e101cf918c18f51eab196b2

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