{"uid":"cap_Kcqn5g1B9OQ9iyGhlTe5-","slug":"the-stall-portfolio-rebalance-calculator-96ef1d16","name":"The Stall — Portfolio Rebalance Calculator","description":"Pure-math portfolio rebalancing calculator. Given current holdings (asset names and their current USD values) and target allocations (percentages summing to 100), returns the exact buy/sell dollar amounts needed to reach target weights. Handles partial rebalancing with a drift threshold. No external API — deterministic and instant. Useful for DeFi agents, robo-advisory flows, and automated rebalancing triggers.","url":"https://the-stall.intuitek.ai/cap/portfolio-rebalance","method":"GET","headers":{},"bodySchema":{"type":"object","properties":{"required":{"type":"string"},"properties":{"type":"string"}}},"responseSchema":null,"example":{"request":{"targets":"BTC:0.4,ETH:0.3,USDC:0.3","holdings":"BTC:0.5,ETH:0.2,USDC:0.3"},"response":{"orders":[{"asset":"undefined","delta":null,"action":"HOLD","drift_pct":null,"target_pct":0,"current_pct":null,"target_value":null,"current_value":0,"needs_rebalance":false}],"summary":{"assets_to_buy":0,"assets_to_sell":0,"assets_in_range":1,"total_buy_volume":0,"total_sell_volume":0,"drift_threshold_pct":1},"generated_at":"2026-06-12T05:11:31.736Z","cash_injection":0,"total_portfolio_value":null}},"exampleRequest":{"targets":"BTC:0.4,ETH:0.3,USDC:0.3","holdings":"BTC:0.5,ETH:0.2,USDC:0.3"},"tags":["x402"],"displayCostAmount":"0.005","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.005/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.035","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.035","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_mLnUXhmmI17YRkEOsQP-9","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.035","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates trade adjustments needed to rebalance a portfolio to target allocations given current holdings","exampleAgentPrompt":"My current holdings are BTC=60%, ETH=25%, USDC=15% and my targets are BTC=50%, ETH=30%, USDC=20% — what trades do I need to make to rebalance?","exampleUseCases":null,"resultDescription":"Returns computed rebalancing recommendations showing which assets to buy or sell and by how much (in percentage or dollar terms) to bring the portfolio back to its target allocations, along with drift metrics per asset.","failureModes":["Malformed targets string returns 400 error","Malformed holdings string returns 400 error","Targets do not sum to 100% may cause calculation errors","Missing required parameters returns error","Payment not included or insufficient USDC returns 402"],"whenToPreferThis":"Use this endpoint when you need a quick, serverless, no-account-required computation of portfolio rebalancing trades — especially useful for crypto or multi-asset portfolios where you want to pay per-call with USDC rather than maintain a subscription. Ideal for AI agents that need to compute allocation drift and required trades on demand.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T00:48:54.431Z","isFirstParty":false}