Administrator
2026-09-30 e9f583d2001eddac955a830405519fdfbabc059c
feat(gateApi): 添加基础仓位止盈网格功能

- 新增单格止盈张数和止盈网格数量配置参数
- 实现基础仓位止盈挂单逻辑,支持与超额止盈并行挂单
- 将止盈订单从单一ID改为列表存储以支持多笔止盈单
- 更新止盈订单的创建、清理和取消逻辑
- 修改网格元素数据结构支持多个止盈订单ID
- 完善止盈订单索引管理和状态跟踪功能
4 files modified
12 ■■■■■ changed files
src/main/java/com/xcong/excoin/modules/station/entity/StrategyStatus.java 4 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/station/service/impl/StationServiceImpl.java 2 ●●●●● patch | view | raw | blame | history
src/main/resources/db/station-schema.sql 4 ●●●●● patch | view | raw | blame | history
src/main/resources/static/station-dashboard.html 2 ●●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/station/entity/StrategyStatus.java
@@ -88,8 +88,8 @@
    /** 对向加仓挂单数量 */
    private Integer tpTriggerOppositeAddQuantity;
    /** 单格止盈张数(基础仓位止盈:每个网格挂的止盈张数) */
    private Integer baseTakeProfitPerGrid;
    /** 单格止盈张数(基础仓位止盈:每个网格挂的止盈张数,支持小数) */
    private String baseTakeProfitPerGrid;
    /** 止盈网格数量(基础仓位止盈:挂止盈的网格数量) */
    private Integer baseTakeProfitGridCount;
src/main/java/com/xcong/excoin/modules/station/service/impl/StationServiceImpl.java
@@ -248,7 +248,7 @@
        if (params.containsKey("shortStopLossPrice")) status.setShortStopLossPrice(str(params.get("shortStopLossPrice")));
        if (params.containsKey("tpTriggerOppositeAddEnabled")) status.setTpTriggerOppositeAddEnabled(boolVal(params.get("tpTriggerOppositeAddEnabled")));
        if (params.containsKey("tpTriggerOppositeAddQuantity")) status.setTpTriggerOppositeAddQuantity(intVal(params.get("tpTriggerOppositeAddQuantity")));
        if (params.containsKey("baseTakeProfitPerGrid")) status.setBaseTakeProfitPerGrid(intVal(params.get("baseTakeProfitPerGrid")));
        if (params.containsKey("baseTakeProfitPerGrid")) status.setBaseTakeProfitPerGrid(str(params.get("baseTakeProfitPerGrid")));
        if (params.containsKey("baseTakeProfitGridCount")) status.setBaseTakeProfitGridCount(intVal(params.get("baseTakeProfitGridCount")));
        if (params.containsKey("rounds")) status.setTotalRounds(intVal(params.get("rounds")));
        if (params.containsKey("principal")) status.setPrincipal(str(params.get("principal")));
src/main/resources/db/station-schema.sql
@@ -28,7 +28,7 @@
    `short_stop_loss_price`      VARCHAR(32)  DEFAULT NULL COMMENT '空头止损触发价',
    `tp_trigger_opposite_add_enabled`  TINYINT(1) DEFAULT 0 COMMENT '止盈成交触发对向加仓开关',
    `tp_trigger_opposite_add_quantity` INT(11)   DEFAULT 0 COMMENT '对向加仓挂单数量',
    `base_take_profit_per_grid`        INT(11)   DEFAULT 0 COMMENT '单格止盈张数(基础仓位止盈)',
    `base_take_profit_per_grid`        VARCHAR(32) DEFAULT NULL COMMENT '单格止盈张数(基础仓位止盈,支持小数)',
    `base_take_profit_grid_count`      INT(11)   DEFAULT 0 COMMENT '止盈网格数量(基础仓位止盈)',
    `current_round`  INT(11)      DEFAULT 0  COMMENT '当前轮次',
    `total_rounds`   INT(11)      DEFAULT 0  COMMENT '总轮数上限',
@@ -113,5 +113,5 @@
-- 升级脚本:基础仓位止盈挂单参数(2026-09 新增)
-- ============================================================
ALTER TABLE `strategy_status`
    ADD COLUMN `base_take_profit_per_grid`   INT(11) DEFAULT 0 COMMENT '单格止盈张数(基础仓位止盈)' AFTER `tp_trigger_opposite_add_quantity`,
    ADD COLUMN `base_take_profit_per_grid`   VARCHAR(32) DEFAULT NULL COMMENT '单格止盈张数(基础仓位止盈,支持小数)' AFTER `tp_trigger_opposite_add_quantity`,
    ADD COLUMN `base_take_profit_grid_count` INT(11) DEFAULT 0 COMMENT '止盈网格数量(基础仓位止盈)' AFTER `base_take_profit_per_grid`;
src/main/resources/static/station-dashboard.html
@@ -1077,7 +1077,7 @@
    { key: 'quantity', label: '每次下单张数', type: 'number', placeholder: '2', jtype: 'string', group: 'grid' },
    { key: 'maxPositionSize', label: '最大持仓张数', type: 'number', placeholder: '4', jtype: 'int', group: 'grid' },
    { key: 'takeProfitGridSpan', label: '止盈网格跨度', type: 'number', placeholder: '2', jtype: 'int', group: 'grid' },
    { key: 'baseTakeProfitPerGrid', label: '单格止盈张数', type: 'number', placeholder: '0', jtype: 'int', group: 'grid', tip: '基础仓位止盈:每个网格挂的止盈张数' },
    { key: 'baseTakeProfitPerGrid', label: '单格止盈张数', type: 'number', step: 'any', placeholder: '0', jtype: 'decimal', group: 'grid', tip: '基础仓位止盈:每个网格挂的止盈张数(支持小数)' },
    { key: 'baseTakeProfitGridCount', label: '止盈网格数量', type: 'number', placeholder: '0', jtype: 'int', group: 'grid', tip: '基础仓位止盈:挂止盈的网格数量' },
    { key: 'expectedProfit', label: '预期收益 (USDT)', type: 'number', step: '0.01', placeholder: '0.15', jtype: 'decimal', group: 'risk' },