Complete method documentation for AxiomTradeAPI-py
Query SOL balance for a single Solana wallet
| Name | Type | Description |
|---|---|---|
| wallet_address | str | Solana wallet address to query |
dict with keys: sol (float), lamports (int), slot (int)client = AxiomTradeClient()
balance = client.GetBalance("BJBgjyDZx5FSsyJf6bFKVXuJV7DZY9PCSMSi5d9tcEVh")
print(f"Balance: {balance['sol']} SOL")Query SOL balances for multiple wallets efficiently (up to 1000 wallets)
| Name | Type | Description |
|---|---|---|
| wallet_addresses | List[str] | List of Solana wallet addresses |
dict mapping addresses to balance dictswallets = [
"BJBgjyDZx5FSsyJf6bFKVXuJV7DZY9PCSMSi5d9tcEVh",
"Cpxu7gFhu3fDX1eG5ZVyiFoPmgxpLWiu5LhByNenVbPb"
]
balances = client.GetBatchedBalance(wallets)
total = sum(b['sol'] for b in balances.values() if b)Subscribe to real-time new token launches via WebSocket
| Name | Type | Description |
|---|---|---|
| callback | Callable | Async function to handle incoming token data |
| error_callback | Callable | (Optional) Function to handle errors |
None (runs until stopped)async def handle_tokens(tokens):
for token in tokens:
print(f"New: {token['tokenName']}")
await client.subscribe_new_tokens(
callback=handle_tokens
)Initialize the main API client
| Name | Type | Description |
|---|---|---|
| auth_token | str | (Optional) Authentication token for WebSocket features |
| refresh_token | str | (Optional) Refresh token for auto-renewal |
| log_level | int | (Optional) Logging level (default: logging.INFO) |
AxiomTradeClient instance# Without auth (REST API only)
client = AxiomTradeClient()
# With auth (full features including WebSocket)
client = AxiomTradeClient(
auth_token="eyJ...",
refresh_token="eyJ...",
log_level=logging.DEBUG
)Network connection failed. Check your internet connection.
Invalid or expired authentication tokens. Refresh your tokens.
Provided Solana address is invalid. Verify the address format.
API rate limit exceeded. Implement exponential backoff.
try:
balance = client.GetBalance(wallet_address)
except ConnectionError as e:
logger.error(f"Network error: {e}")
# Retry logic here
except AuthenticationError as e:
logger.error(f"Auth failed: {e}")
# Refresh tokens
except Exception as e:
logger.error(f"Unexpected error: {e}")