Nofyai
π€ AI-powered algorithmic trading system with multi-agent competition. Built with Next.js 16, React 19, and TypeScript. Trade transparently with DeepSeek, Qwen, and Kimi AI models on Aster DEX.
Install / Use
/learn @osbrain/NofyaiREADME
NofyAI - AI-Driven Algorithmic Trading System
<div align="center">An AI-powered multi-agent algorithmic trading system supporting Aster DEX exchange.
Features β’ Quick Start β’ Architecture β’ Configuration β’ API Documentation
</div>π Project Overview
NofyAI is a modern AI-driven algorithmic trading system built with Next.js 16. The system supports multiple AI models (DeepSeek, Qwen, Kimi, custom models) trading autonomously on Aster DEX exchange, with real-time performance monitoring through a visual dashboard.
Exchange Support: Currently supports Aster DEX only as the trading execution platform Market Data Source: Uses Binance API to fetch real-time market data (K-lines, prices, etc.)
πΌοΈ Screenshots & Demo
Web Interface
<div align="center"> <img src="images/image.png" alt="NofyAI Trading System Interface" width="100%"> <p><em>Real-time monitoring of multiple AI traders' performance, including equity curves, positions, and decision analysis</em></p> </div>β¨ Features
π Multi-Trader Competition Mode
- Support multiple AI models running simultaneously with independent trading accounts
- Real-time leaderboard comparing performance of different AI models
- Independent capital management and risk control
π Real-Time Performance Tracking
- Real-time equity curve charts (supports 1D/1W/1M/3M/All time ranges)
- P&L analysis and Sharpe ratio calculation
- Position monitoring and margin usage percentage
- Auto-adjusted Y-axis domain calculation for optimal chart readability
π€ AI Decision Transparency
- Complete Chain of Thought (CoT) reasoning process
- Detailed reasoning for each trading decision
- Execution result tracking
- Admin-only: View system prompts and input prompts
π In-Depth Performance Analysis
- Win rate and profit/loss ratio statistics
- Maximum drawdown analysis
- Trading history and sample analysis
- Smart sample size grading (displays "Limited Sample" warning for <10 trades)
π¨ Modern UI
- Responsive design with mobile support
- Professional style inspired by CoinMarketCap
- Real-time auto-refresh data (SWR)
- Internationalization support (Chinese/English)
π Security & Management
- Admin authentication system (supports bcrypt password hashing)
- Session management with auto-expiration (configurable timeout)
- Sensitive information protection (API keys auto-masked)
- Config hot-reload API (no container restart needed)
π’ Notification System
- Telegram Bot integration
- Trading notifications (open/close positions)
- Risk alerts (stop-loss/drawdown thresholds reached)
- System status notifications
π Quick Start
Method 1: Docker Deployment (Recommended for Production)
Deploy to server in 5 minutes (CentOS/RHEL):
# 1. Install Docker
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo systemctl start docker && sudo systemctl enable docker
# 2. Clone repository
git clone https://github.com/your-username/nofyai.git
cd nofyai
# 3. Configuration
cp config.json.example config.json
nano config.json # Fill in your API keys
# 4. One-click deploy
./scripts/deploy.sh
Visit http://your-server-ip:3000 to view the dashboard.
Configure HTTPS (Optional)
Use Caddy for free HTTPS:
# Install Caddy
sudo yum install -y yum-plugin-copr
sudo yum copr enable @caddy/caddy -y
sudo yum install -y caddy
# Configure reverse proxy
sudo cp Caddyfile /etc/caddy/Caddyfile
sudo nano /etc/caddy/Caddyfile # Change to your domain
# Start Caddy
sudo systemctl enable caddy && sudo systemctl start caddy
# Open ports
sudo firewall-cmd --permanent --add-service={http,https}
sudo firewall-cmd --reload
Visit https://your-domain - Caddy will automatically obtain and renew SSL certificates!
Method 2: Local Development
Prerequisites:
- Node.js 18+ and npm
- Aster DEX exchange account
- AI API keys (DeepSeek / Qwen / Kimi / OpenAI, etc.)
Installation steps:
# 1. Clone repository
git clone https://github.com/your-username/nofyai.git
cd nofyai
# 2. Install dependencies
npm install
# 3. Configure system
cp config.json.example config.json
cp .env.local.example .env.local
# Edit config.json to add your Aster exchange and AI API credentials
# Edit .env.local to configure market data sources and proxy (optional)
# 4. Start development server
npm run dev
Visit http://localhost:3000 to view the dashboard.
Production Build (Non-Docker)
# Build for production
npm run build
# Start production server
npm start
βοΈ Configuration
Configuration Files
| File | Purpose | Required |
|------|---------|----------|
| config.json | Trader configuration (exchange credentials, AI keys, trading params) | β
Required |
| .env.local | Next.js environment config (market data source, proxy settings) | Optional |
Configure Traders
Edit config.json file:
{
"traders": [
{
"id": "aster_deepseek",
"name": "Aster DeepSeek Trader",
"enabled": true,
"ai_model": "deepseek",
"exchange": "aster", // Currently only supports "aster"
// Aster Exchange Configuration
"aster_user": "0xYourMainWalletAddress",
"aster_signer": "0xAPIWalletAddress",
"aster_private_key": "APIWalletPrivateKey(without0xPrefix)",
// AI Configuration
"deepseek_api_key": "sk-YourDeepSeekKey",
// Trading Parameters
"initial_balance": 1000.0,
"scan_interval_minutes": 3,
// Prompt Template (Optional)
"prompt_template": "adaptive" // adaptive/conservative/aggressive
}
],
// Global Leverage Settings
"leverage": {
"btc_eth_leverage": 5,
"altcoin_leverage": 5
},
// Coin Pool Configuration
"use_default_coins": true,
"default_coins": [
"BTCUSDT", "ETHUSDT", "SOLUSDT", "BNBUSDT"
],
// Risk Management
"max_daily_loss": 10.0,
"max_drawdown": 20.0,
"stop_trading_minutes": 60,
// Market Data Configuration
"binance_region": "global", // "global" or "us" (for market data)
// Admin Configuration
"admin": {
"password": "$2b$10$...", // bcrypt hash or plaintext (dev only)
"session_timeout_minutes": 60
},
// Telegram Notification (Optional)
"telegram": {
"enabled": true,
"bot_token": "your-bot-token",
"chat_id": "your-chat-id"
}
}
Generate Admin Password Hash
Method 1: Online Tool Visit bcrypt-generator.com, enter password to generate hash
Method 2: Use Node.js
# Install bcrypt
npm install bcrypt
# Generate hash
node -e "const bcrypt=require('bcrypt'); bcrypt.hash('your-password', 10, (e,h)=>console.log(h))"
Method 3: Use Plaintext in Dev Environment
{
"admin": {
"password": "admin123" // Dev environment only!
}
}
Supported AI Models
| AI Model | ai_model Value | API Key Field | Notes |
|----------|------------------|---------------|-------|
| DeepSeek | "deepseek" | deepseek_api_key | Cost-effective, strong reasoning |
| Qwen (Tongyi Qianwen) | "qwen" | qwen_api_key | Alibaba Cloud model, good Chinese support |
| Kimi (Moonshot) | "kimi" | kimi_api_key, kimi_model_name | Moonshot AI, long context understanding |
| Custom (OpenAI/Local) | "custom" | custom_api_key, custom_api_url, custom_model_name | Supports OpenAI-compatible APIs |
Supported Exchanges
Currently only supports Aster DEX exchange.
| Exchange | exchange Value | Credential Fields |
|----------|------------------|-------------------|
| Aster DEX | "aster" | aster_user, aster_signer, aster_private_key |
Environment Variables (Optional)
Edit .env.local:
# HTTP Proxy Configuration (when APIs are blocked)
HTTP_PROXY=http://127.0.0.1:7890
HTTPS_PROXY=http://127.0.0.1:7890
# JWT Secret (must change in production)
JWT_SECRET=your-super-secret-key-change-this-in-production
Proxy Notes:
- System auto-detects proxy configuration
- Uses direct connection when proxy not configured
- Proxy only used for restricted APIs
- Startup logs show proxy status
Binance Market Data Source Configuration
Description: System uses Binance API to fetch market data (K-lines, prices, etc.). Different regions require different API endpoints.
Issue: US users cannot access https://fapi.binance.com
Solution: Configure region in config.json
{
"binance_region": "us" // Use Binance US endpoint
}
API Endpoint Comparison
| Config Value | Base URL | Market Type | K-line Path | Ticker Path |
|--------------|----------|-------------|-------------|-------------|
| "global" | https://fapi.binance.com | Futures | /fapi/v1/klines | /fapi/v1/ticker/24hr |
| "us" | https://api.binance.us | Spot | /api/v3/klines | /api/v3/ticker/24hr |
Feature Differences
| Feature | Global (Futures) | US (Spot) | |---------|------------------|-----------| | K-line Data | β Supported | β Supported | | 24h Ticker | β Supported | β Supported | | Open Interest | β Supported | β Not supported (spot has no OI) | | Funding Rate | β Supported | β Not supported (spot has no funding) | | Leverage Trading | β Supported | β Spot trading only |
Important Notes:
- US endpoint uses **spot market AP
