Skip to main content

getDailyApyHistory

Get daily APY history with weighted average for a wallet over a specified period.

Signature

getDailyApyHistory(walletAddress: string, days?: '7D' | '14D' | '30D'): Promise<DailyApyHistoryResponse>

Parameters

ParameterTypeRequiredDescription
walletAddressstringSmart wallet address
days`'7D''14D''30D'`

Returns

Daily APY history with weighted averages

Return Type

// TokenApy is a record of token symbols to APY values
type TokenApy = Record<string, number>; // e.g., { "USDC": 5.05, "WETH": 1.58 }

interface ApyPosition {
apy: number;
balance: number;
chainId: number;
protocol: string;
pool: string;
strategy: string;
tokenSymbol?: string;
}

interface DailyApyEntry {
positions: ApyPosition[];
weighted_apy: TokenApy;
fee: TokenApy;
weighted_apy_after_fee: TokenApy;
rzfi_merkl_apr: TokenApy;
final_weighted_apy: TokenApy;
}

interface DailyApyHistoryResponse {
success: boolean;
walletAddress: string;
history: Record<string, DailyApyEntry>;
totalDays: number;
requestedDays?: number;
weightedApyWithRzfiAfterFee?: TokenApy;
weightedApyAfterFee?: TokenApy;
averageRzfiMerklApr?: TokenApy;
weightedApyAfterFeeByChain?: ChainTokenApy;
weightedApyWithRzfiAfterFeeByChain?: ChainTokenApy;
}

Example

const response = await sdk.getDailyApyHistory(smartWallet, period);

console.log("apy history response:", response);
console.log(" totalDays:", response.totalDays);
console.log(" weightedApyAfterFee:", response.weightedApyAfterFee);
console.log(" weightedApyWithRzfiAfterFee:", response.weightedApyWithRzfiAfterFee);
console.log(" averageRzfiMerklApr:", response.averageRzfiMerklApr);
console.log(" weightedApyAfterFeeByChain:", response.weightedApyAfterFeeByChain);
console.log(
" weightedApyWithRzfiAfterFeeByChain:",
response.weightedApyWithRzfiAfterFeeByChain
);