Agent performance
getAgentApy
Get the agent's average APY performance over a time period.
- If
agentIdis omitted: retrieves APY for all agents. - If
agentIdis provided: retrieves APY for the specified agent.
Requires wallet connection: No
- Signature
- Example
- Example Output
getAgentApy(
options: AgentsApyOptions
): Promise<OwneyAgentApy | AgentApy>
const allApy = await owney.getAgentApy({ days: "30D" });
// Per-asset APY (Zyfai-aware; Sail currently returns its aggregate)
const usdcBaseApy = await owney.getAgentApy({
days: "30D",
tokenSymbol: "USDC",
chainId: 8453,
});
{
"agentApy": {
"zyfai": {
"averageApy": 8.5
},
"sail": {
"averageApy": 6.2,
"detailedApys": {
"apyPerAsset": {
"8453": {
"USDC": 6.5
},
"42161": {
"USDT": 5.9
}
}
}
}
}
}
Parameters
options: AgentsApyOptions— Query options:days: DailyApyDays— Lookback period. (SeeDailyApyDaysfor details).agentId?: AgentId— Optional agent to query. If omitted, retrieves APY for all agents.tokenSymbol?: string— Optional asset symbol (e.g."USDC","WETH") to scope the APY to a specific asset. Zyfai uses this; agents whose backends do not yet support per-asset APY (currently Sail) ignore it.chainId?: number— Optional chain id for per-asset APY lookups. Typically paired withtokenSymbol.
Returns
Promise<OwneyAgentApy>ifagentIdis omitted.Promise<AgentApy>ifagentIdis provided.
detailedApys is optional and is only returned by agents that provide a per-asset APY breakdown.
See OwneyAgentApy and AgentApy for details.