A Python SDK for interacting with the Vaults.fyi API. This package provides feature-equivalent functionality to the JavaScript SDK with Pythonic naming conventions.
pip install vaultsfyi
from vaultsfyi import VaultsSdk
# Initialize the SDK
client = VaultsSdk(api_key="your_api_key_here")
# Get user's idle assets
idle_assets = client.get_idle_assets("0x742d35Cc6543C001")
# Get best deposit options (filtered for USDC/USDS)
deposit_options = client.get_deposit_options(
"0x742d35Cc6543C001",
allowed_assets=["USDC", "USDS"]
)
# Get user positions
positions = client.get_positions("0x742d35Cc6543C001")
# Generate deposit transaction
transaction = client.get_actions(
action="deposit",
user_address="0x742d35Cc6543C001",
network="mainnet",
vault_address="0x...",
amount="1000000",
asset_address="0x...",
simulate=False
)
Get API health status.
health = client.get_health()
# Returns: {'status': 'Success', 'message': 'Application is healthy'}
Get list of supported blockchain networks.
networks = client.get_networks()
# Returns list of networks with chainId and networkCaip
Get list of vault categorization tags.
tags = client.get_tags()
# Returns list of tags like ['Bridge', 'CDP', 'Liquid Staking', 'RWA', ...]
Get list of supported assets.
assets = client.get_assets(
page=0,
per_page=50,
network='mainnet'
)
Get basic list of vaults with simple filtering.
vaults = client.get_vaults(
page=0,
per_page=20,
network='mainnet',
asset_symbol='USDC',
only_transactional=True,
only_app_featured=False
)
Get information about all available vaults.
vaults = client.get_all_vaults(
page=0,
perPage=100,
allowedNetworks=['mainnet', 'polygon'],
allowedProtocols=['aave', 'compound'],
allowedAssets=['USDC', 'USDT'],
minTvl=1000000,
maxTvl=100000000,
onlyTransactional=True,
onlyAppFeatured=False
)
Get detailed information about a specific vault.
vault = client.get_vault(
network='mainnet',
vault_address='0x1234...'
)
Get APY breakdown for a specific vault.
apy_breakdown = client.get_vault_apy_breakdown(
network='mainnet',
vault_address='0x1234...'
)
Get TVL breakdown for a specific vault.
tvl_breakdown = client.get_vault_tvl_breakdown(
network='mainnet',
vault_address='0x1234...'
)
Get historical APY and TVL data for a vault.
historical_data = client.get_vault_historical_data(
network='mainnet',
vault_address='0x1234...',
page=0,
perPage=100,
apyInterval='30day',
fromTimestamp=1640995200,
toTimestamp=1672531200
)
Get historical APY data for a specific vault.
historical_apy = client.get_vault_historical_apy(
network='mainnet',
vault_address='0x1234...',
page=0,
perPage=100
)
Get historical TVL data for a specific vault.
historical_tvl = client.get_vault_historical_tvl(
network='mainnet',
vault_address='0x1234...',
page=0,
perPage=100
)
Get historical share price data for a specific vault.
historical_price = client.get_vault_historical_share_price(
network='mainnet',
vault_address='0x1234...',
page=0,
perPage=100
)
Get all positions for a user address.
positions = client.get_positions(
user_address='0x1234...',
allowedNetworks=['mainnet', 'polygon']
)
Get a specific position for a user in a vault.
position = client.get_position(
user_address='0x1234...',
network='mainnet',
vault_address='0x5678...'
)
Get the best vault opportunity for a user.
best_vault = client.get_best_vault(
user_address='0x1234...'
)
Get the best deposit options for a user.
options = client.get_deposit_options(
user_address='0x1234...',
allowed_assets=['USDC', 'USDT'],
allowedNetworks=['mainnet', 'polygon'],
allowedProtocols=['aave', 'compound'],
minTvl=1000000,
minApy=0.05,
minUsdAssetValueThreshold=1000,
onlyTransactional=True,
onlyAppFeatured=False,
apyInterval='7day',
alwaysReturnAssets=['USDC'],
maxVaultsPerAsset=5
)
Get idle assets in a user's wallet that could be earning yield.
idle_assets = client.get_idle_assets(
user_address='0x1234...'
)
Get total returns for a specific user and vault.
returns = client.get_vault_total_returns(
user_address='0x1234...',
network='mainnet',
vault_address='0x5678...'
)
Get events (deposits, withdrawals) for a specific user and vault.
events = client.get_vault_holder_events(
user_address='0x1234...',
network='mainnet',
vault_address='0x5678...'
)
Get transaction context for a specific vault interaction.
context = client.get_transactions_context(
user_address='0x1234...',
network='mainnet',
vault_address='0x5678...'
)
Get available actions (deposit, withdraw, etc.) for a vault.
actions = client.get_actions(
action='deposit',
user_address='0x1234...',
network='mainnet',
vault_address='0x5678...',
amount='1000000000',
asset_address='0xA0b86a33E6b2e7d8bB9bdB1c23f6fD7b52b5c8e2',
simulate=False
)
Get rewards context for a user.
rewards_context = client.get_rewards_context(
user_address='0x1234...'
)
Get rewards claim transaction data for a user.
# Note: claimIds parameter is required by the API
rewards_claim = client.get_rewards_claim(
user_address='0x1234...',
claimIds=['claim1', 'claim2']
)
Get benchmark APY data for a specific network and benchmark code.
# Get USD benchmark for mainnet
usd_benchmark = client.get_benchmarks('mainnet', 'usd')
# Get ETH benchmark for mainnet
eth_benchmark = client.get_benchmarks('mainnet', 'eth')
Get historical benchmark APY data with pagination and filtering.
# Get historical USD benchmarks with basic pagination
historical = client.get_historical_benchmarks(
network='mainnet',
code='usd',
page=0,
per_page=100
)
# Get historical ETH benchmarks with timestamp filtering
historical_filtered = client.get_historical_benchmarks(
network='mainnet',
code='eth',
from_timestamp=1640995200,
to_timestamp=1672531200,
page=0,
per_page=50
)
Available benchmark codes:
'usd'
- USD benchmark rate (includes Aave v3 USDC/USDT, sDAI, Compound v3 USDC)'eth'
- ETH benchmark rate (includes Lido stETH, ether.fi eETH, Coinbase cbETH, Rocket Pool rETH)
The SDK provides specific exception types:
from vaultsfyi import VaultsSdk, HttpResponseError, AuthenticationError
try:
client = VaultsSdk(api_key="invalid_key")
result = client.get_benchmarks()
except AuthenticationError:
print("Invalid API key")
except HttpResponseError as e:
print(f"API error: {e}")
- Python 3.8+
- requests
MIT License