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
{

View File

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

View File

@@ -55,7 +55,7 @@ docker compose --version # Docker 24+ 自带,无需单独安装
```bash
# 复制配置文件模板
cp config.json.example config.json
cp config.example.jsonc config.json
# 编辑配置文件,填入你的 API 密钥
nano config.json # 或使用其他编辑器
@@ -270,7 +270,7 @@ kill -9 <PID>
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
# 确保 config.json 在 .gitignore 中
echo "config.json" >> .gitignore
# ~~确保 config.json 在 .gitignore 中~~
# ~~echo "config.json" >> .gitignore~~
```
*注意现在使用trading.db数据库请确保不提交敏感数据*
3. **使用环境变量存储敏感信息**
```yaml

View File

@@ -206,8 +206,11 @@ go build -o nofx
### 后端无法启动
```bash
# 检查 config.json 是否存在
ls -l config.json
# ~~检查 config.json 是否存在~~
# ~~ls -l config.json~~
# 检查数据库文件是否存在
ls -l trading.db
# 检查权限
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)
2. Connect your main wallet and create an API wallet
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"`
---
@@ -156,7 +156,7 @@ A Binance-compatible decentralized perpetual futures exchange!
```
nofx/
├── 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
│ └── 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**:
- Go to Account API Management
- 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
### 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.
#### 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
# Option 1: Use convenience script (Recommended)
chmod +x start.sh
@@ -462,7 +472,7 @@ Open your browser and visit: **🌐 http://localhost:3000**
3. **Remove the `0x` prefix** from the key
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
{
@@ -516,7 +526,7 @@ Open your browser and visit: **🌐 http://localhost:3000**
- API Wallet address (Signer)
- 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
{
@@ -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 |
| `api_server_port` | Web dashboard port | `8080` | ✅ Yes |
**Default Trading Coins** (when `use_default_coins: true`):
- BTC, ETH, SOL, BNB, XRP, DOGE, ADA, HYPE
~~**Default Trading Coins** (when `use_default_coins: true`):
- 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.
**Configuration format:**
~~**Configuration format:**~~
```json
~~```json
"leverage": {
"btc_eth_leverage": 5, // Maximum leverage for BTC and ETH
"altcoin_leverage": 5 // Maximum leverage for all other coins
}
```
```~~
*Note: Leverage is now configured through the web interface*
**⚠️ Important: Binance Subaccount Restrictions**
@@ -671,21 +685,23 @@ The leverage settings control the maximum leverage the AI can use for each trade
**Examples:**
**Safe configuration (subaccount or conservative):**
```json
~~**Safe configuration (subaccount or conservative):**~~
~~```json
"leverage": {
"btc_eth_leverage": 5,
"altcoin_leverage": 5
}
```
```~~
**Aggressive configuration (main account only):**
```json
~~**Aggressive configuration (main account only):**~~
~~```json
"leverage": {
"btc_eth_leverage": 20,
"altcoin_leverage": 15
}
```
```~~
*Note: Leverage configuration is now done through the web interface*
**How AI uses leverage:**
@@ -768,7 +784,7 @@ go build -o nofx
|--------------|----------|
| `invalid API key` | Check your Binance API key in config.json |
| `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 |
**✅ Backend is running correctly when you see:**
@@ -1168,7 +1184,7 @@ sudo apt-get install libta-lib0-dev
**Solution**:
- Coin pool API is optional
- 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
**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
-**Easier Setup**: Web-based configuration is much more user-friendly
-**Better UX**: No more server restarts for configuration changes

View File

@@ -184,7 +184,7 @@ Docker автоматически обрабатывает все зависим
#### Шаг 1: Подготовьте конфигурацию
```bash
# Скопируйте шаблон конфигурации
cp config.json.example config.json
cp config.example.jsonc config.json
# Отредактируйте и заполните ваши API ключи
nano config.json # или используйте любой редактор
@@ -322,7 +322,7 @@ cd ..
**Шаг 1**: Скопируйте и переименуйте файл примера конфигурации
```bash
cp config.json.example config.json
cp config.example.jsonc config.json
```
**Шаг 2**: Отредактируйте `config.json` и заполните ваши API ключи
@@ -694,7 +694,7 @@ go build -o nofx
|---------------------|---------|
| `invalid API key` | Проверьте Binance API ключи в config.json |
| `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 ключ и баланс |
**✅ Признаки работы Backend:**

View File

@@ -184,7 +184,7 @@ Docker автоматично обробляє всі залежності (Go,
#### Крок 1: Підготуйте конфігурацію
```bash
# Скопіюйте шаблон конфігурації
cp config.json.example config.json
cp config.example.jsonc config.json
# Відредагуйте та заповніть ваші API ключі
nano config.json # або використайте будь-який редактор
@@ -322,7 +322,7 @@ cd ..
**Крок 1**: Скопіюйте та перейменуйте файл прикладу конфігурації
```bash
cp config.json.example config.json
cp config.example.jsonc config.json
```
**Крок 2**: Відредагуйте `config.json` та заповніть ваші API ключі
@@ -694,7 +694,7 @@ go build -o nofx
|--------------------------|---------|
| `invalid API key` | Перевірте Binance API ключі в config.json |
| `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 ключ та баланс |
**✅ Ознаки роботи Backend:**

View File

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