| | |
| | | private final boolean tpPositionReplenishEnabled; |
| | | /** 原始仓位止盈总数量:平均分配到对手盘止损位前的所有网格,余数挂最后一格,每格至少1张。默认 0 */ |
| | | private final int baseTakeProfitTotalQty; |
| | | /** 原始仓位减仓递减步长:0=关闭,>0=每次止损后追单量递减的步长,默认 0 */ |
| | | private final int originalPositionReduce; |
| | | /** 网格绝对步长(shortBaseEntryPrice × gridRate),运行时由队列生成逻辑设置 */ |
| | | private BigDecimal step; |
| | | /** 网格元素列表,由队列初始化时同步填充,包含完整的多空仓挂单状态 */ |
| | |
| | | this.tpTriggerOppositeAddQuantity = builder.tpTriggerOppositeAddQuantity; |
| | | this.tpPositionReplenishEnabled = builder.tpPositionReplenishEnabled; |
| | | this.baseTakeProfitTotalQty = builder.baseTakeProfitTotalQty; |
| | | this.originalPositionReduce = builder.originalPositionReduce; |
| | | } |
| | | |
| | | // ==================== REST/WS 地址 ==================== |
| | |
| | | public boolean isTpPositionReplenishEnabled() { return tpPositionReplenishEnabled; } |
| | | /** @return 原始仓位止盈总数量:平均分配到对手盘止损位前的所有网格 */ |
| | | public int getBaseTakeProfitTotalQty() { return baseTakeProfitTotalQty; } |
| | | /** @return 原始仓位减仓递减步长:0=关闭,>0=每次止损后追单量递减的步长 */ |
| | | public int getOriginalPositionReduce() { return originalPositionReduce; } |
| | | |
| | | // ==================== 运行时参数 ==================== |
| | | |
| | |
| | | private boolean tpPositionReplenishEnabled = false; |
| | | /** 原始仓位止盈总数量:平均分配到对手盘止损位前的所有网格,默认 0 */ |
| | | private int baseTakeProfitTotalQty = 0; |
| | | /** 原始仓位减仓递减步长:0=关闭,>0=每次止损后追单量递减的步长,默认 0 */ |
| | | private int originalPositionReduce = 0; |
| | | |
| | | /** 设置 API Key */ |
| | | public Builder apiKey(String apiKey) { this.apiKey = apiKey; return this; } |
| | |
| | | public Builder tpPositionReplenishEnabled(boolean tpPositionReplenishEnabled) { this.tpPositionReplenishEnabled = tpPositionReplenishEnabled; return this; } |
| | | /** 设置原始仓位止盈总数量:平均分配到对手盘止损位前的所有网格 */ |
| | | public Builder baseTakeProfitTotalQty(int baseTakeProfitTotalQty) { this.baseTakeProfitTotalQty = baseTakeProfitTotalQty; return this; } |
| | | /** 设置原始仓位减仓递减步长:0=关闭,>0=每次止损后追单量递减的步长 */ |
| | | public Builder originalPositionReduce(int originalPositionReduce) { this.originalPositionReduce = originalPositionReduce; return this; } |
| | | |
| | | public GateConfig build() { |
| | | return new GateConfig(this); |