Skip to main content

Agent performance

getAgentApy

Get the agent's average APY performance over a time period.

  • If agentId is omitted: retrieves APY for all agents.
  • If agentId is provided: retrieves APY for the specified agent.

Requires wallet connection: No

getAgentApy(
options: AgentsApyOptions
): Promise<OwneyAgentApy | AgentApy>

Parameters

  • options: AgentsApyOptions — Query options:
    • days: DailyApyDays — Lookback period. (See DailyApyDays for 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 with tokenSymbol.

Returns

  • Promise<OwneyAgentApy> if agentId is omitted.
  • Promise<AgentApy> if agentId is provided.

detailedApys is optional and is only returned by agents that provide a per-asset APY breakdown.

See OwneyAgentApy and AgentApy for details.