| | |
| | | private final int maxPositionPerSide; |
| | | /** 加仓启动阈值:前N次止损不触发加仓,默认 1(第1次止损不加仓,第2次起按公式计算) */ |
| | | private final int addPositionStartThreshold; |
| | | /** 超额止盈开关:true=挂单成交后将超出基础仓位的部分挂止盈单(挂在对手第一止损位),默认 false */ |
| | | private final boolean placeExcessTakeProfit; |
| | | /** 止盈挂单模式:关闭 */ |
| | | public static final String EXCESS_TP_OFF = "off"; |
| | | /** 止盈挂单模式:集中止盈(挂在对手第一止损位) */ |
| | | public static final String EXCESS_TP_CONCENTRATED = "concentrated"; |
| | | /** 止盈挂单模式:分散止盈(逐格挂到对手盘止损位) */ |
| | | public static final String EXCESS_TP_DISPERSED = "dispersed"; |
| | | |
| | | /** 止盈挂单模式:off=关闭 / concentrated=集中止盈 / dispersed=分散止盈,默认 off */ |
| | | private final String placeExcessTakeProfit; |
| | | /** 网格绝对步长(shortBaseEntryPrice × gridRate),运行时由队列生成逻辑设置 */ |
| | | private BigDecimal step; |
| | | /** 网格元素列表,由队列初始化时同步填充,包含完整的多空仓挂单状态 */ |
| | |
| | | public int getMaxPositionPerSide() { return maxPositionPerSide; } |
| | | /** @return 加仓启动阈值:前N次止损不触发加仓 */ |
| | | public int getAddPositionStartThreshold() { return addPositionStartThreshold; } |
| | | /** @return 超额止盈开关:true=挂单成交后将超出基础仓位的部分挂止盈单 */ |
| | | public boolean isPlaceExcessTakeProfit() { return placeExcessTakeProfit; } |
| | | /** @return 止盈挂单模式:off=关闭 / concentrated=集中止盈 / dispersed=分散止盈 */ |
| | | public String getPlaceExcessTakeProfit() { return placeExcessTakeProfit; } |
| | | |
| | | // ==================== 运行时参数 ==================== |
| | | |
| | |
| | | private int maxPositionPerSide = 0; |
| | | /** 加仓启动阈值:前N次止损不触发加仓,调整后的 effectiveCount = max(0, count - threshold)。默认 1 */ |
| | | private int addPositionStartThreshold = 1; |
| | | /** 超额止盈开关:true=挂单成交后将超出基础仓位的部分挂止盈单,默认 false */ |
| | | private boolean placeExcessTakeProfit = false; |
| | | /** 止盈挂单模式:off=关闭 / concentrated=集中止盈 / dispersed=分散止盈,默认 off */ |
| | | private String placeExcessTakeProfit = EXCESS_TP_OFF; |
| | | |
| | | /** 设置 API Key */ |
| | | public Builder apiKey(String apiKey) { this.apiKey = apiKey; return this; } |
| | |
| | | public Builder maxPositionPerSide(int maxPositionPerSide) { this.maxPositionPerSide = maxPositionPerSide; return this; } |
| | | /** 设置加仓启动阈值:前N次止损不触发加仓,0=立即启动 */ |
| | | public Builder addPositionStartThreshold(int addPositionStartThreshold) { this.addPositionStartThreshold = addPositionStartThreshold; return this; } |
| | | /** 设置超额止盈开关:true=挂单成交后将超出基础仓位的部分挂止盈单 */ |
| | | public Builder placeExcessTakeProfit(boolean placeExcessTakeProfit) { this.placeExcessTakeProfit = placeExcessTakeProfit; return this; } |
| | | /** 设置止盈挂单模式:off / concentrated / dispersed */ |
| | | public Builder placeExcessTakeProfit(String placeExcessTakeProfit) { this.placeExcessTakeProfit = placeExcessTakeProfit; return this; } |
| | | |
| | | public GateConfig build() { |
| | | return new GateConfig(this); |