Portfolio Optimizer ToolHomeAbout

About Portfolio Optimizer Tool

What is Portfolio Optimizer Tool?

Portfolio Optimizer Tool is a web-based application designed to help investors rebalance their portfolios. Unlike traditional calculators that give you one answer, this tool generates multiple rebalancing scenarios using different strategies, allowing you to choose the approach that best fits your situation.

The optimizer analyzes your current portfolio positions and provides optimized scenarios that respect your constraints while achieving your target asset allocation. It handles everything from simple rebalancing to complex situations involving cash deployment, position restrictions, and lot size requirements.

Common Use Cases


How It Works: The Algorithm

Rather than giving you just one "correct" answer, the optimizer generates multiple rebalancing scenarios using different strategies. This lets you review various approaches and choose the one that best fits your situation. The process follows three steps:

Step 1: Calculate Your Portfolio Gaps

First, the optimizer analyzes your current state and determines where you need to be:

Step 2: Apply Five Different Strategies

The optimizer generates scenarios using five distinct strategies, each with different priorities and trade-offs:

1. Proportional Filling — The Mathematical Optimum

Fills all gaps proportionally to get as close as possible to perfect allocation. Best when you have sufficient cash to deploy.

2. Largest Gap First — The Aggressive Approach

Prioritizes fixing the biggest imbalances in dollar terms first. Best for quickly addressing major portfolio imbalances.

3. Worst Percentage First — The Equity Approach

Prioritizes positions with the worst percentage deviations from target, regardless of dollar size. Best for ensuring smaller positions get attention.

4. Balanced — The Gradual Approach

Makes partial moves across multiple rounds for conservative rebalancing. Best when you want to move gradually toward targets.

5. Randomized — The Exploration Approach

Uses controlled randomness to explore alternative solutions. Best for finding creative approaches that deterministic strategies might miss.

Step 3: Score and Rank Scenarios

Each scenario is evaluated using a combined score that balances two objectives:

Portfolio Deviation — How far the final portfolio is from perfect allocation, measured as the sum of percentage differences from your target allocations. A perfect allocation scores 0.0.

Cash Deviation — How close you get to your target cash level, normalized to be comparable with portfolio deviation. Ensures you hit your cash goals whether deploying or raising funds.

The scenarios are ranked by their combined score (lower is better), with duplicates removed. The best options are presented first, but you maintain full control over which scenario to implement.

Constraints & Guardrails

All scenarios respect your constraints to ensure realistic, executable trades:


What's Supported & What's Not

Understanding the capabilities and limitations of the optimizer helps you use it effectively:

✓ Supported
  • Fractional and whole shares
  • Large portfolios (50+ positions)
  • Extreme price ranges ($0.01 to $100,000+)
  • Extreme imbalances (10x+ over/under-weight)
  • Zero positions (starting from scratch)
  • Locked positions (cannot be traded)
  • Buy-only or sell-only positions
  • Deploying, raising, or neutral cash
  • Lot size constraints
  • Minimum order value requirements
✗ Not Supported
  • Short positions (negative holdings)
  • Leverage or margin trading
  • Multi-currency portfolios
  • Transaction costs or taxes
  • Tax-loss harvesting
  • Time-based constraints
  • Scheduling or automated execution
  • Real-time price updates
  • Market impact or slippage
  • Broker integration

The optimizer is purely allocation-focused, providing you with optimal trade recommendations that you can execute through your broker.


How to Use This Tool

Step 1: Set Up Your Portfolio

Start by entering your current portfolio positions. For each holding, provide the ticker symbol (e.g., AAPL, MSFT, BTC), the number of shares or units you currently own, the current market price, and your target allocation percentage. Make sure your target allocations sum to exactly 100%.

Step 2: Configure Cash Settings

Specify your current cash available for trading and your target cash level after rebalancing. The difference tells the optimizer whether you're deploying cash (current > target), raising cash (target > current), or rebalancing without net cash flow (equal amounts).

Step 3: Adjust Settings (Optional)

Set default constraints that apply to all positions: minimum order size (lot size), minimum order value, and whether buying or selling is allowed. You can also expand individual positions to set custom constraints for specific assets—useful for restricted stock, tax considerations, or strategic holds.

Step 4: Optimize & Review Results

Click the Optimize button and complete the bot verification (first time only). The optimizer will generate multiple scenarios using different strategies. Review the recommended trades for each scenario, check the quality scores, and choose the approach that best fits your needs.

Step 5: Save Your Configuration

Use the Save button to download your portfolio configuration as a JSON file. You can load it later using the Load button for quick access to your settings without re-entering everything.


Understanding the Results

After optimization, you'll see multiple scenarios ranked by their combined score. Each scenario includes detailed metrics to help you evaluate and compare options:

Combined Score — The overall quality metric (lower is better). This balances allocation accuracy with cash target achievement. The minimum possible score is 0.0, representing a perfect result.

Input Deviation vs. Final Deviation — Shows how far you started from target allocation and how close you'll get after implementing the trades. Both range from 0.0 (perfect) upward. A large improvement indicates an effective rebalancing.

Cash Yield — The net cash change from all trades. Positive means you gained cash from selling, negative means you spent cash buying. This helps you understand the cash impact of the scenario.

Cash Deviation — How far the final cash level is from your target. Lower is better. This ensures you're meeting your cash goals, whether deploying funds or raising cash for expenses.

Position Changes — For each asset, you'll see the number of shares to buy (positive) or sell (negative), along with initial and final weights. This gives you the exact trades to execute.

Choosing a Scenario

The top-ranked scenario isn't always the only good choice. Here's what to consider:


Limitations and Disclaimers

No Investment Advice — This tool does not provide investment, financial, or legal advice. It is purely a computational tool that performs mathematical calculations based on your inputs.

No Accuracy Guarantee — Results are based entirely on the inputs you provide. The author makes no guarantees about the accuracy, completeness, or reliability of the optimization results. Always verify outputs before executing any trades.

Market Considerations — The tool uses static prices and doesn't account for market volatility, slippage, trading hours, liquidity constraints, bid-ask spreads, or other real-world market conditions that can significantly impact trade execution.

No Liability — The author and publisher assume no liability for any financial losses, damages, or adverse outcomes resulting from the use of this tool. All investment decisions are your responsibility.

User Responsibility — You are solely responsible for verifying all outputs, understanding the implications of any trades, ensuring compliance with applicable laws and regulations, and consulting with qualified professionals before making investment decisions.

Tax and Regulatory Compliance — This tool does not consider tax implications (capital gains, wash sales, etc.), regulatory requirements, account-specific restrictions, or individual financial circumstances. Always consult appropriate tax and financial professionals.


Privacy & Security

Your privacy is important. This tool is designed with privacy in mind:

For more details, see our Privacy Policy.