From 84c5177578fab8aedcd5a1a6f2e5f6d3e43b091a Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 18 May 2026 17:25:26 +0800
Subject: [PATCH] 第二个版本
---
src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java b/src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java
index 7153f7a..3d6edfe 100644
--- a/src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java
+++ b/src/main/java/com/xcong/excoin/modules/gateApi/GateConfig.java
@@ -90,6 +90,8 @@
private final BigDecimal marginRatioLimit;
/** 合约乘数(单张合约代表的基础资产数量,如 BTC_USDT=0.001, ETH_USDT=0.01) */
private final BigDecimal contractMultiplier;
+ /** 价格精度(交易所价格的最小小数位数,如 XAU_USDT=1 表示 0.1 精度,ETH_USDT=2 表示 0.01 精度) */
+ private final int priceScale;
/** 未实现盈亏计价模式:最新价 / 标记价格 */
private final PnLPriceMode unrealizedPnlPriceMode;
/** 网格绝对步长(shortBaseEntryPrice × gridRate),运行时由队列生成逻辑设置 */
@@ -117,6 +119,7 @@
this.gridQueueSize = builder.gridQueueSize;
this.marginRatioLimit = builder.marginRatioLimit;
this.contractMultiplier = builder.contractMultiplier;
+ this.priceScale = builder.priceScale;
this.unrealizedPnlPriceMode = builder.unrealizedPnlPriceMode;
}
@@ -193,6 +196,8 @@
/** @return 合约乘数(单张合约代表的基础资产数量,如 ETH_USDT=0.01) */
public BigDecimal getContractMultiplier() { return contractMultiplier; }
+ /** @return 价格精度(交易所价格的小数位数,如 1=0.1精度,2=0.01精度),用于价格四舍五入 */
+ public int getPriceScale() { return priceScale; }
/** @return 未实现盈亏计价模式:LAST_PRICE(最新成交价)/ MARK_PRICE(标记价格) */
public PnLPriceMode getUnrealizedPnlPriceMode() { return unrealizedPnlPriceMode; }
@@ -275,6 +280,8 @@
private BigDecimal marginRatioLimit = new BigDecimal("0.2");
/** 合约乘数,默认 0.001 */
private BigDecimal contractMultiplier = new BigDecimal("0.001");
+ /** 价格精度(交易所价格的小数位数),默认 1(0.1 精度) */
+ private int priceScale = 1;
/** 未实现盈亏计价模式,默认 LAST_PRICE(最新成交价) */
private PnLPriceMode unrealizedPnlPriceMode = PnLPriceMode.LAST_PRICE;
@@ -304,6 +311,8 @@
public Builder reopenMaxRetries(int reopenMaxRetries) { this.reopenMaxRetries = reopenMaxRetries; return this; }
/** 设置合约乘数(单张合约代表的基础资产数量) */
public Builder contractMultiplier(BigDecimal contractMultiplier) { this.contractMultiplier = contractMultiplier; return this; }
+ /** 设置价格精度(交易所价格的小数位数,如 1=0.1精度,2=0.01精度) */
+ public Builder priceScale(int priceScale) { this.priceScale = priceScale; return this; }
/** 设置未实现盈亏计价模式 */
public Builder unrealizedPnlPriceMode(PnLPriceMode mode) { this.unrealizedPnlPriceMode = mode; return this; }
--
Gitblit v1.9.1