MoneySharks
6 AI LLMs released into the markets with one mission: survive and profit. Inspired by @the_nof1. Powered by @aster_dex. 🦈
Install / Use
/learn @sharksdotmoney/MoneySharksREADME
A production-ready autonomous trading system powered by multiple AI models executing perpetual futures trades on Aster DEX. Six independent AI agents (OpenAI GPT-5, Claude, DeepSeek, Gemini, Grok, Qwen) analyze markets using 60+ technical indicators and make autonomous trading decisions 24/7. Powered by BNB Smart Chain & Aster DEX.
Status: Production Ready | Version: 1.0 | Last Updated: January 2025
Table of Contents
- Overview
- Key Features
- System Architecture
- AI Agents
- Technical Indicators
- Performance Metrics
- Trading Strategy
- Technology Stack
- Project Structure
- Installation & Setup
- Configuration
- Usage
- Monitoring
- Documentation
- Safety & Risk Management
- Production Deployment
- Contributing
- License
Overview
This system represents a sophisticated approach to algorithmic trading, leveraging the analytical capabilities of six different AI models to make independent trading decisions. Each agent operates with its own wallet, risk parameters, and trading style, creating a diversified portfolio of strategies.
What It Does
- Analyzes Markets: Processes real-time data from 20+ cryptocurrency pairs across 5 timeframes
- Makes Decisions: Each AI agent independently decides when to open/close positions
- Executes Trades: Automatically places orders on Aster DEX with leverage (1-50x)
- Manages Risk: Sets stop-loss and take-profit orders for every position
- Tracks Performance: Monitors win rate, PnL, Sharpe ratio, and other metrics
- Syncs Continuously: Real-time position synchronization with exchange (every 5 seconds)
Core Statistics
| Metric | Value | |--------|-------| | AI Models | 6 (OpenAI, Claude, DeepSeek, Gemini, Grok, Qwen) | | Trading Pairs | 20+ cryptocurrencies | | Technical Indicators | 60+ across 5 timeframes | | Analysis Frequency | Every 30 seconds per agent | | Position Sync | Every 5 seconds | | Leverage Range | 1x - 50x (configurable) | | Database | Supabase PostgreSQL | | Exchange | Aster DEX Perpetual Futures |
Key Features
Multi-Agent Intelligence
Six independent AI agents analyze markets simultaneously, each with:
- Unique Perspective: Different AI architectures provide diverse market views
- Independent Decisions: No coordination between agents (reduces correlation risk)
- Separate Wallets: Each agent manages its own capital
- Custom Parameters: Configurable risk tolerance, leverage, and position sizing
Advanced Technical Analysis
The system calculates 60+ indicators across multiple timeframes:
Trend Indicators: EMA (20, 50, 200), MACD, SuperTrend, ADX Momentum: RSI (7, 14), Stochastic RSI Volatility: Bollinger Bands, ATR, True Range Volume: OBV, VWAP, Volume SMA Derivatives: Funding Rate, Mark-Index Spread, Open Interest
Robust Position Management
- Fill Verification: Orders verified as filled before database update (prevents sync issues)
- Position Tracking: Real-time PnL updates every 5 seconds
- TP/SL Management: Automatic take-profit and stop-loss orders
- Orphan Detection: Identifies and reconciles positions missing from database
- Race Condition Prevention: Prevents duplicate closure attempts
Production-Grade Architecture
- Error Handling: Comprehensive try-catch blocks and graceful degradation
- Logging: Detailed trade logs for audit and debugging
- API Optimization: Batch requests, caching, and efficient polling
- Data Integrity: Foreign keys, constraints, and validation checks
- No Data Loss: All decisions and positions permanently logged
System Architecture
graph TB
subgraph "Market Data Pipeline"
Timer1[Timer: 30s] --> AsterAPI[Aster DEX APIs]
AsterAPI --> Klines[Klines Data]
AsterAPI --> Premium[Premium Index]
AsterAPI --> OI[Open Interest]
Klines --> MarketEngine[aster.js<br/>Market Engine]
Premium --> MarketEngine
OI --> MarketEngine
MarketEngine --> Indicators[60+ Indicators<br/>5 Timeframes]
end
subgraph "AI Analysis Layer"
Indicators --> OpenAI[OpenAI GPT-5]
Indicators --> Claude[Claude Sonnet]
Indicators --> DeepSeek[DeepSeek]
Indicators --> Gemini[Gemini Pro]
Indicators --> Grok[Grok 2]
Indicators --> Qwen[Qwen]
OpenAI --> Decisions[Trading Decisions]
Claude --> Decisions
DeepSeek --> Decisions
Gemini --> Decisions
Grok --> Decisions
Qwen --> Decisions
end
subgraph "Execution Layer"
Decisions --> AgentMgr[Agent Manager<br/>agents.js]
AgentMgr --> PosMgr[Position Manager<br/>position-manager.js]
PosMgr --> Trader[AsterDex Trader<br/>makeTrade.js]
Trader --> Exchange[Aster DEX<br/>Exchange]
end
subgraph "Monitoring & Sync"
Timer2[Timer: 5s] --> Poller[Account Poller<br/>account-poller.js]
Poller --> Exchange
Exchange --> Poller
Poller --> DB[(Supabase<br/>PostgreSQL)]
PosMgr --> DB
end
DB --> AgentMgr
Component Responsibilities
| Component | File | Responsibility |
|-----------|------|----------------|
| Market Engine | aster.js | Fetches and processes market data, calculates indicators |
| Agent Manager | agents.js | Orchestrates AI agents, manages decisions |
| Position Manager | position-manager.js | Handles position lifecycle (open, monitor, close) |
| Wallet Manager | agents.js | Manages per-agent wallets and capital allocation |
| Aster DEX Trader | makeTrade.js | Direct API wrapper for Aster DEX |
| Account Poller | account-poller.js | Real-time sync with exchange (every 5s) |
| Price Updater | price-updater.js | Fast price cache updates |
AI Agents
Each AI agent receives identical market data but produces unique trading decisions based on its architecture and training.
Agent Configuration
{
"openai": {
"model": "gpt-5",
"initialBalance": 10000,
"maxLeverage": 20,
"riskTolerance": "medium",
"preferredStyle": "swing"
},
"claude": {
"model": "claude-4.5-sonnet",
"initialBalance": 10000,
"maxLeverage": 15,
"riskTolerance": "low",
"preferredStyle": "mixed"
}
// ... 4 more agents
}
AI Prompt Structure
Each agent receives:
- Session Context: Runtime, invocation count, current timestamp
- Account State: Balance, available capital, unrealized PnL, active positions
- Market Overview: BTC trend, market sentiment, volatility
- Per-Asset Data:
- Trend indicators (EMA, MACD) across all timeframes
- Momentum (RSI, Stochastic RSI)
- Volatility (Bollinger Bands, ATR)
- Volume (OBV, VWAP)
- Derivatives data (funding rate, open interest)
- Time series arrays (price history, indicator history)
- Active Positions: Current positions with PnL
- Recent Trades: Last 5 closed positions with outcomes
Decision Output Format
AI agents return structured JSON:
{
"symbol": "BTCUSDT",
"action": "long",
"confidence": 0.85,
"entry_price": 42150.00,
"take_profit": 44000.00,
"stop_loss": 41000.00,
"leverage": 10,
"sizeUSD": 500,
"riskUSD": 50,
"reasoning": "Strong bullish divergence on 1H RSI...",
"invalidation_condition": "4h_close_below_41500",
"exit_strategy": "Take profit at resistance, trail stop if breaks above"
}
Technical Indicators
Indicator Categories
1. Trend Analysis
- EMA 20, 50, 200 (Exponential Moving Averages)
- MACD (Moving Average Convergence Divergence)
- MACD State (bullish/bearish/neutral)
- SuperTrend (trend following indicator)
- ADX (Average Directional Index)
2. Momentum
- RSI 7 (fast)
- RSI 14 (standard)
- Stochastic RSI K/D
- Rate of Change
3. Volatility
- Bollinger Bands (upper, lower, middle)
- ATR (Average True Range)
- True Range
- Bollinger Band Position
4. Volume Analysis
- OBV (On-Balance Volume)
- OBV State (accumulation/distribution)
- Volume SMA
- Relative Volume
- VWAP (Volume Weighted Average Price)
5. Support/Resistance
- Key Support Levels
- Key Resistance Levels
- Fibonacci Retracements
6. Derivatives (Perpetual Futures Specific)
- Funding Rate (long/short bias)
- Annualized Funding Rate
- Mark Price vs Index Price
- Open Interest
- Next Funding Time
Multi-Timeframe Analysis
All indicators calculated across 5 timeframes:
- 1 minute: Ultra-short-term movements
- 5 minutes: Short-term trends
- 15 minutes: Intraday analysis
- 1 hour: Medium-term trends
- 4 hours: Long-term context
Time Series Data
Recent history arrays for pattern recognition:
- Last 10 mid-prices
- Last 10 EMA values
- Last 10 MACD values
- Last 10 RSI values
This enables AI agents to identify patterns like:
- Divergences (price vs indicator)
- Trend reversals
- Momentum shifts
Performance Metrics
Agent Performance Tracking
Each agent tracks comprehensive metrics:
| Metric | Description | |--------|-------------| | Balance | Current account equity (wallet + unrealized PnL) | | Total PnL | Cumulative profit/loss across all trades | | ROI | Return on investment percentage | | Win Rate | Percentage of profitable trades | | Trade Count | Total trades executed | | Win/Loss Count
