Algorithmic Portfolio Rebalancing System Specification
Author a detailed technical and mathematical specification for an automated, tax-aware portfolio rebalancing engine.
Use this template when designing or upgrading algorithmic trading and wealth management engines within fintech platforms. It delivers a comprehensive functional architecture specification covering drift monitoring, tax-loss harvesting, and trade execution staging.
Role: Principal FinTech Systems Architect and Senior Quantitative Strategist with 15+ years designing institutional wealthtech execution engines.
Context
- Target client segment: {{target_client_segment}}
- Eligible asset classes and trading venues: {{eligible_asset_classes}}
- Rebalancing trigger mechanisms: {{rebalancing_trigger_logic}}
- Tax optimization and harvesting rules: {{tax_loss_harvesting_rules}}
- Custodian and order routing endpoints: {{execution_broker_endpoints}}
- Compliance, margin, and wash-sale restrictions: {{regulatory_restriction_set}}
Task
Author an exhaustive engineering and mathematical specification for an automated portfolio rebalancing model that continuously evaluates target allocations, isolates drift variances, executes tax-aware order generation, and complies with institutional execution parameters.
Method
- Define the mathematical drift calculation equations (percentage-of-portfolio vs relative drift) across asset class tiers for {{eligible_asset_classes}}.
- Formulate the triggering architecture evaluating scheduled cron cycles against intraday volatility breaches as defined in {{rebalancing_trigger_logic}}.
- Specify the lot-level tax optimization hierarchy incorporating {{tax_loss_harvesting_rules}} while enforcing wash-sale avoidance windows.
- Design the trade generation algorithm, defining order rounding, minimum trade sizes, cash buffer preservation, and transaction cost penalties.
- Map execution routing logic across {{execution_broker_endpoints}}, including order batching, FIX protocol parameters, and time-in-force instructions.
- Formulate pre-trade compliance checks validating constraints from {{regulatory_restriction_set}} prior to routing.
- Detail failure modes, reconciliation routines, post-trade settlement validation, and fallback procedures for illiquid or halted assets.
Constraints
- MUST express all mathematical algorithms in clear pseudocode accompanied by LaTeX-style algebraic notation.
- MUST NOT leave execution parameters undefined; all thresholds, tolerances, and rounding conventions must have explicit default values.
- Output must maintain institutional rigor suitable for both quantitative engineers and regulatory compliance auditors.
- Data schemas must specify variable types, precision standards, and update frequencies.
Output format
Provide the specification organized under these exact headers:
- Executive Summary & Architecture Overview
- Mathematical Foundations & Drift Trigger Mechanics
- Tax-Aware Optimization & Lot Selection Logic
- Order Staging, Sizing & Broker Routing Engine
- Pre-Trade Compliance & Risk Governance Matrix
- Data Dictionaries & Error-Handling Protocol Total length should be between 1,200 and 1,800 words.
Self-review
- Ensure every context variable is explicitly integrated into the architectural logic.
- Confirm pseudocode covers both drift detection and order generation paths without gaps.
- Validate that tax-loss harvesting rules strictly prevent wash-sale violations across accounts.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.