feat: implement getPrecision method in AsterExchangeAdapter and enhance AsterGateway for precision handling in order normalization

This commit is contained in:
discountry
2025-11-04 22:10:45 +08:00
parent 1832c4c13e
commit 078b201d15
3 changed files with 255 additions and 1 deletions
+17
View File
@@ -2,6 +2,7 @@ import type {
AccountListener,
DepthListener,
ExchangeAdapter,
ExchangePrecision,
KlineListener,
OrderListener,
TickerListener,
@@ -148,4 +149,20 @@ export class AsterExchangeAdapter implements ExchangeAdapter {
await this.ensureInitialized("cancelAllOrders");
await this.gateway.cancelAllOrders(params);
}
async getPrecision(): Promise<ExchangePrecision | null> {
try {
const precision = await this.gateway.getPrecision(this.symbol);
if (!precision) return null;
return {
priceTick: precision.priceTick,
qtyStep: precision.qtyStep,
priceDecimals: precision.priceDecimals,
sizeDecimals: precision.sizeDecimals,
};
} catch (error) {
console.error("[AsterExchangeAdapter] getPrecision failed", error);
return null;
}
}
}