A Python SDK for interacting with the Vaults.fyi API
Project description
Vaults.fyi Python SDK
A Python SDK for interacting with the Vaults.fyi API. This package provides feature-equivalent functionality to the JavaScript SDK with Pythonic naming conventions.
Installation
pip install vaultsfyi
Quick Start
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
)
API Methods
Portfolio Methods
get_positions(user_address, **kwargs)- Get all user positionsget_deposit_options(user_address, allowed_assets=None, **kwargs)- Get best deposit optionsget_idle_assets(user_address, **kwargs)- Get user's idle/available balancesget_vault_holder_events(user_address, network, vault_address, **kwargs)- Get vault eventsget_vault_total_returns(user_address, network, vault_address, **kwargs)- Get total returns
Vault Methods
get_all_vaults(**kwargs)- Get all available vaultsget_vault(network, vault_address, **kwargs)- Get specific vault detailsget_vault_historical_data(network, vault_address, **kwargs)- Get historical data
Transaction Methods
get_actions(action, user_address, network, vault_address, **kwargs)- Generate transactionsget_transactions_context(user_address, network, vault_address, **kwargs)- Get transaction context
Other Methods
get_benchmarks()- Get benchmark data
Error Handling
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}")
Requirements
- Python 3.8+
- requests
License
MIT License
Author
Kaimi Seeker (kaimi@wallfacer.io)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
vaultsfyi-1.0.1.tar.gz
(9.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vaultsfyi-1.0.1.tar.gz.
File metadata
- Download URL: vaultsfyi-1.0.1.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b25dec7ef9755e9b940dd32fbb9232e139f19f673dead681f5191ec647e2c0a
|
|
| MD5 |
e3116426ab10c1bc78a22ee79ea9bccf
|
|
| BLAKE2b-256 |
191469ec9f10f42e0c4fc41fc5788e7768cde6c11b9f10ab1f9dae146192a08b
|
File details
Details for the file vaultsfyi-1.0.1-py3-none-any.whl.
File metadata
- Download URL: vaultsfyi-1.0.1-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72836831093ca0050ae78ac4127df8142575f31b949d016bef008c2c2cc3fc48
|
|
| MD5 |
161e147d3e998c6fe11cc4eb150f1c3d
|
|
| BLAKE2b-256 |
72a3d665ae9fbf1c658f099bcee25a8fdc36fac72f421cb281d0170f69d3bbc2
|