6.0 KiB
6.0 KiB
๐ Immortal AI Trading Bot - Startup Guide
Quick Start (One Command)
Start everything (backend + frontend + all services) with a single command:
bun start
# or
./start-all.sh
This will start:
- โ Backend API Server (Port 3001)
- โ Frontend Dashboard (Port 3000)
- โ
All Integrated Services:
- AI Orchestrator
- Order Monitoring Service
- Price Feed Service
- Risk Management Service
- Analytics Service
- WebSocket Manager
- Polymarket Services
Access Points
| Service | URL | Description |
|---|---|---|
| Frontend | http://localhost:3000 | Main dashboard UI |
| Backend API | http://localhost:3001 | REST API endpoints |
| WebSocket | ws://localhost:3001/ws | Real-time updates |
| Health Check | http://localhost:3001/health | Server health status |
What's Running
Backend (Port 3001)
The backend includes all these integrated services:
- AI Orchestrator - Routes decisions to TypeScript/Python agents
- Order Monitoring Service - Tracks LIMIT/STOP orders (checks every 5s)
- Price Feed Service - Multi-source price aggregation (updates every 10s)
- Risk Management Service - Portfolio risk validation before trades
- Analytics Service - Records all trades and decisions
- WebSocket Manager - Broadcasts real-time events to frontend
- Polymarket Services - Prediction market trading integration
Frontend (Port 3000)
- Next.js dashboard
- Wallet connection (MetaMask/Web3)
- Real-time data updates
- WebSocket live notifications
Logs
View real-time logs:
# Backend logs
tail -f logs/backend.log
# Frontend logs
tail -f logs/frontend.log
# All logs
tail -f logs/*.log
Stop All Services
Press Ctrl+C in the terminal where you ran bun start
The script will automatically cleanup and stop all services.
Manual Start (Separate Terminals)
If you prefer to run services in separate terminals:
Terminal 1: Backend
bun run backend
# or
bun run src/index.ts
Terminal 2: Frontend
cd frontend
bun dev
Environment Setup
Make sure you have configured your .env file:
# AI
OPENROUTER_API_KEY=sk-xxx
# Blockchain
BNB_RPC=https://bsc-testnet.bnbchain.org
WALLET_PRIVATE_KEY=0xxx
# Trading
MAX_TRADE_AMOUNT_BNB=0.1
STOP_LOSS_PERCENTAGE=5
Troubleshooting
Port Already in Use
If you get "port already in use" errors:
# Check what's using the ports
lsof -i :3000 # Frontend
lsof -i :3001 # Backend
# Kill the process
kill -9 <PID>
Services Not Starting
Check the logs:
cat logs/backend.log
cat logs/frontend.log
Backend Not Responding
Test the backend health:
curl http://localhost:3001/health
Missing Dependencies
Install all dependencies:
bun run install:all
Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Frontend (Port 3000) โ
โ Next.js Dashboard + Wallet Connect + Real-time UI โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTP/WebSocket
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Backend API (Port 3001) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Service Orchestration Layer โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ
โ โ โข AI Orchestrator (TS/Python routing) โ โ
โ โ โข Order Monitoring (LIMIT/STOP tracking) โ โ
โ โ โข Price Feed (multi-source aggregation) โ โ
โ โ โข Risk Management (portfolio validation) โ โ
โ โ โข Analytics (performance tracking) โ โ
โ โ โข WebSocket Manager (real-time events) โ โ
โ โ โข Polymarket Services (prediction markets) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ Trading Loop (Every 5 minutes) โ
โ โ AI Decision โ Risk Check โ Execute โ Track โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Features Active
- โ AI-Powered Decisions: GPT-4 via OpenRouter
- โ Multi-Platform Trading: DEX (PancakeSwap) + Polymarket
- โ Risk Management: Portfolio limits and position sizing
- โ Order Monitoring: Automatic LIMIT/STOP execution
- โ Price Aggregation: Multi-source price feeds
- โ Real-time Updates: WebSocket notifications
- โ Immortal Memory: BNB Greenfield storage
- โ Analytics: Performance tracking and insights
Next Steps
- Connect Wallet: Click "Connect Wallet" on http://localhost:3000
- Configure Bot: Set risk parameters and watchlist
- Start Trading: Click "Start Bot" to begin automated trading
- Monitor: Watch real-time updates in the dashboard
Support
For issues or questions:
- Check logs in
logs/directory - Review
ARCHITECTURE.mdfor system details - See
TROUBLESHOOTING.mdfor common issues
"An AI that never forgets" ๐ง ๐พ