refactor(okxNewPrice): 更新配置并优化网格交易初始化逻辑
- 更新OKX UAT测试环境的API密钥和密钥ID
- 重构网格策略启动逻辑,每次重启时重新获取账户本金作为基准
- 添加refreshInitialPrincipal方法用于获取最新账户权益
- 将交易对从ETH-USDT-SWAP更改为BTC-USDT-SWAP
- 改进日志记录,显示启动时的当前本金信息
| | |
| | | longPriceQueue.clear(); |
| | | currentLongOrderIds.clear(); |
| | | currentShortOrderIds.clear(); |
| | | log.info("[Gate] 网格策略已启动"); |
| | | |
| | | // 每次重启重新获取当前本金 |
| | | refreshInitialPrincipal(); |
| | | |
| | | log.info("[Gate] 网格策略已启动, 当前本金: {} USDT", initialPrincipal); |
| | | } |
| | | |
| | | /** |
| | | * 重新获取当前账户权益作为初始本金。 |
| | | */ |
| | | private void refreshInitialPrincipal() { |
| | | try { |
| | | FuturesAccount account = futuresApi.listFuturesAccounts(SETTLE); |
| | | this.initialPrincipal = new BigDecimal(account.getTotal()); |
| | | } catch (Exception e) { |
| | | log.warn("[Gate] 获取初始化本金失败,使用旧值: {}", initialPrincipal); |
| | | } |
| | | } |
| | | |
| | | /** |