| | |
| | | private final boolean tpTriggerOppositeAddEnabled; |
| | | /** 对向加仓挂单数量:止盈成交后在对向挂出的开仓张数,0=不启用。默认 0 */ |
| | | private final int tpTriggerOppositeAddQuantity; |
| | | /** 单格止盈张数:基础仓位止盈挂单时每个网格挂的止盈张数。默认 0 */ |
| | | private final int baseTakeProfitPerGrid; |
| | | /** 止盈网格数量:基础仓位止盈挂单的网格数量。默认 0 */ |
| | | private final int baseTakeProfitGridCount; |
| | | /** 网格绝对步长(shortBaseEntryPrice × gridRate),运行时由队列生成逻辑设置 */ |
| | | private BigDecimal step; |
| | | /** 网格元素列表,由队列初始化时同步填充,包含完整的多空仓挂单状态 */ |
| | |
| | | this.shortStopLossPrice = builder.shortStopLossPrice; |
| | | this.tpTriggerOppositeAddEnabled = builder.tpTriggerOppositeAddEnabled; |
| | | this.tpTriggerOppositeAddQuantity = builder.tpTriggerOppositeAddQuantity; |
| | | this.baseTakeProfitPerGrid = builder.baseTakeProfitPerGrid; |
| | | this.baseTakeProfitGridCount = builder.baseTakeProfitGridCount; |
| | | } |
| | | |
| | | // ==================== REST/WS 地址 ==================== |
| | |
| | | public boolean isTpTriggerOppositeAddEnabled() { return tpTriggerOppositeAddEnabled; } |
| | | /** @return 对向加仓挂单数量:止盈成交后在对向挂出的开仓张数 */ |
| | | public int getTpTriggerOppositeAddQuantity() { return tpTriggerOppositeAddQuantity; } |
| | | /** @return 单格止盈张数:基础仓位止盈挂单时每个网格挂的止盈张数 */ |
| | | public int getBaseTakeProfitPerGrid() { return baseTakeProfitPerGrid; } |
| | | /** @return 止盈网格数量:基础仓位止盈挂单的网格数量 */ |
| | | public int getBaseTakeProfitGridCount() { return baseTakeProfitGridCount; } |
| | | |
| | | // ==================== 运行时参数 ==================== |
| | | |
| | |
| | | private boolean tpTriggerOppositeAddEnabled = false; |
| | | /** 对向加仓挂单数量:止盈成交后在对向挂出的开仓张数,默认 0 */ |
| | | private int tpTriggerOppositeAddQuantity = 0; |
| | | /** 单格止盈张数:基础仓位止盈挂单时每个网格挂的止盈张数,默认 0 */ |
| | | private int baseTakeProfitPerGrid = 0; |
| | | /** 止盈网格数量:基础仓位止盈挂单的网格数量,默认 0 */ |
| | | private int baseTakeProfitGridCount = 0; |
| | | |
| | | /** 设置 API Key */ |
| | | public Builder apiKey(String apiKey) { this.apiKey = apiKey; return this; } |
| | |
| | | public Builder tpTriggerOppositeAddEnabled(boolean tpTriggerOppositeAddEnabled) { this.tpTriggerOppositeAddEnabled = tpTriggerOppositeAddEnabled; return this; } |
| | | /** 设置对向加仓挂单数量:止盈成交后在对向挂出的开仓张数 */ |
| | | public Builder tpTriggerOppositeAddQuantity(int tpTriggerOppositeAddQuantity) { this.tpTriggerOppositeAddQuantity = tpTriggerOppositeAddQuantity; return this; } |
| | | /** 设置单格止盈张数:基础仓位止盈挂单时每个网格挂的止盈张数 */ |
| | | public Builder baseTakeProfitPerGrid(int baseTakeProfitPerGrid) { this.baseTakeProfitPerGrid = baseTakeProfitPerGrid; return this; } |
| | | /** 设置止盈网格数量:基础仓位止盈挂单的网格数量 */ |
| | | public Builder baseTakeProfitGridCount(int baseTakeProfitGridCount) { this.baseTakeProfitGridCount = baseTakeProfitGridCount; return this; } |
| | | |
| | | public GateConfig build() { |
| | | return new GateConfig(this); |