Preview the best yield split for an amount before anyone signs anything. Give it an amount, a token, and a chain (or several), and it comes back with the pools it would route into, the blended APY, and ready-to-run transaction calldata for each position.
This is a pure simulation: read-only, no signing, no gas. It only needs your API key, so it’s a great fit for calculators, previews, and “what would I earn” dashboards. Call it as often as you like as the user tweaks their inputs.
Amount to deploy, in human units (e.g. 3000 for 3,000 USDC), not wei.
token
string
✅
"USDC", "WETH", "EURC", "USDT", "PYUSD", "NVDAc", or "WBTC". See Supported Assets.
networks
number | number[]
✅
A chain ID, or an array of them, e.g. 8453 or [8453, 42161].
strategy
Strategy
✅
"conservative", "balanced", or "advanced". See Supported Assets.
minSplit
number
❌
Minimum number of pools to spread the amount across.
protocols
string[]
❌
Restrict candidates to these protocols, e.g. ["aave", "morpho"].
pools
string[]
❌
Restrict candidates to these exact pool names.
userPositions
UserPosition[]
❌
Positions the user already holds, so the simulation can account for them (see below).
interface UserPosition { protocol: string; pool: string; tvl: number; // the user's position size in this pool, not the pool's total TVL}
Returns
Chain-keyed simulated positions, plus calldata to actually enter each one.
Return Type
interface SimulateBestPositionsResponse { success: boolean; data: Record<string, SimulatedPosition[]>; // keyed by chain ID messages: Record<string, string>; // per-chain notes, e.g. why a chain came back empty}interface SimulatedPosition { protocol: string; pool: string; simulated_apy: number; // base APY, no rewards combined_apy: number; // Headline APY including rewards. Use this one. amount: number; // how much goes into this pool, human units amount_raw: string; // the same amount, in the token's raw decimal units tvl: number; // pool's total TVL liquidity: number; // pool's available liquidity averageCombinedApy30Days: number; // 30-day average, useful to confirm the APY isn't a spike url: string; // link to the pool calldata: SimulateCalldataItem[];}interface SimulateCalldataItem { contract_address: string; function_name: string; // e.g. "approve", "deposit" parameters: string[]; value: string; // ETH value, usually "0" description: string; // human-readable, e.g. "Approve 3000 USDC for Morpho"}
The deposit calldata contains a "<RECEIVER>" placeholder among its parameters. Swap it for the real receiving address (usually the user’s Safe / smart wallet) before you send the transaction.
Good to know
A few behaviors worth knowing before you build against this, confirmed by calling the live API directly:
userPositions is additive, not just contextual. If the user already has $1,500 in a pool and you simulate depositing $3,000 more, the returned position is sized for the combined $4,500, not $3,000. Pass it in whenever you know where the user already is.
minSplit divides the amount evenly across that many pools. minSplit: 3 on $5,000 returns three ~$1,666.67 positions, each with its own calldata.
A chain can come back empty on purpose. If every candidate pool for a chain gets excluded (unstable APY, doesn’t clear the strategy’s risk bar, etc.), that chain’s entry in data is [] and messages[chainId] explains why.
An unmatched pools filter isn’t a dead end. The call still returns success: true with an empty array for that chain, and messages[chainId] lists the pools that actually exist for that token/chain/strategy. This is handy for a “did you mean…” experience.
Works for any supported chain/token combination, with no special-casing needed for less common pairs.
await sdk.simulateBestPositions({ amount: 3000, token: "USDC", networks: 8453, strategy: "conservative", userPositions: [ { protocol: "aave", pool: "USDC", tvl: 1500 }, // the user's current position size ],});// Simulated against a $4,500 total, not $3,000.
Blended APY across a split
const positions = Object.values(result.data).flat();const total = positions.reduce((sum, p) => sum + p.amount, 0);const blendedApy = positions.reduce((sum, p) => sum + p.amount * p.combined_apy, 0) / total;
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Zyfai Documentation","description":"Self-custodial DeFi yield agents for discovering opportunities and managing positions across Ethereum, Base, and Arbitrum","colors":{"primary":"#4499e1","light":"#afcaee","dark":"#205686"},"logo":{"light":"https://mintcdn.com/zyfai/p7wzrUqxssDDJN81/img/zyfai/zyfai-full-dark.svg?fit=max\u0026auto=format\u0026n=p7wzrUqxssDDJN81\u0026q=85\u0026s=c2e6f61b4d99b91e5dd38b086976bd9a","dark":"https://mintcdn.com/zyfai/p7wzrUqxssDDJN81/img/zyfai/zyfai-full-ligth.svg?fit=max\u0026auto=format\u0026n=p7wzrUqxssDDJN81\u0026q=85\u0026s=d5f32ce149b6ac377d479a03d9ba1050","href":"https://zyf.ai"},"favicon":"https://mintcdn.com/zyfai/p7wzrUqxssDDJN81/img/zyfai/favicon-v2.png?fit=max\u0026auto=format\u0026n=p7wzrUqxssDDJN81\u0026q=85\u0026s=77777d108eb96c08f9b7c69c7e1297fb","navbar":{"links":[{"href":"https://github.com/ondefy/zyfai-sdk","label":"GitHub"},{"href":"https://www.npmjs.com/package/@zyfai/sdk","label":"npm"}]},"footer":{"socials":{"website":"https://zyf.ai","x":"https://twitter.com/zyfai_","telegram":"https://t.me/zkzyfi","github":"https://github.com/ondefy/zyfai-sdk"},"links":[{"header":"Documentation","items":[{"label":"Getting Started","href":"https://docs.zyf.ai/docs/sdk/getting-started"},{"label":"API Reference","href":"https://docs.zyf.ai/docs/sdk/api/overview"}]},{"header":"Resources","items":[{"label":"GitHub","href":"https://github.com/ondefy/zyfai-sdk"},{"label":"npm Package","href":"https://www.npmjs.com/package/@zyfai/sdk"},{"label":"Zyfai Dashboard","href":"https://sma.zyf.ai"}]}]},"seo":{"metatags":{"google-site-verification":"e8vZNYzNy4YYSqQQGSQfkgZNoQe9uVvOov3usP3S44k","algolia-site-verification":"E6611C84FEA0E2A8","og:image":"https://docs.zyf.ai/img/zyfai-ui.png"}},"integrations":{"ga4":{"measurementId":"G-1LY83MRDLW"}},"contextual":{"options":["chatgpt","claude","mcp","cursor","copy","view","download-pdf",{"title":"Request a feature","description":"Send us an e-mail","icon":"plus","href":"mailto:contact@zyf.ai"}],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"zyfai","hasAudioNarration":false,"actualSubdomain":"zyfai","customDomains":["docs.zyf.ai"],"gitSource":{"type":"github","owner":"ondefy","repo":"sdk-api-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6af389d7f34c33c6f6ce0bfc","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"default","tag":"For Developers","count":60},{"language":"default","tag":"Smart Wallet API","count":53},{"language":"default","tag":"Zyfai in Depth","count":40},{"language":"default","tag":"Fund Management","count":14},{"language":"default","tag":"User Data","count":12},{"language":"default","tag":"Building blocks","count":10},{"language":"default","tag":"Opportunities Data","count":9},{"language":"default","tag":"Ecosystem","count":8},{"language":"default","tag":"Get Started","count":7},{"language":"default","tag":"Intelligence \u0026 Strategy","count":7}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":".edgeLabel,.edgeLabel p,.edgeLabel span,.labelBkg{background-color:transparent!important}.edgeLabel rect{fill:transparent!important;opacity:0!important}"}],"page":{"pagePath":"docs/sdk/api/simulate-best-positions","slug":"/docs/sdk/api/simulate-best-positions","pageMetadata":{"title":"simulateBestPositions","description":null,"href":"/docs/sdk/api/simulate-best-positions"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Tip,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Preview the best yield split for an amount before anyone signs anything. Give it an amount, a token, and a chain (or several), and it comes back with the pools it would route into, the blended APY, and ready-to-run transaction calldata for each position.`}),`\n`,_jsx(Tip,{title:`No wallet required`,children:_jsx(_components.p,{children:`This is a pure simulation: read-only, no signing, no gas. It only needs your API key, so it’s a great fit for calculators, previews, and “what would I earn” dashboards. Call it as often as you like as the user tweaks their inputs.`})}),`\n`,_jsx(Heading,{level:`2`,id:`signature`,children:`Signature`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`1`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`simulateBestPositions(params: SimulateBestPositionsParams): Promise\u003cSimulateBestPositionsResponse>`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`parameters`,children:`Parameters`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`params`}),` is a single object:`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Field`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{style:{textAlign:`center`},children:`Required`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`amount`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`number`})}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsxs(_components.td,{children:[`Amount to deploy, in human units (e.g. `,_jsx(_components.code,{children:`3000`}),` for 3,000 USDC), not wei.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`token`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`string`})}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`\"USDC\"`}),`, `,_jsx(_components.code,{children:`\"WETH\"`}),`, `,_jsx(_components.code,{children:`\"EURC\"`}),`, `,_jsx(_components.code,{children:`\"USDT\"`}),`, `,_jsx(_components.code,{children:`\"PYUSD\"`}),`, `,_jsx(_components.code,{children:`\"NVDAc\"`}),`, or `,_jsx(_components.code,{children:`\"WBTC\"`}),`. See `,_jsx(_components.a,{href:`/docs/sdk/supported-assets`,children:`Supported Assets`}),`.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`networks`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`number | number[]`})}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsxs(_components.td,{children:[`A chain ID, or an array of them, e.g. `,_jsx(_components.code,{children:`8453`}),` or `,_jsx(_components.code,{children:`[8453, 42161]`}),`.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`strategy`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Strategy`})}),_jsx(_components.td,{style:{textAlign:`center`},children:`✅`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`\"conservative\"`}),`, `,_jsx(_components.code,{children:`\"balanced\"`}),`, or `,_jsx(_components.code,{children:`\"advanced\"`}),`. See `,_jsx(_components.a,{href:`/docs/sdk/supported-assets`,children:`Supported Assets`}),`.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`minSplit`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`number`})}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{children:`Minimum number of pools to spread the amount across.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`protocols`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`string[]`})}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsxs(_components.td,{children:[`Restrict candidates to these protocols, e.g. `,_jsx(_components.code,{children:`[\"aave\", \"morpho\"]`}),`.`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`pools`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`string[]`})}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{children:`Restrict candidates to these exact pool names.`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`userPositions`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`UserPosition[]`})}),_jsx(_components.td,{style:{textAlign:`center`},children:`❌`}),_jsx(_components.td,{children:`Positions the user already holds, so the simulation can account for them (see below).`})]})]})]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`5`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`interface`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` UserPosition {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` protocol: string;`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pool: string;`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tvl: number; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// the user's position size in this pool, not the pool's total TVL`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`returns`,children:`Returns`}),`\n`,_jsx(_components.p,{children:`Chain-keyed simulated positions, plus calldata to actually enter each one.`}),`\n`,_jsx(Heading,{level:`2`,id:`return-type`,children:`Return Type`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`27`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`27`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`interface`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SimulateBestPositionsResponse {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` success: boolean;`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` data: Record\u003cstring, SimulatedPosition[]>; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// keyed by chain ID`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` messages: Record\u003cstring, string>; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// per-chain notes, e.g. why a chain came back empty`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`interface`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SimulatedPosition {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` protocol: string;`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` pool: string;`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` simulated_apy: number; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// base APY, no rewards`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` combined_apy: number; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Headline APY including rewards. Use this one.`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` amount: number; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// how much goes into this pool, human units`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` amount_raw: string; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// the same amount, in the token's raw decimal units`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tvl: number; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// pool's total TVL`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` liquidity: number; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// pool's available liquidity`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` averageCombinedApy30Days: number; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// 30-day average, useful to confirm the APY isn't a spike`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` url: string; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// link to the pool`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` calldata: SimulateCalldataItem[];`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`interface`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` SimulateCalldataItem {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contract_address: string;`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` function_name: string; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// e.g. \"approve\", \"deposit\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` parameters: string[];`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` value: string; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// ETH value, usually \"0\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` description: string; `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// human-readable, e.g. \"Approve 3000 USDC for Morpho\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`deposit`}),` calldata contains a `,_jsx(_components.code,{children:`\"\u003cRECEIVER>\"`}),` placeholder among its `,_jsx(_components.code,{children:`parameters`}),`. Swap it for the real receiving address (usually the user’s Safe / smart wallet) before you send the transaction.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`good-to-know`,children:`Good to know`}),`\n`,_jsx(_components.p,{children:`A few behaviors worth knowing before you build against this, confirmed by calling the live API directly:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`userPositions`}),` is additive, not just contextual.`]}),` If the user already has `,`$1,500 in a pool and you simulate depositing $`,`3,000 more, the returned position is sized for the `,_jsx(_components.strong,{children:`combined`}),` `,`$4,500, not $`,`3,000. Pass it in whenever you know where the user already is.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`minSplit`}),` divides the amount evenly`]}),` across that many pools. `,_jsx(_components.code,{children:`minSplit: 3`}),` on `,`$5,000 returns three ~$`,`1,666.67 positions, each with its own `,_jsx(_components.code,{children:`calldata`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`A chain can come back empty on purpose.`}),` If every candidate pool for a chain gets excluded (unstable APY, doesn’t clear the strategy’s risk bar, etc.), that chain’s entry in `,_jsx(_components.code,{children:`data`}),` is `,_jsx(_components.code,{children:`[]`}),` and `,_jsx(_components.code,{children:`messages[chainId]`}),` explains why.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[`An unmatched `,_jsx(_components.code,{children:`pools`}),` filter isn’t a dead end.`]}),` The call still returns `,_jsx(_components.code,{children:`success: true`}),` with an empty array for that chain, and `,_jsx(_components.code,{children:`messages[chainId]`}),` lists the pools that actually exist for that token/chain/strategy. This is handy for a “did you mean…” experience.`]}),`\n`,_jsx(_components.li,{children:`Works for any supported chain/token combination, with no special-casing needed for less common pairs.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`examples`,children:`Examples`}),`\n`,_jsx(Heading,{level:`3`,id:`simplest-call`,children:`Simplest call`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`9`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` result = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sdk.simulateBestPositions({`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` amount: 3000,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` token: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"USDC\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` networks: 8453,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` strategy: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"conservative\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`console.log(result.data[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"8453\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// [{ protocol: \"Morpho\", pool: \"Gauntlet USDC Prime\", combined_apy: 4.15, ... }]`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`multiple-chains-with-a-minimum-split`,children:`Multiple chains, with a minimum split`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` result = `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sdk.simulateBestPositions({`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` amount: 5000,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` token: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"USDC\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` networks: [8453, 42161],`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` strategy: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"conservative\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` minSplit: 3,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` positions = Object.values(result.data).flat();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`console.log(positions.map((p) => `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`${p.protocol}/${p.pool}: $${p.amount}`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`));`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`accounting-for-an-existing-position`,children:`Accounting for an existing position`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sdk.simulateBestPositions({`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` amount: 3000,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` token: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"USDC\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` networks: 8453,`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` strategy: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"conservative\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` userPositions: [`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { protocol: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"aave\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, pool: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"USDC\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, tvl: 1500 }, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// the user's current position size`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ],`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Simulated against a $4,500 total, not $3,000.`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`blended-apy-across-a-split`,children:`Blended APY across a split`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` positions = Object.values(result.data).flat();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` total = positions.reduce((sum, p) => sum + p.amount, 0);`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` blendedApy =`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` positions.reduce((sum, p) => sum + p.amount * p.combined_apy, 0) / total;`})}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"simulateBestPositions","description":null,"href":"/docs/sdk/api/simulate-best-positions"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Signature","slug":"signature","depth":2,"children":[]},{"title":"Parameters","slug":"parameters","depth":2,"children":[]},{"title":"Returns","slug":"returns","depth":2,"children":[]},{"title":"Return Type","slug":"return-type","depth":2,"children":[]},{"title":"Good to know","slug":"good-to-know","depth":2,"children":[]},{"title":"Examples","slug":"examples","depth":2,"children":[{"title":"Simplest call","slug":"simplest-call","depth":3,"children":[]},{"title":"Multiple chains, with a minimum split","slug":"multiple-chains-with-a-minimum-split","depth":3,"children":[]},{"title":"Accounting for an existing position","slug":"accounting-for-an-existing-position","depth":3,"children":[]},{"title":"Blended APY across a split","slug":"blended-apy-across-a-split","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":[],"subdomain":"zyfai","siteName":"Zyfai Documentation","title":"simulateBestPositions - Zyfai Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-10T21:14:45.686Z","originalFileLocation":"docs/sdk/api/simulate-best-positions.md"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Zyfai Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/zyfai/r0XB7EX-04rMcfaF/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/zyfai/r0XB7EX-04rMcfaF/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/zyfai/r0XB7EX-04rMcfaF/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/zyfai/r0XB7EX-04rMcfaF/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/zyfai/r0XB7EX-04rMcfaF/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/zyfai/r0XB7EX-04rMcfaF/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/zyfai/r0XB7EX-04rMcfaF/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/zyfai/r0XB7EX-04rMcfaF/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/zyfai/r0XB7EX-04rMcfaF/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"simulateBestPositions - Zyfai Documentation\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Zyfai Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.zyf.ai/docs/sdk/api/simulate-best-positions\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://docs.zyf.ai/img/zyfai-ui.png\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"simulateBestPositions - Zyfai Documentation\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://docs.zyf.ai/img/zyfai-ui.png\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/zyfai/r0XB7EX-04rMcfaF/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Zyfai Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#4499e1\">\u003cmeta data-mint-head name=\"google-site-verification\" content=\"e8vZNYzNy4YYSqQQGSQfkgZNoQe9uVvOov3usP3S44k\">\u003cmeta data-mint-head name=\"algolia-site-verification\" content=\"E6611C84FEA0E2A8\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.zyf.ai/docs/sdk/api/simulate-best-positions\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/sdk/api/simulate-best-positions.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.zyf.ai/#organization\",\"name\":\"Zyfai Documentation\",\"url\":\"https://docs.zyf.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/zyfai/p7wzrUqxssDDJN81/img/zyfai/zyfai-full-dark.svg?fit=max\u0026auto=format\u0026n=p7wzrUqxssDDJN81\u0026q=85\u0026s=c2e6f61b4d99b91e5dd38b086976bd9a\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.zyf.ai#website\",\"name\":\"Zyfai Documentation\",\"url\":\"https://docs.zyf.ai\",\"publisher\":{\"@id\":\"https://docs.zyf.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.zyf.ai/docs/sdk/api/simulate-best-positions#webpage\",\"url\":\"https://docs.zyf.ai/docs/sdk/api/simulate-best-positions\",\"name\":\"simulateBestPositions\",\"dateModified\":\"2026-11-10T21:14:45.686Z\",\"isPartOf\":{\"@id\":\"https://docs.zyf.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.zyf.ai/docs/sdk/api/simulate-best-positions#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.zyf.ai/docs/sdk/api/simulate-best-positions#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Intelligence Layer\",\"item\":\"https://docs.zyf.ai/docs/sdk/intelligence-layer\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"simulateBestPositions\",\"item\":\"https://docs.zyf.ai/docs/sdk/api/simulate-best-positions\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.zyf.ai/docs/sdk/api/simulate-best-positions#article\",\"headline\":\"simulateBestPositions\",\"name\":\"simulateBestPositions\",\"url\":\"https://docs.zyf.ai/docs/sdk/api/simulate-best-positions\",\"mainEntityOfPage\":{\"@id\":\"https://docs.zyf.ai/docs/sdk/api/simulate-best-positions#webpage\"},\"image\":\"https://docs.zyf.ai/img/zyfai-ui.png\",\"dateModified\":\"2026-11-10T21:14:45.686Z\",\"publisher\":{\"@id\":\"https://docs.zyf.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.zyf.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Zyfai Documentation\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Zyfai Documentation\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/docs/sdk/api/simulate-best-positions.md","siteName":"Zyfai Documentation","nav":{"global":null,"tabs":[{"tab":"Start Here","pages":[{"title":"Start Here","href":"/docs/product/depositors/start"}]},{"tab":"Use with AI","pages":[{"title":"Use with AI","href":"/docs/sdk/mcp-server"}]},{"tab":"Zyfai in Depth","pages":[{"title":"Zyfai in Depth","href":"/docs/product/overview/introduction"}]},{"tab":"For Developers","groups":[{"group":"Getting Started","pages":[{"title":"Getting Started","href":"/docs/sdk/getting-started"},{"title":"Supported Assets","href":"/docs/sdk/supported-assets"},{"title":"Agent Quickstart","href":"/docs/sdk/agent-quickstart"},{"title":"Technical Reference","href":"/docs/sdk/technical-reference"}]},{"group":"Smart Wallet API","pages":[{"title":"API Reference Overview","href":"/docs/sdk/api/overview"},{"group":"Account Management","pages":[{"title":"connectAccount","href":"/docs/sdk/api/connect-account"},{"title":"disconnectAccount","href":"/docs/sdk/api/disconnect-account"}]},{"group":"Smart Wallet","pages":[{"title":"getSmartWalletAddress","href":"/docs/sdk/api/get-smart-wallet-address"},{"title":"pauseAgent","href":"/docs/sdk/api/pause-agent"},{"title":"resumeAgent","href":"/docs/sdk/api/resume-agent"}]},{"group":"Fund Management","pages":[{"group":"Core","pages":[{"title":"sendDeposit","href":"/docs/sdk/api/send-deposit"},{"title":"waitForDepositPosition","href":"/docs/sdk/api/wait-for-deposit-position"},{"title":"withdrawFunds","href":"/docs/sdk/api/withdraw-funds"},{"title":"waitForWithdrawSettlement","href":"/docs/sdk/api/wait-for-withdraw-settlement"}]},{"group":"Building blocks","pages":[{"title":"sendDirectDeposit","href":"/docs/sdk/api/send-direct-deposit"},{"title":"sendSwapDeposit","href":"/docs/sdk/api/send-swap-deposit"},{"title":"waitForDepositCredit","href":"/docs/sdk/api/wait-for-deposit-credit"},{"title":"getDepositStatus","href":"/docs/sdk/api/get-deposit-status"},{"title":"External deposit building blocks","href":"/docs/sdk/api/external-deposit-building-blocks"},{"title":"logDeposit","href":"/docs/sdk/api/log-deposit"},{"title":"depositFunds (compatibility)","href":"/docs/sdk/api/deposit-funds"},{"title":"getWithdrawStatus","href":"/docs/sdk/api/get-withdraw-status"},{"title":"waitForWithdrawComplete","href":"/docs/sdk/api/wait-for-withdraw-complete"},{"title":"Claim rZFI","href":"/docs/sdk/api/claim-rzfi"}]}]},{"group":"User Data","pages":[{"title":"getPositions","href":"/docs/sdk/api/get-positions"},{"title":"getPortfolio","href":"/docs/sdk/api/get-portfolio"},{"title":"getUserDetails","href":"/docs/sdk/api/get-user-details"},{"title":"updateUserProfile","href":"/docs/sdk/api/update-user-details"},{"title":"setAssetStrategy","href":"/docs/sdk/api/set-asset-strategy"},{"title":"getHistory","href":"/docs/sdk/api/get-history"},{"title":"customizeBatch","href":"/docs/sdk/api/customize-batch"},{"title":"enableSplitting","href":"/docs/sdk/api/enable-splitting"},{"title":"disableSplitting","href":"/docs/sdk/api/disable-splitting"},{"title":"updateMinSplits","href":"/docs/sdk/api/update-min-splits"},{"title":"getFirstTopup","href":"/docs/sdk/api/get-first-topup"},{"title":"getSmartWalletByEOA","href":"/docs/sdk/api/get-smart-wallet-by-eoa"}]},{"group":"Opportunities Data","pages":[{"title":"getApyPerStrategy","href":"/docs/sdk/api/get-apy-per-strategy"},{"title":"Get Base Merkl campaigns","href":"/docs/sdk/api/get-base-merkl-campaigns"},{"title":"getConservativeOpportunities","href":"/docs/sdk/api/get-conservative-opportunities"},{"title":"getAggressiveOpportunities","href":"/docs/sdk/api/get-aggressive-opportunities"},{"title":"getAsyncOpportunities","href":"/docs/sdk/api/get-async-opportunities"},{"title":"getActiveAggressiveOppsRisk","href":"/docs/sdk/api/getActiveAggressiveOppsRisk"},{"title":"getActiveConservativeOppsRisk","href":"/docs/sdk/api/getActiveConservativeOppsRisk"},{"title":"getAggressivePoolStatus","href":"/docs/sdk/api/getAggressivePoolStatus"},{"title":"getConservativePoolStatus","href":"/docs/sdk/api/getConservativePoolStatus"}]},{"group":"Earnings \u0026 Performance","pages":[{"title":"calculateOnchainEarnings","href":"/docs/sdk/api/calculate-onchain-earnings"},{"title":"getOnchainEarnings","href":"/docs/sdk/api/get-onchain-earnings"},{"title":"getDailyApyHistory","href":"/docs/sdk/api/get-daily-apy-history"},{"title":"getDailyEarnings","href":"/docs/sdk/api/get-daily-earnings"}]},{"group":"Protocol Data","pages":[{"title":"getAvailableProtocols","href":"/docs/sdk/api/get-available-protocols"}]},{"group":"Analytics \u0026 Metrics","pages":[{"title":"getTVL","href":"/docs/sdk/api/get-tvl"},{"title":"getVolume","href":"/docs/sdk/api/get-volume"},{"title":"getActiveWallets","href":"/docs/sdk/api/get-active-wallets"}]},{"group":"SDK Key Information","pages":[{"title":"getSdkAllowedWallets","href":"/docs/sdk/api/get-sdk-allowed-wallets"},{"title":"getSdkKeyTVL","href":"/docs/sdk/api/get-sdk-key-tvl"}]},{"group":"Rebalancing","pages":[{"title":"getRebalanceFrequency","href":"/docs/sdk/api/get-rebalance-frequency"}]},{"group":"ERC-8004","pages":[{"title":"registerAgentOnIdentityRegistry","href":"/docs/sdk/api/register-agent-on-identity-registry"}]}]},{"group":"Intelligence Layer","pages":[{"title":"Overview","description":null,"href":"/docs/sdk/intelligence-layer"},{"title":"simulateBestPositions","href":"/docs/sdk/api/simulate-best-positions"},{"title":"subscribeToEvents","description":null,"href":"/docs/sdk/api/subscribe-to-events"}]}]}]},"basePath":"","title":"simulateBestPositions - Zyfai Documentation","buildId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","deploymentId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","dynamics":[],"chunks":[]}