{"uid":"cap_I2gMFG1RAXtCCOnMFdIvo","slug":"saylor-innovations-crypto-portfolio-rebalancer-c36e4c27","name":"Saylor Innovations Crypto Portfolio Rebalancer","description":"Buy and sell amounts that bring a crypto portfolio to target weights, with optional new cash, drift band and fees, plus turnover and the biggest drift.","url":"https://saylorinnovations.com/api/crypto/rebalance?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","queryParams"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET","POST","PUT","PATCH","DELETE","HEAD"],"type":"string"},"queryParams":{"type":"object","required":["holdings","target_weights"],"properties":{"holdings":{"type":"string","description":"current values as SYMBOL:usd pairs, e.g. BTC:6000,ETH:3000"},"fee_percent":{"type":"string","description":"optional trading fee"},"new_cash_usd":{"type":"string","description":"optional cash to add (negative to withdraw)"},"target_weights":{"type":"string","description":"target percentages that add up to 100, e.g. BTC:50,ETH:30,SOL:20"},"drift_band_percent":{"type":"string","description":"optional, leave assets within this many points of target alone"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string","const":"json"},"example":{"type":"object","required":["assets","total_to_buy_usd"],"properties":{"note":{"type":"string","description":"Plain-language caveat about how to read and use the result"},"assets":{"type":"array","items":{"type":"object","properties":{"action":{"description":"buy, sell or hold"},"symbol":{"description":"Asset symbol"},"trade_usd":{"description":"Amount to trade (negative means sell)"},"target_usd":{"description":"Target value"},"current_usd":{"description":"Current value"},"drift_percent_points":{"description":"Target weight minus current weight"},"target_weight_percent":{"description":"Target share"},"current_weight_percent":{"description":"Current share of the portfolio"}}},"description":"Per-asset current state and trade"},"source":{"type":"string","description":"Where the data or formula comes from"},"new_cash_usd":{"type":"number","description":"Cash added or withdrawn"},"total_value_usd":{"type":"number","description":"Portfolio value including new cash"},"total_to_buy_usd":{"type":"number","description":"Sum of buys"},"turnover_percent":{"type":"number","description":"Share of the portfolio traded"},"total_to_sell_usd":{"type":"number","description":"Sum of sells"},"drift_band_percent":{"type":"number","description":"Drift tolerance used"},"estimated_fees_usd":{"type":"number","description":"Fees on all trades at the given rate"},"largest_drift_asset":{"type":"string","description":"Symbol furthest from its target"}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","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.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_u_A08wvdfh9Jr_Xey9DM2","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates buy/sell trade amounts to bring a crypto portfolio to target allocation weights, accounting for optional new cash, drift bands, and fees.","exampleAgentPrompt":"I have BTC worth $6000 and ETH worth $3000 in my portfolio — can you calculate exactly how much of each I need to buy or sell to hit a 60% BTC and 40% ETH target, and include $1000 of new cash I'm adding?","exampleUseCases":[{"title":"Rebalancing after market drift","prompt":"My crypto portfolio has drifted — I have $8000 in BTC, $1500 in ETH, and $500 in SOL. Can you figure out the trades I need to make to get back to my targets of 50% BTC, 30% ETH, and 20% SOL?"},{"title":"Deploying new cash into existing portfolio","prompt":"I want to add $5000 to my crypto portfolio which currently holds BTC:$10000, ETH:$4000, and SOL:$1000. Calculate how to deploy that cash so I end up at 60% BTC, 25% ETH, and 15% SOL."},{"title":"Checking portfolio drift before deciding to trade","prompt":"Can you tell me how far my crypto holdings have drifted from my targets? I hold BTC:$12000, ETH:$5000, MATIC:$3000 and my targets are 50% BTC, 35% ETH, 15% MATIC — show me the drift and what trades would fix it."}],"resultDescription":"Returns a JSON object with a per-asset breakdown (symbol, current USD value, target USD value, trade action, trade amount in USD, current weight, target weight, drift in percentage points), plus portfolio-level figures: total value, new cash added, total turnover, and the asset with the biggest drift. Includes a plain-language note explaining how to interpret the results.","failureModes":["Missing required 'holdings' parameter returns an error","Missing required 'target_weights' parameter returns an error","Target weights that don't sum to 100 may produce incorrect or error results","Malformed symbol:value pairs (wrong delimiter or format) cause parse errors","Negative new_cash_usd exceeding portfolio value may yield nonsensical results"],"whenToPreferThis":"Choose this endpoint when you need a fast, deterministic calculation of crypto rebalancing trades — especially when you want per-asset buy/sell amounts, drift analysis, and turnover computed in one call without executing any actual trades. Prefer it over general financial APIs when you specifically need crypto portfolio weight normalization with optional cash injection.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-30T00:38:20.948Z","isFirstParty":false,"canonicalSlug":"saylor-innovations-crypto-portfolio-rebalancer-c36e4c27"}