Documentation/API Reference
🔧

API Reference

Complete method documentation for AxiomTradeAPI-py

📑 Quick Navigation

Balance Queries

GetBalance

Query SOL balance for a single Solana wallet

Parameters

NameTypeDescription
wallet_addressstrSolana wallet address to query

Returns

dict with keys: sol (float), lamports (int), slot (int)

Example

client = AxiomTradeClient()
balance = client.GetBalance("BJBgjyDZx5FSsyJf6bFKVXuJV7DZY9PCSMSi5d9tcEVh")
print(f"Balance: {balance['sol']} SOL")

GetBatchedBalance

Query SOL balances for multiple wallets efficiently (up to 1000 wallets)

Parameters

NameTypeDescription
wallet_addressesList[str]List of Solana wallet addresses

Returns

dict mapping addresses to balance dicts

Example

wallets = [
    "BJBgjyDZx5FSsyJf6bFKVXuJV7DZY9PCSMSi5d9tcEVh",
    "Cpxu7gFhu3fDX1eG5ZVyiFoPmgxpLWiu5LhByNenVbPb"
]
balances = client.GetBatchedBalance(wallets)
total = sum(b['sol'] for b in balances.values() if b)

WebSocket

subscribe_new_tokens

Subscribe to real-time new token launches via WebSocket

Parameters

NameTypeDescription
callbackCallableAsync function to handle incoming token data
error_callbackCallable(Optional) Function to handle errors

Returns

None (runs until stopped)

Example

async def handle_tokens(tokens):
    for token in tokens:
        print(f"New: {token['tokenName']}")

await client.subscribe_new_tokens(
    callback=handle_tokens
)

Client

AxiomTradeClient

Initialize the main API client

Parameters

NameTypeDescription
auth_tokenstr(Optional) Authentication token for WebSocket features
refresh_tokenstr(Optional) Refresh token for auto-renewal
log_levelint(Optional) Logging level (default: logging.INFO)

Returns

AxiomTradeClient instance

Example

# 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
)

⚠️ Error Handling

Common Exceptions

ConnectionError

Network connection failed. Check your internet connection.

AuthenticationError

Invalid or expired authentication tokens. Refresh your tokens.

InvalidAddressError

Provided Solana address is invalid. Verify the address format.

RateLimitError

API rate limit exceeded. Implement exponential backoff.

Example Error Handling
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}")