Discard config settings in MD

This commit is contained in:
icy
2025-10-31 13:28:06 +08:00
8 changed files with 98 additions and 66 deletions

View File

@@ -10,7 +10,9 @@
## 配置方式 ## 配置方式
`config.json` 中添加使用自定义 API 的 trader ~~在 `config.json` 中添加使用自定义 API 的 trader~~
*注意现在通过Web界面配置自定义API不再使用config.json文件*
```json ```json
{ {

View File

@@ -49,11 +49,13 @@ docker compose --version # Docker 24+ includes this, no separate installation n
### Step 1: Prepare Configuration File ### Step 1: Prepare Configuration File
```bash ```bash
# Copy configuration template # ~~Copy configuration template~~
cp config.json.example config.json # ~~cp config.example.jsonc config.json~~
# Edit configuration file with your API keys # ~~Edit configuration file with your API keys~~
nano config.json # or use any other editor # ~~nano config.json # or use any other editor~~
⚠️ **Note**: Configuration is now done through the web interface, no longer using JSON files.
``` ```
**Required fields:** **Required fields:**
@@ -216,7 +218,7 @@ The system automatically persists data to local directories:
- `./decision_logs/`: AI decision logs - `./decision_logs/`: AI decision logs
- `./coin_pool_cache/`: Coin pool cache - `./coin_pool_cache/`: Coin pool cache
- `./config.json`: Configuration file (mounted) - ~~`./config.json`: Configuration file (mounted)~~ (Deprecated)
**Data locations:** **Data locations:**
```bash ```bash
@@ -225,7 +227,7 @@ ls -la decision_logs/
ls -la coin_pool_cache/ ls -la coin_pool_cache/
# Backup data # Backup data
tar -czf backup_$(date +%Y%m%d).tar.gz decision_logs/ coin_pool_cache/ config.json tar -czf backup_$(date +%Y%m%d).tar.gz decision_logs/ coin_pool_cache/ ~~config.json~~ trading.db
# Restore data # Restore data
tar -xzf backup_20241029.tar.gz tar -xzf backup_20241029.tar.gz
@@ -261,11 +263,13 @@ kill -9 <PID>
### Configuration File Not Found ### Configuration File Not Found
```bash ```bash
# Ensure config.json exists # ~~Ensure config.json exists~~
ls -la config.json # ~~ls -la config.json~~
# If not exists, copy template # ~~If not exists, copy template~~
cp config.json.example config.json # ~~cp config.example.jsonc config.json~~
*Note: Now using SQLite database for configuration storage, no longer need config.json*
``` ```
### Health Check Failing ### Health Check Failing
@@ -305,11 +309,13 @@ docker system prune -a --volumes
## 🔐 Security Recommendations ## 🔐 Security Recommendations
1. **Don't commit config.json to Git** 1. ~~**Don't commit config.json to Git**~~
```bash ```bash
# Ensure config.json is in .gitignore # ~~Ensure config.json is in .gitignore~~
echo "config.json" >> .gitignore # ~~echo "config.json" >> .gitignore~~
``` ```
*Note: Now using trading.db database, ensure not to commit sensitive data*
2. **Use environment variables for sensitive data** 2. **Use environment variables for sensitive data**
```yaml ```yaml

View File

@@ -55,7 +55,7 @@ docker compose --version # Docker 24+ 自带,无需单独安装
```bash ```bash
# 复制配置文件模板 # 复制配置文件模板
cp config.json.example config.json cp config.example.jsonc config.json
# 编辑配置文件,填入你的 API 密钥 # 编辑配置文件,填入你的 API 密钥
nano config.json # 或使用其他编辑器 nano config.json # 或使用其他编辑器
@@ -270,7 +270,7 @@ kill -9 <PID>
ls -la config.json ls -la config.json
# 如果不存在,复制模板 # 如果不存在,复制模板
cp config.json.example config.json cp config.example.jsonc config.json
``` ```
### 健康检查失败 ### 健康检查失败
@@ -325,11 +325,13 @@ docker system prune -a --volumes
- 在生产环境中绝不使用默认值 - 在生产环境中绝不使用默认值
- 定期更换(会使现有用户需要重新登录) - 定期更换(会使现有用户需要重新登录)
2. **不要将 config.json 提交到 Git** 2. ~~**不要将 config.json 提交到 Git**~~
```bash ```bash
# 确保 config.json 在 .gitignore 中 # ~~确保 config.json 在 .gitignore 中~~
echo "config.json" >> .gitignore # ~~echo "config.json" >> .gitignore~~
``` ```
*注意现在使用trading.db数据库请确保不提交敏感数据*
3. **使用环境变量存储敏感信息** 3. **使用环境变量存储敏感信息**
```yaml ```yaml

View File

@@ -206,8 +206,11 @@ go build -o nofx
### 后端无法启动 ### 后端无法启动
```bash ```bash
# 检查 config.json 是否存在 # ~~检查 config.json 是否存在~~
ls -l config.json # ~~ls -l config.json~~
# 检查数据库文件是否存在
ls -l trading.db
# 检查权限 # 检查权限
chmod +x nofx chmod +x nofx

View File

@@ -79,7 +79,7 @@ A Binance-compatible decentralized perpetual futures exchange!
1. Visit [Aster API Wallet](https://www.asterdex.com/en/api-wallet) 1. Visit [Aster API Wallet](https://www.asterdex.com/en/api-wallet)
2. Connect your main wallet and create an API wallet 2. Connect your main wallet and create an API wallet
3. Copy the API Signer address and Private Key 3. Copy the API Signer address and Private Key
4. Set `"exchange": "aster"` in config.json 4. ~~Set `"exchange": "aster"` in config.json~~ *Configure through web interface*
5. Add `"aster_user"`, `"aster_signer"`, and `"aster_private_key"` 5. Add `"aster_user"`, `"aster_signer"`, and `"aster_private_key"`
--- ---
@@ -156,7 +156,7 @@ A Binance-compatible decentralized perpetual futures exchange!
``` ```
nofx/ nofx/
├── main.go # Program entry (multi-trader manager) ├── main.go # Program entry (multi-trader manager)
├── config.json # Configuration file (API keys, multi-trader config) ├── ~~config.json~~ # ~~Configuration file (API keys, multi-trader config)~~ (Deprecated: Use web interface)
├── api/ # HTTP API service ├── api/ # HTTP API service
│ └── server.go # Gin framework, RESTful API │ └── server.go # Gin framework, RESTful API
@@ -232,7 +232,7 @@ Before using this system, you need a Binance Futures account. **Use our referral
5. **Create API Key**: 5. **Create API Key**:
- Go to Account API Management - Go to Account API Management
- Create new API key, **enable "Futures" permission** - Create new API key, **enable "Futures" permission**
- Save API Key and Secret Key (needed for config.json) - Save API Key and Secret Key (~~needed for config.json~~) *needed for web interface*
- **Important**: Whitelist your IP address for security - **Important**: Whitelist your IP address for security
### Fee Discount Benefits: ### Fee Discount Benefits:
@@ -251,7 +251,17 @@ Before using this system, you need a Binance Futures account. **Use our referral
Docker automatically handles all dependencies (Go, Node.js, TA-Lib, SQLite) and environment setup. Docker automatically handles all dependencies (Go, Node.js, TA-Lib, SQLite) and environment setup.
#### Step 1: One-Click Start #### ~~Step 1: Prepare Configuration~~ (Deprecated)
```bash
# ~~Copy configuration template~~
# ~~cp config.example.jsonc config.json~~
# ~~Edit and fill in your API keys~~
# ~~nano config.json # or use any editor~~
```
**Note**: Configuration is now done through the web interface, not JSON files.
#### Step 2: One-Click Start
```bash ```bash
# Option 1: Use convenience script (Recommended) # Option 1: Use convenience script (Recommended)
chmod +x start.sh chmod +x start.sh
@@ -462,7 +472,7 @@ Open your browser and visit: **🌐 http://localhost:3000**
3. **Remove the `0x` prefix** from the key 3. **Remove the `0x` prefix** from the key
4. Fund your wallet on [Hyperliquid](https://hyperliquid.xyz) 4. Fund your wallet on [Hyperliquid](https://hyperliquid.xyz)
**Step 2**: Configure `config.json` for Hyperliquid **Step 2**: ~~Configure `config.json` for Hyperliquid~~ *Configure through web interface*
```json ```json
{ {
@@ -516,7 +526,7 @@ Open your browser and visit: **🌐 http://localhost:3000**
- API Wallet address (Signer) - API Wallet address (Signer)
- API Wallet Private Key (⚠ shown only once!) - API Wallet Private Key (⚠ shown only once!)
**Step 2**: Configure `config.json` for Aster **Step 2**: ~~Configure `config.json` for Aster~~ *Configure through web interface*
```json ```json
{ {
@@ -634,8 +644,10 @@ For running multiple AI traders competing against each other:
| `oi_top_api_url` | Open interest API<br>*Optional supplement data* | `""` (empty) | ❌ No | | `oi_top_api_url` | Open interest API<br>*Optional supplement data* | `""` (empty) | ❌ No |
| `api_server_port` | Web dashboard port | `8080` | ✅ Yes | | `api_server_port` | Web dashboard port | `8080` | ✅ Yes |
**Default Trading Coins** (when `use_default_coins: true`): ~~**Default Trading Coins** (when `use_default_coins: true`):
- BTC, ETH, SOL, BNB, XRP, DOGE, ADA, HYPE - BTC, ETH, SOL, BNB, XRP, DOGE, ADA, HYPE~~
*Note: Trading coins are now configured through the web interface*
--- ---
@@ -645,14 +657,16 @@ For running multiple AI traders competing against each other:
The leverage settings control the maximum leverage the AI can use for each trade. This is crucial for risk management, especially for Binance subaccounts which have leverage restrictions. The leverage settings control the maximum leverage the AI can use for each trade. This is crucial for risk management, especially for Binance subaccounts which have leverage restrictions.
**Configuration format:** ~~**Configuration format:**~~
```json ~~```json
"leverage": { "leverage": {
"btc_eth_leverage": 5, // Maximum leverage for BTC and ETH "btc_eth_leverage": 5, // Maximum leverage for BTC and ETH
"altcoin_leverage": 5 // Maximum leverage for all other coins "altcoin_leverage": 5 // Maximum leverage for all other coins
} }
``` ```~~
*Note: Leverage is now configured through the web interface*
**⚠️ Important: Binance Subaccount Restrictions** **⚠️ Important: Binance Subaccount Restrictions**
@@ -671,21 +685,23 @@ The leverage settings control the maximum leverage the AI can use for each trade
**Examples:** **Examples:**
**Safe configuration (subaccount or conservative):** ~~**Safe configuration (subaccount or conservative):**~~
```json ~~```json
"leverage": { "leverage": {
"btc_eth_leverage": 5, "btc_eth_leverage": 5,
"altcoin_leverage": 5 "altcoin_leverage": 5
} }
``` ```~~
**Aggressive configuration (main account only):** ~~**Aggressive configuration (main account only):**~~
```json ~~```json
"leverage": { "leverage": {
"btc_eth_leverage": 20, "btc_eth_leverage": 20,
"altcoin_leverage": 15 "altcoin_leverage": 15
} }
``` ```~~
*Note: Leverage configuration is now done through the web interface*
**How AI uses leverage:** **How AI uses leverage:**
@@ -768,7 +784,7 @@ go build -o nofx
|--------------|----------| |--------------|----------|
| `invalid API key` | Check your Binance API key in config.json | | `invalid API key` | Check your Binance API key in config.json |
| `TA-Lib not found` | Run `brew install ta-lib` (macOS) | | `TA-Lib not found` | Run `brew install ta-lib` (macOS) |
| `port 8080 already in use` | Change `api_server_port` in config.json | | `port 8080 already in use` | ~~Change `api_server_port` in config.json~~ *Change `API_PORT` in .env file* |
| `DeepSeek API error` | Verify your DeepSeek API key and balance | | `DeepSeek API error` | Verify your DeepSeek API key and balance |
**✅ Backend is running correctly when you see:** **✅ Backend is running correctly when you see:**
@@ -1168,7 +1184,7 @@ sudo apt-get install libta-lib0-dev
**Solution**: **Solution**:
- Coin pool API is optional - Coin pool API is optional
- If API fails, system uses default mainstream coins (BTC, ETH, etc.) - If API fails, system uses default mainstream coins (BTC, ETH, etc.)
- Check API URL and auth parameter in config.json - ~~Check API URL and auth parameter in config.json~~ *Check configuration in web interface*
--- ---
@@ -1227,7 +1243,7 @@ This is a **major breaking update** that completely transforms NOFX from a stati
-**Code Organization**: Better separation between database, API, and business logic -**Code Organization**: Better separation between database, API, and business logic
**Migration Notes:** **Migration Notes:**
- ⚠️ **Breaking Change**: Old `config.json` files are no longer used - ⚠️ **Breaking Change**: Old ~~`config.json`~~ files are no longer used
- ⚠️ **Fresh Start**: All configurations must be redone through web interface - ⚠️ **Fresh Start**: All configurations must be redone through web interface
-**Easier Setup**: Web-based configuration is much more user-friendly -**Easier Setup**: Web-based configuration is much more user-friendly
-**Better UX**: No more server restarts for configuration changes -**Better UX**: No more server restarts for configuration changes

View File

@@ -184,7 +184,7 @@ Docker автоматически обрабатывает все зависим
#### Шаг 1: Подготовьте конфигурацию #### Шаг 1: Подготовьте конфигурацию
```bash ```bash
# Скопируйте шаблон конфигурации # Скопируйте шаблон конфигурации
cp config.json.example config.json cp config.example.jsonc config.json
# Отредактируйте и заполните ваши API ключи # Отредактируйте и заполните ваши API ключи
nano config.json # или используйте любой редактор nano config.json # или используйте любой редактор
@@ -322,7 +322,7 @@ cd ..
**Шаг 1**: Скопируйте и переименуйте файл примера конфигурации **Шаг 1**: Скопируйте и переименуйте файл примера конфигурации
```bash ```bash
cp config.json.example config.json cp config.example.jsonc config.json
``` ```
**Шаг 2**: Отредактируйте `config.json` и заполните ваши API ключи **Шаг 2**: Отредактируйте `config.json` и заполните ваши API ключи
@@ -694,7 +694,7 @@ go build -o nofx
|---------------------|---------| |---------------------|---------|
| `invalid API key` | Проверьте Binance API ключи в config.json | | `invalid API key` | Проверьте Binance API ключи в config.json |
| `TA-Lib not found` | Выполните `brew install ta-lib` (macOS) | | `TA-Lib not found` | Выполните `brew install ta-lib` (macOS) |
| `port 8080 already in use` | Измените `api_server_port` в config.json | | `port 8080 already in use` | ~~Измените `api_server_port` в config.json~~ *Измените `API_PORT` в файле .env* |
| `DeepSeek API error` | Проверьте DeepSeek API ключ и баланс | | `DeepSeek API error` | Проверьте DeepSeek API ключ и баланс |
**✅ Признаки работы Backend:** **✅ Признаки работы Backend:**

View File

@@ -184,7 +184,7 @@ Docker автоматично обробляє всі залежності (Go,
#### Крок 1: Підготуйте конфігурацію #### Крок 1: Підготуйте конфігурацію
```bash ```bash
# Скопіюйте шаблон конфігурації # Скопіюйте шаблон конфігурації
cp config.json.example config.json cp config.example.jsonc config.json
# Відредагуйте та заповніть ваші API ключі # Відредагуйте та заповніть ваші API ключі
nano config.json # або використайте будь-який редактор nano config.json # або використайте будь-який редактор
@@ -322,7 +322,7 @@ cd ..
**Крок 1**: Скопіюйте та перейменуйте файл прикладу конфігурації **Крок 1**: Скопіюйте та перейменуйте файл прикладу конфігурації
```bash ```bash
cp config.json.example config.json cp config.example.jsonc config.json
``` ```
**Крок 2**: Відредагуйте `config.json` та заповніть ваші API ключі **Крок 2**: Відредагуйте `config.json` та заповніть ваші API ключі
@@ -694,7 +694,7 @@ go build -o nofx
|--------------------------|---------| |--------------------------|---------|
| `invalid API key` | Перевірте Binance API ключі в config.json | | `invalid API key` | Перевірте Binance API ключі в config.json |
| `TA-Lib not found` | Виконайте `brew install ta-lib` (macOS) | | `TA-Lib not found` | Виконайте `brew install ta-lib` (macOS) |
| `port 8080 already in use` | Змініть `api_server_port` в config.json | | `port 8080 already in use` | ~~Змініть `api_server_port` в config.json~~ *Змініть `API_PORT` у файлі .env* |
| `DeepSeek API error` | Перевірте DeepSeek API ключ та баланс | | `DeepSeek API error` | Перевірте DeepSeek API ключ та баланс |
**✅ Ознаки роботи Backend:** **✅ Ознаки роботи Backend:**

View File

@@ -46,7 +46,7 @@ NOFX现已支持**三大交易所**Binance、Hyperliquid和Aster DEX
**快速开始:** **快速开始:**
1. 获取你的MetaMask私钥去掉`0x`前缀) 1. 获取你的MetaMask私钥去掉`0x`前缀)
2. 在config.json中设置`"exchange": "hyperliquid"` 2. ~~在config.json中设置`"exchange": "hyperliquid"`~~ *通过Web界面配置*
3. 添加`"hyperliquid_private_key": "your_key"` 3. 添加`"hyperliquid_private_key": "your_key"`
4. 开始交易! 4. 开始交易!
@@ -73,7 +73,7 @@ NOFX现已支持**三大交易所**Binance、Hyperliquid和Aster DEX
1. 访问[Aster API钱包](https://www.asterdex.com/en/api-wallet) 1. 访问[Aster API钱包](https://www.asterdex.com/en/api-wallet)
2. 连接你的主钱包并创建API钱包 2. 连接你的主钱包并创建API钱包
3. 复制API Signer地址和私钥 3. 复制API Signer地址和私钥
4. 在config.json中设置`"exchange": "aster"` 4. ~~在config.json中设置`"exchange": "aster"`~~ *通过Web界面配置*
5. 添加`"aster_user"``"aster_signer"``"aster_private_key"` 5. 添加`"aster_user"``"aster_signer"``"aster_private_key"`
--- ---
@@ -150,7 +150,7 @@ NOFX现已支持**三大交易所**Binance、Hyperliquid和Aster DEX
``` ```
nofx/ nofx/
├── main.go # 程序入口多trader管理器 ├── main.go # 程序入口多trader管理器
├── config.json # 配置文件API密钥、多trader配置 ├── ~~config.json~~ # ~~配置文件API密钥、多trader配置~~ (已弃用使用Web界面)
├── api/ # HTTP API服务 ├── api/ # HTTP API服务
│ └── server.go # Gin框架RESTful API │ └── server.go # Gin框架RESTful API
@@ -226,7 +226,7 @@ nofx/
5. **创建API密钥** 5. **创建API密钥**
- 进入账户 API管理 - 进入账户 API管理
- 创建新的API密钥**务必勾选"合约"权限** - 创建新的API密钥**务必勾选"合约"权限**
- 保存API Key和Secret Keyconfig.json中需要 - 保存API Key和Secret Key~~config.json中需要~~ *Web界面中需要*
- **重要**添加IP白名单以确保安全 - **重要**添加IP白名单以确保安全
### 手续费优惠说明: ### 手续费优惠说明:
@@ -245,14 +245,15 @@ nofx/
Docker会自动处理所有依赖GoNode.jsTA-Lib和环境配置完美适合新手 Docker会自动处理所有依赖GoNode.jsTA-Lib和环境配置完美适合新手
#### 步骤1准备配置文件 #### ~~步骤1准备配置文件~~ (已弃用)
```bash ```bash
# 复制配置文件模板 # ~~复制配置文件模板~~
cp config.json.example config.json # ~~cp config.example.jsonc config.json~~
# 编辑并填入你的API密钥 # ~~编辑并填入你的API密钥~~
nano config.json # 或使用其他编辑器 # ~~nano config.json # 或使用其他编辑器~~
``` ```
**注意**: 现在通过Web界面进行配置不再使用JSON文件
#### 步骤2一键启动 #### 步骤2一键启动
```bash ```bash
@@ -382,13 +383,15 @@ cd ..
#### 🌟 新手模式配置(推荐) #### 🌟 新手模式配置(推荐)
**步骤1**复制并重命名示例配置文件 ~~**步骤1**复制并重命名示例配置文件~~
```bash ~~```bash
cp config.json.example config.json cp config.example.jsonc config.json
``` ```~~
**步骤2**编辑`config.json`填入您的API密钥 ~~**步骤2**:编辑`config.json`填入您的API密钥~~
*现在通过Web界面配置无需编辑JSON文件*
```json ```json
{ {
@@ -453,7 +456,7 @@ cp config.json.example config.json
3. **去掉`0x`前缀** 3. **去掉`0x`前缀**
4. [Hyperliquid](https://hyperliquid.xyz)上为钱包充值 4. [Hyperliquid](https://hyperliquid.xyz)上为钱包充值
**步骤2**为Hyperliquid配置`config.json` ~~**步骤2**为Hyperliquid配置`config.json`~~ *通过Web界面配置*
```json ```json
{ {
@@ -507,7 +510,7 @@ cp config.json.example config.json
- API钱包地址Signer - API钱包地址Signer
- API钱包私钥(⚠ 仅显示一次 - API钱包私钥(⚠ 仅显示一次
**步骤2**为Aster配置`config.json` ~~**步骤2**为Aster配置`config.json`~~ *通过Web界面配置*
```json ```json
{ {
@@ -755,9 +758,9 @@ go build -o nofx
| 错误信息 | 解决方案 | | 错误信息 | 解决方案 |
|---------|---------| |---------|---------|
| `invalid API key` | 检查config.json中的币安API密钥 | | `invalid API key` | ~~检查config.json中的币安API密钥~~ *检查Web界面中的API密钥* |
| `TA-Lib not found` | 运行`brew install ta-lib`macOS | | `TA-Lib not found` | 运行`brew install ta-lib`macOS |
| `port 8080 already in use` | 修改config.json中的`api_server_port` | | `port 8080 already in use` | ~~修改config.json中的`api_server_port`~~ *修改.env文件中的`API_PORT`* |
| `DeepSeek API error` | 验证DeepSeek API密钥和余额 | | `DeepSeek API error` | 验证DeepSeek API密钥和余额 |
**✅ 后端运行正常的标志:** **✅ 后端运行正常的标志:**
@@ -1194,7 +1197,7 @@ sudo apt-get install libta-lib0-dev
**解决**: **解决**:
- 币种池API是可选的 - 币种池API是可选的
- 如果API失败系统会使用默认主流币种BTC、ETH等 - 如果API失败系统会使用默认主流币种BTC、ETH等
- 检查config.json中的API URL和auth参数 - ~~检查config.json中的API URL和auth参数~~ *检查Web界面中的配置*
--- ---