Skip to main content

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=1)

# 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


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.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

krystal_cloud-0.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file krystal_cloud-0.1.1.tar.gz.

File metadata

  • Download URL: krystal_cloud-0.1.1.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

Hashes for krystal_cloud-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6ab71b821e412d79d78634d9da361098beeb85ff2a23d918385199b37e6ddbac
MD5 1e1c32b8a02501ff141f1b21c1e6c325
BLAKE2b-256 a15692a58ab3ef4ee9f8a3351298d4b298019e19fb94653fef08294f0e31eb2a

See more details on using hashes here.

File details

Details for the file krystal_cloud-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: krystal_cloud-0.1.1-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

Hashes for krystal_cloud-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4bda1aaf7d6f0325f03cc109d26464417ae119067089248adff6ec973c2a21d5
MD5 9c92f4f84796f314bd49806dc4184525
BLAKE2b-256 ce9570b562d14cfb20f98855c8e8d86c8019df702e4125b126a030a66b8c2808

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page