Common issues and solutions for AxiomTradeAPI-py
pip show axiomtradeapiThe package is not installed or not in your Python path
pip install --force-reinstall axiomtradeapiSSL certificate issues during pip install
Your authentication tokens are invalid or have expired
# Proper token format in .env
AXIOM_AUTH_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
AXIOM_REFRESH_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...Environment variable not loaded correctly
from dotenv import load_dotenv
import os
load_dotenv()
token = os.getenv('AXIOM_AUTH_TOKEN')
print(f"Token loaded: {token[:20]}..." if token else "Token not found!")Authentication required for WebSocket features
client = AxiomTradeClient(
auth_token="your-actual-token",
refresh_token="your-actual-refresh-token"
)
async def error_handler(error):
print(f"WebSocket error: {error}")
await client.subscribe_new_tokens(
callback=handle_tokens,
error_callback=error_handler
)Callback function not properly defined or async issues
Invalid wallet address or API issue
# Validate address before querying
def is_valid_solana_address(address):
return len(address) >= 32 and len(address) <= 44 and address.isalnum()
if is_valid_solana_address(wallet):
balance = client.GetBalance(wallet)
else:
print("Invalid wallet address")Sending too many addresses or network issues
# Batch addresses efficiently
def batch_addresses(addresses, batch_size=100):
for i in range(0, len(addresses), batch_size):
yield addresses[i:i + batch_size]
for batch in batch_addresses(all_wallets):
balances = client.GetBatchedBalance(batch)
process_balances(balances)Blocking operations in async code
# Bad: Blocks event loop
def handle_tokens(tokens):
time.sleep(1)
# Good: Async sleep
async def handle_tokens(tokens):
await asyncio.sleep(1)Memory leaks from storing too much data
Network connection issues
import time
def get_balance_with_retry(client, address, max_retries=3):
for attempt in range(max_retries):
try:
return client.GetBalance(address)
except ConnectionError:
if attempt < max_retries - 1:
wait_time = 2 ** attempt
time.sleep(wait_time)
else:
raiseMaking too many API requests too quickly
import asyncio
class RateLimiter:
def __init__(self, calls_per_second=10):
self.delay = 1.0 / calls_per_second
self.last_call = 0
async def wait(self):
now = asyncio.get_event_loop().time()
time_since_last = now - self.last_call
if time_since_last < self.delay:
await asyncio.sleep(self.delay - time_since_last)
self.last_call = asyncio.get_event_loop().time()Get detailed information about API calls and errors by enabling debug logging:
import logging
from axiomtradeapi import AxiomTradeClient
# Set up detailed logging
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
# Initialize client with debug logging
client = AxiomTradeClient(log_level=logging.DEBUG)
# Now all API calls will show detailed debug info
balance = client.GetBalance("BJBgjyDZx5FSsyJf6bFKVXuJV7DZY9PCSMSi5d9tcEVh")Join our active community for real-time help from developers and experts
Join DiscordWhen reporting issues, please include:
python --versionpip show axiomtradeapi