Build your first Solana trading bot in 30 minutes
# Create a new project directory
mkdir my-solana-bot
cd my-solana-bot
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install AxiomTradeAPI-py
pip install axiomtradeapi
# Verify installation
python -c "from axiomtradeapi import AxiomTradeClient; print('ā
Installation successful!')"Always use virtual environments to avoid package conflicts. This keeps your trading bot dependencies isolated from other Python projects.
auth-access-tokenauth-refresh-tokeneyJ...)# .env file - NEVER commit this to version control!
AXIOM_AUTH_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
AXIOM_REFRESH_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...Never commit your .env file to Git. Add it to .gitignore immediately!
from axiomtradeapi import AxiomTradeClient
# Initialize the client
client = AxiomTradeClient()
# Query any Solana wallet balance
wallet_address = "BJBgjyDZx5FSsyJf6bFKVXuJV7DZY9PCSMSi5d9tcEVh"
balance = client.GetBalance(wallet_address)
print(f"š° Wallet Balance:")
print(f" SOL: {balance['sol']}")
print(f" Lamports: {balance['lamports']:,}")
print(f" Slot: {balance['slot']}")
# Check multiple wallets at once
wallets = [
"BJBgjyDZx5FSsyJf6bFKVXuJV7DZY9PCSMSi5d9tcEVh",
"Cpxu7gFhu3fDX1eG5ZVyiFoPmgxpLWiu5LhByNenVbPb"
]
balances = client.GetBatchedBalance(wallets)
total_sol = sum(b['sol'] for b in balances.values() if b)
print(f"\nš Total Portfolio: {total_sol:.6f} SOL")š° Wallet Balance:
SOL: 1.234567
Lamports: 1,234,567,890
Slot: 344031778
š Total Portfolio: 1.802457 SOLNow let's set up real-time WebSocket monitoring to detect new token launches as they happen.
import asyncio
from axiomtradeapi import AxiomTradeClient
class TokenMonitor:
def __init__(self, auth_token, refresh_token):
self.client = AxiomTradeClient(
auth_token=auth_token,
refresh_token=refresh_token
)
self.min_liquidity = 10.0 # Minimum 10 SOL liquidity
async def handle_new_tokens(self, tokens):
"""Process incoming token data"""
for token in tokens:
name = token.get('tokenName', 'Unknown')
liquidity = token.get('liquiditySol', 0)
if liquidity >= self.min_liquidity:
print(f"šØ NEW TOKEN: {name}")
print(f" Liquidity: {liquidity:.2f} SOL")
print(f" Address: {token['tokenAddress']}")
async def start_monitoring(self):
"""Start real-time monitoring"""
print("š Monitoring new token launches...")
await self.client.subscribe_new_tokens(
callback=self.handle_new_tokens
)
# Run the monitor
if __name__ == "__main__":
monitor = TokenMonitor(
auth_token="your-auth-token",
refresh_token="your-refresh-token"
)
asyncio.run(monitor.start_monitoring())⢠Join our Discord community for live support
⢠Check the troubleshooting guide for common issues
⢠Explore API reference for detailed documentation