| | |
| | | private final int priceScale; |
| | | /** 未实现盈亏计价模式:最新价 / 标记价格 */ |
| | | private final PnLPriceMode unrealizedPnlPriceMode; |
| | | /** 最大持仓张数(单方向),0=不限制 */ |
| | | private final int maxPositionSize; |
| | | /** 网格绝对步长(shortBaseEntryPrice × gridRate),运行时由队列生成逻辑设置 */ |
| | | private BigDecimal step; |
| | | /** 网格元素列表,由队列初始化时同步填充,包含完整的多空仓挂单状态 */ |
| | |
| | | this.contractMultiplier = builder.contractMultiplier; |
| | | this.priceScale = builder.priceScale; |
| | | this.unrealizedPnlPriceMode = builder.unrealizedPnlPriceMode; |
| | | this.maxPositionSize = builder.maxPositionSize; |
| | | } |
| | | |
| | | // ==================== REST/WS 地址 ==================== |
| | |
| | | public int getPriceScale() { return priceScale; } |
| | | /** @return 未实现盈亏计价模式:LAST_PRICE(最新成交价)/ MARK_PRICE(标记价格) */ |
| | | public PnLPriceMode getUnrealizedPnlPriceMode() { return unrealizedPnlPriceMode; } |
| | | /** @return 最大持仓张数(单方向),0=不限制 */ |
| | | public int getMaxPositionSize() { return maxPositionSize; } |
| | | |
| | | // ==================== 运行时参数 ==================== |
| | | |
| | |
| | | private int priceScale = 1; |
| | | /** 未实现盈亏计价模式,默认 LAST_PRICE(最新成交价) */ |
| | | private PnLPriceMode unrealizedPnlPriceMode = PnLPriceMode.LAST_PRICE; |
| | | /** 最大持仓张数(单方向),默认 0=不限制 */ |
| | | private int maxPositionSize = 0; |
| | | |
| | | /** 设置 API Key */ |
| | | public Builder apiKey(String apiKey) { this.apiKey = apiKey; return this; } |
| | |
| | | public Builder gridQueueSize(int gridQueueSize) { this.gridQueueSize = gridQueueSize; return this; } |
| | | /** 设置未实现盈亏计价模式 */ |
| | | public Builder unrealizedPnlPriceMode(PnLPriceMode mode) { this.unrealizedPnlPriceMode = mode; return this; } |
| | | /** 设置最大持仓张数(单方向),0=不限制 */ |
| | | public Builder maxPositionSize(int maxPositionSize) { this.maxPositionSize = maxPositionSize; return this; } |
| | | |
| | | public GateConfig build() { |
| | | return new GateConfig(this); |