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

API Documentation

Full API documentation: https://cloud-api.krystal.app/swagger/index.html

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.2.tar.gz (4.0 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.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: krystal_cloud-0.1.2.tar.gz
  • Upload date:
  • Size: 4.0 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.2.tar.gz
Algorithm Hash digest
SHA256 6cefb0671a39b229b7ba094156c07e65de761fc342da19639b60a06554631eec
MD5 d5fbc9a11663cdea2543c0d569e90bf1
BLAKE2b-256 b96ccc50ef4e2029834cf0d6dc5adb37d07657af535fb343d23a25abdc159502

See more details on using hashes here.

File details

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

File metadata

  • Download URL: krystal_cloud-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 90f2f067f93912f6591611a65af1b5cf65edfda3aa8514d46f13ef244d7d293b
MD5 49e76728b4fb5efb8c58a7b4d075087b
BLAKE2b-256 823d6ef7e4569671ec383538832f6290fa0a9ab0d00fc3545a5e74af473d304d

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