Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,27 @@ LOG_LEVEL=INFO
# 获取方式:https://core.telegram.org/bots#6-botfather
TELEGRAM_API_TOKEN=
TELEGRAM_CHAT_ID=
TELEGRAM_ENABLED=false
TELEGRAM_ENABLED=false


# Tracker-Notification System Configuration
# 📱 Enhanced notification system for multiple platforms
# =======================================

# Telegram Configuration (Enhanced)
# Bot Token: Get from @BotFather on Telegram
# Chat ID: Send message to your bot and check updates via getUpdates API
TELEGRAM_BOT_TOKEN=telegram_token
TELEGRAM_CHAT_ID=telegram_chat_id
Comment on lines +45 to +46
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The example values 'telegram_token' and 'telegram_chat_id' are not realistic placeholders. Consider using more descriptive placeholder formats like '<your_telegram_bot_token>' or 'YOUR_BOT_TOKEN_HERE' to make it clearer that these need to be replaced with actual values.

Suggested change
TELEGRAM_BOT_TOKEN=telegram_token
TELEGRAM_CHAT_ID=telegram_chat_id
TELEGRAM_BOT_TOKEN=<your_telegram_bot_token>
TELEGRAM_CHAT_ID=<your_telegram_chat_id>

Copilot uses AI. Check for mistakes.

# Slack Configuration (Optional)
# Bot Token: Create Slack App at https://api.slack.com/apps
# Channel ID: Right-click channel → "Copy link" → extract ID from URL
SLACK_BOT_TOKEN=xoxb-1234
SLACK_CHANNEL_ID="#new-channel"
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example shows a channel name format ('#new-channel') but the code expects a channel ID (like 'C123456789'). This mismatch could confuse users. The example should use a proper channel ID format or the documentation should clarify the difference.

Suggested change
SLACK_CHANNEL_ID="#new-channel"
SLACK_CHANNEL_ID="C1234567890"

Copilot uses AI. Check for mistakes.


# Notification Providers Selection
# Set to 'true' to enable each provider
NOTIFICATION_TELEGRAM_ENABLED=false
NOTIFICATION_SLACK_ENABLED=false
76 changes: 8 additions & 68 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ cp .env.example .env
# 3. View available AI Agents
npm start -- agents

# 4. Test Telegram notifications (optional)
npm start -- telegram-test

# 5. Start copy trading (risk-only mode, no real trades)
npm start -- follow deepseek-chat-v3.1 --risk-only

Expand All @@ -66,7 +63,7 @@ npm start -- profit
- **⚡ Futures Trading**: Full support for Binance USDT perpetual futures, 1x-125x leverage
- **📈 Profit Analysis**: Accurate profit analysis based on real trading data (including fee statistics)
- **🛡️ Risk Control**: Support `--risk-only` mode for observation without execution
- **📱 Telegram Notifications**: Real-time Telegram notifications for trade executions and stop-loss/take-profit events
- **📱 Notifications Service**: Real-time notifications for trade executions and stop-loss/take-profit events

## 📊 Live Trading Dashboard

Expand All @@ -76,9 +73,9 @@ Real-time view of deepseek-chat-v3.1 AI Agent's trading performance, positions,

Dashboard: https://github.com/terryso/nof1-tracker-dashboard

## 📱 Telegram Notifications
## 📱 Notification Service

Enable Telegram notifications to receive real-time alerts about your trading activities:
Enable notifications to receive real-time alerts about your trading activities:

### Features

Expand Down Expand Up @@ -157,35 +154,7 @@ This system uses **Binance Futures Trading API**, permissions must be configured
BINANCE_API_SECRET=testnet_secret_key
```

### 2. Telegram Notification Setup (Optional)

Set up Telegram notifications to receive real-time trading signals and alerts:

1. **Create a Telegram Bot**:
- Open Telegram and search for [@BotFather](https://t.me/BotFather)
- Send `/newbot` command and follow the instructions
- Save the bot token you receive

2. **Get Your Chat ID**:
- Search for your bot in Telegram
- Send any message to your bot
- Visit `https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates`
- Look for `"chat":{"id":<YOUR_CHAT_ID>}`

3. **Configure Environment Variables**:
```env
# Telegram Configuration (Optional)
TELEGRAM_ENABLED=true
TELEGRAM_API_TOKEN=your_telegram_bot_token
TELEGRAM_CHAT_ID=your_telegram_chat_id
```

4. **Test Telegram Connection**:
```bash
npm start -- telegram-test
```

### 3. Environment Variables
### 2. Environment Variables

```env
# Binance API Configuration - Must support futures trading
Expand All @@ -196,10 +165,9 @@ BINANCE_TESTNET=true # true=testnet, false=mainnet
# Other Configuration Options
LOG_LEVEL=INFO # Log level

# Telegram Configuration (Optional)
TELEGRAM_ENABLED=true
TELEGRAM_API_TOKEN=your_telegram_bot_token
TELEGRAM_CHAT_ID=your_telegram_chat_id
# Notification Configuration (Optional)
NOTIFICATION_TELEGRAM_ENABLED=true
NOTIFICATION_SLACK_ENABLED=true
```

## 📖 Usage
Expand Down Expand Up @@ -329,11 +297,6 @@ npm start -- profit --exclude-unrealized
npm start -- status
```

#### 5. Telegram Notification Test
```bash
# Test Telegram bot connection and send test message
npm start -- telegram-test
```

### Copy Trading Strategy

Expand Down Expand Up @@ -436,9 +399,6 @@ npm start -- status
# 2. View available agents
npm start -- agents

# 3. Test Telegram notifications (if configured)
npm start -- telegram-test

# 4. Risk control mode test
npm start -- follow buynhold_btc --risk-only

Expand Down Expand Up @@ -496,7 +456,6 @@ src/
│ ├── follow.ts # Copy trade command (core)
│ ├── profit.ts # Profit statistics analysis
│ ├── status.ts # System status check
│ └── telegram.ts # Telegram notification test
├── services/ # Core services
│ ├── api-client.ts # Nof1 API client
│ ├── binance-service.ts # Binance API integration
Expand All @@ -506,7 +465,6 @@ src/
│ ├── trade-history-service.ts # Trade history service
│ ├── order-history-manager.ts # Order history management
│ ├── futures-capital-manager.ts # Futures capital management
│ └── telegram-service.ts # Telegram notification service
├── scripts/
│ └── analyze-api.ts # API analysis engine (copy trading strategy)
├── types/ # TypeScript type definitions
Expand All @@ -525,7 +483,7 @@ User Command → follow handler → ApiAnalyzer analyzes agent signals
BinanceService → Binance API → Trade completed
TelegramService sends notification (if enabled)
Notification Service sends notification (if enabled)

Profit Analysis Flow:
User Command → profit handler → TradeHistoryService fetches historical trades
Expand All @@ -536,14 +494,6 @@ User Command → profit handler → TradeHistoryService fetches historical trade
Output results (table/JSON format)

Telegram Notification Flow:
Trading Executor → Trade/Order event
TelegramService.formatTradeMessage()
Send to Telegram API
User receives notification
```

## ⚠️ Important Notes
Expand Down Expand Up @@ -597,16 +547,6 @@ Error: Invalid API Key
- Confirm API key has not expired
- Verify complete key is copied (no extra spaces)

**5. Telegram Notification Issues**
```
Error: Failed to send Telegram message
```
- ✅ Check if `TELEGRAM_ENABLED=true` in `.env` file
- ✅ Verify Telegram bot token is correct (from @BotFather)
- ✅ Verify chat ID is correct (get from bot API)
- ✅ Test with `npm start -- telegram-test`
- ✅ Ensure bot has not been blocked or deleted
- ✅ Check internet connection for Telegram API access

## 🔧 Development

Expand Down
Loading