Python SDK for the Krystal Cloud API
Project description
krystal-cloud
Python SDK for the Krystal Cloud API.
Installation
pip install krystal-cloud
Quick Start
from krystal_cloud import KrystalCloud
client = KrystalCloud(api_key="your-api-key")
# Get supported chains
chains = client.get_chains()
# Get wallet balances
balances = client.get_balances("0xYourWallet", chain_ids=[1, 137])
# Get pools on Ethereum
pools = client.get_pools(chain_id=1, limit=10, sort_by="tvl")
# Get pool detail
pool = client.get_pool(1, "0xPoolAddress")
# Get positions
positions = client.get_positions("0xYourWallet", chain_ids=[1])
# Get strategies
strategies = client.get_strategies("0xYourWallet")
Async Usage
import asyncio
from krystal_cloud import AsyncKrystalCloud
async def main():
async with AsyncKrystalCloud(api_key="your-api-key") as client:
chains = await client.get_chains()
balances = await client.get_balances("0xYourWallet")
asyncio.run(main())
Error Handling
from krystal_cloud import KrystalCloud, AuthError, InsufficientCreditsError, KrystalAPIError
client = KrystalCloud(api_key="your-api-key")
try:
data = client.get_chains()
except AuthError:
print("Invalid API key")
except InsufficientCreditsError:
print("Need more credits")
except KrystalAPIError as e:
print(f"API error {e.status_code}: {e}")
API Methods
| Method | Description |
|---|---|
get_balances(wallet, ...) |
Wallet token balances |
get_chains() |
Supported chains |
get_chain(chain_id) |
Chain stats |
get_pools(...) |
Pool list with filters |
get_pool(chain_id, pool_address) |
Pool detail |
get_pool_historical(chain_id, pool_address) |
Pool historical data |
get_pool_ticks(chain_id, pool_address) |
Pool ticks |
get_pool_transactions(chain_id, pool_address) |
Pool transactions |
get_positions(wallet, ...) |
User positions |
get_position(chain_id, position_id) |
Position detail |
get_position_performance(chain_id, position_id) |
Position performance |
get_position_transactions(chain_id, position_id) |
Position transactions |
get_protocols() |
Supported protocols |
get_strategies(wallet, ...) |
Strategies by wallet |
get_strategy_positions(strategy_id) |
Strategy positions |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
krystal_cloud-0.1.0.tar.gz
(3.9 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 krystal_cloud-0.1.0.tar.gz.
File metadata
- Download URL: krystal_cloud-0.1.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c0f7dd2862dc326a517f5436dc913538d446b20b2fc037cd50baa66dad2c59a
|
|
| MD5 |
a74f0a1c1af7620fb975633cef6b393d
|
|
| BLAKE2b-256 |
b8aa1ffd6df5bd52bf8f9598b49511cf3998508e035a7772f94cd9e83e90b9f8
|
File details
Details for the file krystal_cloud-0.1.0-py3-none-any.whl.
File metadata
- Download URL: krystal_cloud-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31b9a20d5e63a96588a4071b150486f186c35d22df7883dd4c07ea01ead79490
|
|
| MD5 |
f63552f8440d1a1a836f90de43c4f06a
|
|
| BLAKE2b-256 |
ca03dc508bf02e3cdb149a94cba04f4353d3d6c5a9867cf75497d18a6e9ecfda
|