Portfolio rebalance with risk limits
Understand a Portfolio pattern that filters an asset universe, calculates target weights, applies constraints, and rebalances.
Advanced Portfolio · Step 2 of 2
This example shows a composition pattern. It does not define a recommended universe, ranking model, or allocation.
Start with the working Starter
For a first Portfolio graph, create a strategy in Portfolio mode and select EUR/USD + BTC/USD Equal Weight from Starters. This creates a separate copy and uses a strategy slot.
Inspect its four nodes: Schedule Trigger runs weekly on Monday at the configured market-open anchor; Universe contains EURUSD and BTCUSD; Weight Calculator uses equal weights and a 100% allocation budget; Rebalancer receives those target weights. Check the strategy timezone and market-hours settings before interpreting the schedule.
Control goes from Schedule Trigger Fired to Rebalancer. Data goes from Universe to Weight Calculator, then Weights to Rebalancer Target Weights. The two data nodes do not need control connections. Save, exit and reopen to verify the graph. Run a Backtest only after reviewing its dates, costs and plan allowance.
The structure below is an advanced extension pattern, not a ready-to-submit template. Ranking, scoring and constraints require their own compatible inputs, parameters and plan access. Do not expect a Quant Hub node to appear merely because you can view a standalone metric.
Calculate the Starter's target before adding complexity
With two eligible assets, equal_weight and a full allocation budget, Weight Calculator produces a target of 50% for each asset. The Inspector presents the budget as 100%; the graph contract stores the equivalent fraction 1. If you change the UI budget to 80%, the corresponding fraction is 0.8, so equal allocation across two assets is 40% each and the remaining 20% is not allocated by this calculation. Check the resulting output rather than reading 0.8 as 0.8%.
For arithmetic only, suppose portfolio value is 10,000 units of account currency and current weights are 70% and 30%. The 50/50 target represents 5,000 in each asset versus 7,000 and 3,000 currently: a nominal shift of 2,000 away from the first asset and toward the second. Rebalancer must still evaluate prices, minimum sizes, tolerance, costs and constraints. These numbers are not an observed execution or a promise that exactly two orders will occur. If the portfolio is already within tolerance, a no change outcome can be correct.
Add one rule at a time. For instance, a maximum weight per asset of 40% conflicts with a two-asset full-budget 50/50 target. Do not assume a guard automatically converts 50/50 to another allocation; inspect its role and the Rebalancer's constraint outcome. A third eligible asset or different budget may be needed, but the actual choice depends on the intended strategy and supported data.
Goal
On a schedule, create an eligible universe, rank or score its assets, calculate target weights, enforce portfolio and leverage limits, then produce a rebalance result.
Suggested structure
- Schedule Trigger starts the graph and provides period information.
- Universe defines the candidate symbols.
- Screen Filter removes candidates that fail supported rules.
- Ranking selects assets from connected scores, or Composite Score combines several rankings first.
- Weight Calculator converts the selected universe into target weights.
- Portfolio Constraint supplies constraints as data by default; its guard role is used for explicit control outcomes.
- Leverage Constraint checks or adjusts weights when available.
- Rebalancer compares target weights with the current portfolio and produces a result.
Use the respective Field nodes to extract scalar details from period, leverage, or rebalance outputs.
Handle outcomes
Connect completed, constraint-violation, empty-universe, and no-change outcomes intentionally. A no-change outcome can be a valid result and should not automatically be treated as an error.
Verify
Confirm that all weights and constraints use compatible data. Resolve validation, save, and review Backtest assumptions before submission.