Documentation/Troubleshooting
🐛

Troubleshooting Guide

Common issues and solutions for AxiomTradeAPI-py

💡 Quick Debugging Tips

  • • Check logs: Enable DEBUG logging to see detailed error messages
  • • Test connection: Try a simple GetBalance call with a known wallet
  • • Verify environment: Ensure virtual environment is activated
  • • Check versions: Run pip show axiomtradeapi
  • • Join Discord: Get help from the community at discord.gg/p7YyFqSmAz

Installation & Setup

ImportError: No module named 'axiomtradeapi'

The package is not installed or not in your Python path

Solutions:

  • Verify installation: pip list | grep axiomtradeapi
  • Reinstall the package: pip install --upgrade axiomtradeapi
  • Check you're using the correct Python environment
  • If using virtual environment, ensure it's activated
Example Solution
pip install --force-reinstall axiomtradeapi

SSL Certificate Verification Failed

SSL certificate issues during pip install

Solutions:

  • Update pip: python -m pip install --upgrade pip
  • Update certifi: pip install --upgrade certifi
  • As last resort (not recommended): pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org axiomtradeapi

Authentication

AuthenticationError: Invalid or expired token

Your authentication tokens are invalid or have expired

Solutions:

  • Get fresh tokens from Axiom Trade (F12 → Application → Cookies)
  • Ensure tokens are copied completely (they start with eyJ...)
  • Check for extra spaces or newlines in your .env file
  • Tokens expire after 24 hours - refresh them regularly
Example Solution
# Proper token format in .env
AXIOM_AUTH_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
AXIOM_REFRESH_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Tokens work in browser but not in Python

Environment variable not loaded correctly

Solutions:

  • Install python-dotenv: pip install python-dotenv
  • Load .env file: from dotenv import load_dotenv; load_dotenv()
  • Verify tokens are loaded: print(os.getenv("AXIOM_AUTH_TOKEN"))
  • Check .env file is in the same directory as your script
Example Solution
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!")

WebSocket Connection

WebSocket connection immediately closes

Authentication required for WebSocket features

Solutions:

  • Ensure you're passing auth_token and refresh_token to AxiomTradeClient
  • Verify tokens are valid and not expired
  • Check your internet connection
  • Implement error callback to see specific error messages
Example Solution
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
)

No data received from WebSocket

Callback function not properly defined or async issues

Solutions:

  • Ensure callback is an async function: async def handle_tokens(tokens)
  • Check callback is actually processing data (add print statements)
  • Verify WebSocket is actually connected (check logs)
  • New tokens only appear when actually launched - may need to wait

Balance Queries

GetBalance returns None or empty dict

Invalid wallet address or API issue

Solutions:

  • Verify wallet address is valid Solana address (32-44 chars, base58)
  • Check for typos in wallet address
  • Test with known valid address: BJBgjyDZx5FSsyJf6bFKVXuJV7DZY9PCSMSi5d9tcEVh
  • Check API status and your internet connection
Example Solution
# 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")

GetBatchedBalance very slow

Sending too many addresses or network issues

Solutions:

  • Limit to 100-200 addresses per batch for optimal performance
  • Split large lists into multiple batches
  • Check your internet connection speed
  • Consider caching results if data doesn't need to be real-time
Example Solution
# 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)

Performance

Bot running slowly or lagging

Blocking operations in async code

Solutions:

  • Replace time.sleep() with await asyncio.sleep()
  • Don't use blocking I/O operations in async callbacks
  • Use aiohttp for async HTTP requests instead of requests library
  • Profile your code to find bottlenecks
Example Solution
# Bad: Blocks event loop
def handle_tokens(tokens):
    time.sleep(1)
    
# Good: Async sleep
async def handle_tokens(tokens):
    await asyncio.sleep(1)

High memory usage

Memory leaks from storing too much data

Solutions:

  • Clear old data from tracking dictionaries periodically
  • Limit size of historical data storage
  • Use generators instead of loading all data into memory
  • Profile memory usage with memory_profiler

Common Errors

ConnectionError or Timeout

Network connection issues

Solutions:

  • Check your internet connection
  • Verify firewall isn't blocking Python
  • Implement retry logic with exponential backoff
  • Check if API endpoints are accessible
Example Solution
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:
                raise

Rate limit exceeded

Making too many API requests too quickly

Solutions:

  • Implement request throttling
  • Use batch operations instead of individual calls
  • Add delays between requests
  • Cache results when appropriate
Example Solution
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()

🔍 Enable Debug Logging

Get detailed information about API calls and errors by enabling debug logging:

Enable Debug Mode
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")

🆘 Still Need Help?

💬

Discord Community

Join our active community for real-time help from developers and experts

Join Discord
📚

Documentation

Review our comprehensive guides and API reference

View Docs
🐙

GitHub Issues

Report bugs or request features on our GitHub repository

Open Issue
🤝

Professional Support

Need custom development or consulting? We offer professional services

Get Help

🐛 Reporting Bugs

When reporting issues, please include:

  • • Python version: python --version
  • • AxiomTradeAPI version: pip show axiomtradeapi
  • • Operating system and version
  • • Complete error message and stack trace
  • • Minimal code example that reproduces the issue
  • • What you expected to happen vs. what actually happened