# 配置文件说明 ## 📋 核心配置文件 ### 1. `accounts.json` - 账户配置 ```json [ { "id": "account-1", "name": "主账户", "privateKey": "YOUR_PRIVATE_KEY_HERE", "address": "YOUR_WALLET_ADDRESS_HERE", "isActive": true } ] ``` **字段说明:** - `id`: 账户唯一标识 - `name`: 账户名称 - `privateKey`: 钱包私钥(用于签名交易) - `address`: 钱包地址 - `isActive`: 是否启用该账户 ### 2. `system-config.json` - 系统配置 ```json { "system": { "name": "PacificaWashTradingSystem", "version": "1.0.0", "environment": "development", "logLevel": "info", "timezone": "Asia/Shanghai" }, "defaults": { "symbol": "BTC-PERP", "maxSessions": 2 } } ``` **字段说明:** - `system.name`: 系统名称 - `system.version`: 系统版本 - `system.environment`: 运行环境 - `system.logLevel`: 日志级别 - `system.timezone`: 时区设置 - `defaults.symbol`: 默认交易对 - `defaults.maxSessions`: 最大并发会话数 ### 3. `strategies.json` - 策略配置 ```json [ { "id": "delta-neutral-strategy", "name": "Delta中性敞口持仓策略", "enabled": true, "type": "DELTA_NEUTRAL", "symbol": "BTC-PERP", "accounts": ["account-1", "account-2"], "parameters": { "targetDeltaRatio": 0.6, "hedgeRatio": 0.4, "hedgeInterval": 3000 }, "triggers": [ { "type": "frequency", "interval": 30000, "enabled": true } ] } ] ``` **字段说明:** - `id`: 策略唯一标识 - `name`: 策略名称 - `enabled`: 是否启用 - `type`: 策略类型 - `symbol`: 交易对符号 - `accounts`: 参与的账户ID列表 - `parameters`: 策略参数 - `triggers`: 触发器配置 ## 🚀 快速开始 ### 1. 配置账户 编辑 `accounts.json`,填入您的钱包信息: ```json [ { "id": "account-1", "name": "主账户", "privateKey": "0x你的私钥", "address": "0x你的地址", "isActive": true } ] ``` ### 2. 配置系统 编辑 `system-config.json`,设置系统参数: ```json { "system": { "name": "PacificaWashTradingSystem", "version": "1.0.0", "environment": "development", "logLevel": "info", "timezone": "Asia/Shanghai" }, "defaults": { "symbol": "BTC-PERP", "maxSessions": 2 } } ``` ### 3. 配置策略 编辑 `strategies.json`,设置交易策略: ```json [ { "id": "delta-neutral-strategy", "name": "Delta中性敞口持仓策略", "enabled": true, "type": "DELTA_NEUTRAL", "symbol": "BTC-PERP", "accounts": ["account-1", "account-2"], "parameters": { "targetDeltaRatio": 0.6, "hedgeRatio": 0.4, "hedgeInterval": 3000 }, "triggers": [ { "type": "frequency", "interval": 30000, "enabled": true } ] } ] ``` ## ⚠️ 安全注意事项 1. **私钥安全**: 私钥信息敏感,请妥善保管 2. **文件权限**: 确保配置文件只有您有读写权限 3. **备份**: 定期备份配置文件 4. **测试**: 先在测试环境验证配置 ## 📅 Cron 表达式示例 ```bash # 每天上午9点执行 0 9 * * * # 每6小时执行一次 0 */6 * * * # 每分钟执行一次 */1 * * * * # 每周一上午9点执行 0 9 * * 1 ``` ## 🔧 配置验证 系统启动时会自动验证配置文件: - 检查必要字段是否存在 - 验证数据格式是否正确 - 检查账户配置是否有效 如有配置错误,系统会记录错误日志并停止启动。