fix(gateApi): 修复双向持仓模式下的杠杆设置功能
- 更新文档中的API接口路径和方法名,将updateContractPositionLeverageCall改为updateDualModePositionLeverageCall
- 修改Example.java中的杠杆设置方法调用,适配双向持仓模式
- 移除position_mode参数,因为新方法不再需要此参数
- 为杠杆设置功能添加双向持仓模式专用的注释说明
| | |
| | | } |
| | | |
| | | /** |
| | | * 设置杠杆倍数 |
| | | * 设置杠杆倍数(双向持仓模式专用) |
| | | * 设置合理的杠杆倍数,不能为0 |
| | | */ |
| | | String leverage = "25"; |
| | | futuresApi.updateContractPositionLeverageCall( |
| | | futuresApi.updateDualModePositionLeverageCall( |
| | | settle, |
| | | contract, |
| | | leverage, |
| | | marginMode, |
| | | position_mode, |
| | | null); |
| | | } catch (GateApiException e) { |
| | | System.err.println(String.format("Gate api exception, label: %s, message: %s", e.getErrorLabel(), e.getMessage())); |
| | |
| | | |
| | | closeExistingPositions(); |
| | | |
| | | futuresApi.updateContractPositionLeverageCall( |
| | | futuresApi.updateDualModePositionLeverageCall( |
| | | SETTLE, config.getContract(), config.getLeverage(), |
| | | config.getMarginMode(), config.getPositionMode(), null); |
| | | config.getMarginMode(), null); |
| | | log.info("[Gate] 杠杆: {}x {}", config.getLeverage(), config.getMarginMode()); |
| | | } catch (GateApiException e) { |
| | | log.error("[Gate] 初始化失败, label:{}, msg:{}", e.getErrorLabel(), e.getMessage()); |
| | |
| | | | 切持仓模式 | `POST /futures/usdt/set_position_mode` | `FuturesApi.setPositionMode()` | | |
| | | | 查仓位 | `GET /futures/usdt/positions` | `FuturesApi.listPositions()` | 遍历所有仓位,按合约过滤 | |
| | | | 市价平仓 | `POST /futures/usdt/orders` | `FuturesApi.createFuturesOrder()` | reduce_only, IOC。双向: size=0+close=false+autoSize | |
| | | | 设杠杆 | `POST /futures/usdt/positions/{contract}/leverage` | `FuturesApi.updateContractPositionLeverageCall()` | | |
| | | | 设杠杆 | `POST /futures/usdt/dual_comp/positions/{contract}/leverage` | `FuturesApi.updateDualModePositionLeverageCall()` | 双向模式专用 | |
| | | | 查账户 | `GET /futures/usdt/accounts` | `FuturesApi.listFuturesAccounts()` | 获取初始本金和保证金 | |
| | | | 清除条件单 | `DELETE /futures/usdt/price_orders` | `FuturesApi.cancelPriceTriggeredOrderList()` | | |
| | | | 市价单 | `POST /futures/usdt/orders` | `FuturesApi.createFuturesOrder()` | price=0, tif=IOC | |