https://github.com/csgo2024/trading-service
A crypto trading service with real-time Telegram alerts (like tradingview), implementing statistical trading strategies based on price reversion to opening levels.
https://github.com/csgo2024/trading-service
alert binance crypto telegram tradingview
Last synced: 5 months ago
JSON representation
A crypto trading service with real-time Telegram alerts (like tradingview), implementing statistical trading strategies based on price reversion to opening levels.
- Host: GitHub
- URL: https://github.com/csgo2024/trading-service
- Owner: csgo2024
- License: apache-2.0
- Created: 2025-08-22T01:53:17.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-11-12T12:44:22.000Z (7 months ago)
- Last Synced: 2025-11-12T14:30:19.827Z (7 months ago)
- Topics: alert, binance, crypto, telegram, tradingview
- Language: C#
- Homepage: https://csgo2024.github.io/trading-service/
- Size: 1.58 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: changelogs/2025-08-09.md
- License: LICENSE
Awesome Lists containing this project
README
# Trading Service Documentation
A cryptocurrency trading service with real-time Telegram alerts, implementing statistical trading strategies based on price reversion to opening levels. The core strategy capitalizes on the high probability of prices returning to their opening values, executing trades at closing prices.
## 目录
- [基础命令](#基础命令)
- [策略管理](#策略管理)
- [策略类型说明](#策略类型说明)
- [策略示例](#策略示例)
- [警报管理](#警报管理)
- [部署说明](#部署说明)
## 基础命令
| 命令 | 说明 | 子命令 |
|------|------|--------|
| `/help` | 显示帮助信息 | - |
| `/debug` | 查看状态 | - |
| `/market` | 查看行情 | - |
| `/strategy` | 策略管理 | create, delete, pause, resume |
| `/alert` | 警报管理 | create, delete, empty, pause, resume |
## 策略管理
### 策略类型说明
#### RestClient 策略
- **OpenBuy** 和 **OpenSell**: 基于指定周期开盘价格执行的策略
- 特点:不需要等待收盘,自动获取当前周期的开盘价格进行下单。如果AutoReset为true,则会在每个新周期开始时取消未成交订单并重新下单
#### WebSocket 策略
- **CloseBuy** 和 **CloseSell**: 基于指定周期收盘价格执行的策略
- ⚠️ 注意:必须等待当前周期收盘后才会执行下单, 不会在新周期开始时自动更新价格下单
### 策略示例
#### 1. 现货做多策略 (OpenBuy)
```json
/strategy create {
"Symbol": "BTCUSDT",
"Amount": 1000,
"Volatility": 0.2,
"Interval": "1d",
"AccountType": "Spot",
"AutoReset": false,
"StopLossExpression": "close = 0",
"StrategyType": "OpenBuy"
}
```
#### 2. 合约做空策略 (OpenSell)
```json
/strategy create {
"Symbol": "BTCUSDT",
"Amount": 1000,
"Volatility": 0.2,
"Interval": "1d",
"AccountType": "Future",
"AutoReset": false,
"StopLossExpression": "close = 0",
"StrategyType": "OpenSell"
}
```
#### 3. WebSocket合约做空策略 (CloseSell)
```json
/strategy create {
"Symbol": "BTCUSDT",
"Amount": 1000,
"Volatility": 0.002,
"Interval": "4h",
"AccountType": "Future",
"AutoReset": false,
"StopLossExpression": "close = 0",
"StrategyType": "CloseSell"
}
```
#### 4. WebSocket合约做多策略 (CloseBuy)
```json
/strategy create {
"Symbol": "BTCUSDT",
"Amount": 1000,
"Volatility": 0.002,
"Interval": "4h",
"AccountType": "Future",
"AutoReset": false,
"StopLossExpression": "close = 0",
"StrategyType": "CloseBuy"
}
```
#### 删除策略
```
/strategy delete
```
## 警报管理
### 支持的时间间隔
- 5m (5分钟)
- 15m (15分钟)
- 1h (1小时)
- 4h (4小时)
- 1d (1天)
- 3d (3天)
- 1w (1周)
### 警报示例
#### 1. 价格波动警报
```json
/alert create {
"Symbol": "BTCUSDT",
"Interval": "4h",
"Expression": "Math.abs((close - open) / open) >= 0.02"
}
```

#### 2. 价格阈值警报
```json
/alert create {
"Symbol": "BTCUSDT",
"Interval": "4h",
"Expression": "close > 20000"
}
```
#### 3. 查看警报列表
```json
/alert
```

#### 删除指定警报
```
/alert delete
```
#### 清空所有警报
```
/alert empty
```
## 警报管理
### 调用格式
- interval 只支持 1d 4h
```
/market
```
### 调用示例(默认 BTCUSDT 1d)
```
/market
```

```
/market ETHUSDT 4h
```

## 状态查看
### 调用示例
```
/debug
```

## 部署说明
### Docker部署
1. 构建镜像:
```bash
cd Trading && docker build -t trading-api:latest -f "src/Trading.API/Dockerfile" .
```
2. 使用deploy.sh部署:
```bash
./deploy.sh
```