> ## Documentation Index
> Fetch the complete documentation index at: https://zyfai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# getApyPerStrategy

Get global APY by strategy, by number of days and for a specific chain.

Net-of-fee fields apply the Zyfi 10% performance fee (`× 0.9`). Gross `average_apy` / `average_apy_with_rzfi` are unchanged.

<Warning title="Breaking change in @zyfai/sdk 0.2.51">
  `average_apy_with_fee` / `average_apy_with_rzfi_with_fee` (and `*_without_fee`) were renamed to **`average_apy_withFee`** / **`average_apy_with_rzfi_withFee`**.
</Warning>

<Tip title="User-facing display">
  Show `average_apy_withFee` / `average_apy_with_rzfi_withFee` as the primary numbers in your product UI. Gross fields remain available for debugging or advanced transparency.
</Tip>

## Signature

```typescript theme={null}
getAPYPerStrategy(
  crossChain?: boolean,
  days?: number,
  strategy?: "conservative" | "aggressive",
  chainId?: number,
  tokenSymbol?: "USDC" | "WETH" | "EURC"
): Promise<APYPerStrategyResponse>
```

## Parameters

| Parameter     | Type      | Required | Description                                                                                                                                                                                   |
| ------------- | --------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `crossChain`  | `boolean` | ❌        | If `true`, returns APY for cross-chain strategies; if `false`, single-chain (default: `false`)                                                                                                |
| `days`        | `number`  | ❌        | APY window in days. Precomputed values: `7`, `30`, `60`, `90`, `120`, `150`, `180`, `210`, `240`, `270` (default: `7`, max: `270`). Other positive values are accepted but return empty data. |
| `strategy`    | `string`  | ❌        | Strategy risk profile: `"conservative"` or `"aggressive"` (default: `"conservative"`)                                                                                                         |
| `chainId`     | `number`  | ❌        | Filter by specific chain ID (e.g., `8453` for Base)                                                                                                                                           |
| `tokenSymbol` | `string`  | ❌        | Filter by token: `"USDC"`, `"WETH"`, or `"EURC"`                                                                                                                                              |

## Returns

Global APY by strategy, for the given time period and strategy configuration.

## Return Type

```typescript theme={null}
interface APYPerStrategyResponse {
  success: boolean;
  count: number;
  data: APYPerStrategy[];
}

interface APYPerStrategy {
  id: string;
  timestamp: string;
  amount: number;
  fee_threshold: number;
  days: number;
  chain_id: number;
  is_cross_chain: boolean;
  average_apy: number;
  average_apy_with_rzfi: number;
  total_rebalances: number;
  created_at: string;
  strategy: string;
  token_symbol?: string;
  average_apy_withFee: number;
  average_apy_with_rzfi_withFee: number;
  events_average_apy?: Record<string, number>;
  events_average_apy_withFee?: Record<string, number>;
  events_average_apy_with_rzfi_withFee?: Record<string, number>;
}
```

## Example

```typescript theme={null}
// Get 7-day conservative APY for USDC
const usdcApy = await sdk.getAPYPerStrategy(false, 7, "conservative", undefined, "USDC");
console.log("USDC APY:", usdcApy.data);

// Get 30-day aggressive APY for WETH on Base
const wethApy = await sdk.getAPYPerStrategy(false, 30, "aggressive", 8453, "WETH");
console.log("WETH APY on Base:", wethApy.data);

// Get 7-day APY for EURC on Base
const eurcApy = await sdk.getAPYPerStrategy(false, 7, "conservative", 8453, "EURC");
console.log("EURC APY:", eurcApy.data);

// Compare strategies
const conservative = await sdk.getAPYPerStrategy(false, 30, "conservative");
const aggressive = await sdk.getAPYPerStrategy(false, 30, "aggressive");
console.log("Conservative 30d APY:", conservative.data[0]?.average_apy_withFee);
console.log("Aggressive 30d APY:", aggressive.data[0]?.average_apy_withFee);
```
