mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-12 01:38:07 +00:00
feat: implement getPrecision method in AsterExchangeAdapter and enhance AsterGateway for precision handling in order normalization
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user