Educational AI-powered cryptocurrency trading assistant with market simulation, technical analysis, and risk management.
- 📊 Technical Indicators: RSI, MACD, EMA, SMA, Bollinger Bands
- 🎯 Trading Strategies: Scalping, Intraday, Swing, Position strategies
- 🤖 AI Trading Bot: Multi-layered simulation bot with market analysis
- 📉 Market Simulator: Generate artificial candles with trends, volatility, and shocks
- ⚖️ Risk Management: Liquidation price calculation, leverage risk assessment
- 💼 Portfolio Analysis: Multi-exchange portfolio aggregation and risk metrics
- 📰 News Aggregation: Crypto news and sentiment analysis
- 🤖 OpenAI Integration: LLM-powered market analysis (optional)
- 🔒 Read-Only Exchange Integration: KuCoin and Gate.io via ccxt
- 📱 Telegram Bot: Basic bot framework (optional)
npm installCopy .env.example to .env and configure:
cp .env.example .envBelow is a complete example of the .env file (all keys are optional, but exchange keys enable live data):
# LLM Providers
OPENAI_API_KEY=your_openai_api_key_here
DEEPSEEK_API_KEY=your_deepseek_api_key_here
# KuCoin (read-only)
KUCOIN_API_KEY=your_kucoin_api_key
KUCOIN_API_SECRET=your_kucoin_api_secret
# Passphrase is created when you generate the API key (it is NOT the trading password)
KUCOIN_API_PASSPHRASE=your_kucoin_api_passphrase
# Gate.io (read-only)
GATE_API_KEY=your_gate_api_key
GATE_API_SECRET=your_gate_api_secret
# Optional integrations
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
Notes:
- Exchange API keys are used in read-only mode; no live trading is executed.
- KuCoin passphrase is set by you during API key creation and is required for request signatures.
npm start simulate -- --symbol TONUSDT --timeframe 15m --candles 500 --initial-price 2.5Options:
--volatility <number>: Market volatility (default: 0.02)--trend-strength <number>: Trend strength 0-1 (default: 0.3)--shock-probability <number>: Probability of price shocks (default: 0.05)
npm start trade-sim -- --symbol TONUSDT --timeframe 15m --candles 1000 --initial-price 2.5Options:
--initial-balance <number>: Starting balance in USD (default: 10000)--max-leverage <number>: Maximum leverage (default: 5)--mmr <number>: Maintenance margin rate (default: 0.005)--aggressiveness <number>: Trading aggressiveness multiplier (0.5-2.0, default: 1)--report <path>: Inject CSV/TSV/Excel performance reports to bias risk when historical PnL is negative.--save-chart/--export-report pdf|json|csv/--no-llmfor saving charts, exporting reports, and skipping LLM output.
npm start analyze-pair -- --exchange kucoin --symbol TON/USDT --timeframe 15m --limit 200Requires exchange API keys configured in .env.
--since YYYY-MM-DDor--months Nfetch multi-month OHLCV via paginated requests;--no-cachebypasses cached candles.- OHLCV loading defaults to
--ohlcv-source auto(cache + fetch missing), and CCXT rate limiting is enabled by default (override with--no-rate-limit). - Indicators now include OBV/VWAP/funding rate and are shown in the console output.
npm start analyze-portfolioAggregates balances from configured exchanges.
npm start analyze-news -- --symbol TON- посмотреть режим
npm start -- analyze-regime --exchange gate --symbol RAVE/USDT --since 2024-01-01 --ohlcv-source autoAuto mode reads cached OHLCV first and fetches any missing segments; add --verbose to see detailed cache/fetch logs (or --quiet to suppress them).
- бэктест grid
npm start -- backtest-grid --symbol RAVE/USDT --since 2024-01-01 --mode spot- сравнение с ledger
npm start -- compare ./data/ledger.csv --symbol RAVE/USDT- PROMO MODE
npm start -- backtest-grid --profile promo --symbol RAVE/USDT --since 2024-01-01 --mode trailing --save-reportПо умолчанию stop по MA30 считается на 15m свечах (используйте
--ma-timeframe native, чтобы оставить нативный таймфрейм).
Supply CSV/TSV/Excel reports containing day, spent, voucherIncome, and profit columns. The assistant aggregates totals and adjusts strategy confidence when losses dominate.
The LLM layer prefers DeepSeek when DEEPSEEK_API_KEY is present (base URL https://api.deepseek.com/v1, default model deepseek-chat), otherwise it uses OpenAI via OPENAI_API_KEY with LLM_MODEL set. Use --no-llm to disable prompts. Outputs are scenario-based (conservative/moderate/aggressive) and avoid direct buy/sell instructions.
analyze-pair supports long lookbacks via --since or --months, invoking paginated fetchFullOHLCV. For perpetual pairs on sub-daily timeframes, funding rates are fetched and shown alongside OBV and VWAP.
OBV, VWAP, funding-rate-aware scoring, and volume/funding/multi-timeframe strategies are available. Strategy weights are combined to derive the aggregate signal.
KuCoin API passphrase is the user-defined phrase set during API key creation (not the trading password).
src/
├── core/ # Types, interfaces, utilities
├── indicators/ # Technical indicators (RSI, MACD, EMA, etc.)
├── strategies/ # Trading strategies (scalping, intraday, swing, position)
├── simulation/ # Market simulator, order execution, AI trader bot
├── real/ # Exchange clients, portfolio analyzer, risk math
├── news/ # News aggregation and sentiment analysis
├── llm/ # OpenAI integration and prompts
└── ui/ # CLI interface and Telegram bot
The simulation bot uses a sophisticated multi-layer architecture:
- Market Layer: Fetches market state and price data
- Indicator Layer: Computes technical indicators
- Strategy Layer: Runs multiple strategies and combines signals
- Risk Layer: Assesses liquidation risk and leverage
- LLM Layer (Optional): AI-powered market analysis
- Decision Layer: Makes final trading decisions
- Execution Layer: Simulates order execution and PnL
- This tool is for educational purposes only
- NOT financial advice - always do your own research
- Cryptocurrency trading carries significant risk
- Leverage trading can result in total loss of capital
- Past performance does not guarantee future results
- The developers are not responsible for any financial losses
npm testMIT
Contributions welcome! This is an educational project focused on learning trading strategies, risk management, and AI integration.
- Add more technical indicators (ATR, Stochastic, etc.)
- Implement additional trading strategies
- Integrate more news sources
- Add web interface for visualization
- Enhance backtesting with historical data
- Implement portfolio optimization algorithms