mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-12 09:48:07 +00:00
feat: enhance precision synchronization in trading strategies and improve order quantity normalization logic
This commit is contained in:
@@ -2,6 +2,7 @@ import type {
|
||||
AccountListener,
|
||||
DepthListener,
|
||||
ExchangeAdapter,
|
||||
ExchangePrecision,
|
||||
KlineListener,
|
||||
OrderListener,
|
||||
TickerListener,
|
||||
@@ -124,6 +125,22 @@ export class LighterExchangeAdapter implements ExchangeAdapter {
|
||||
await this.gateway.cancelAllOrders();
|
||||
}
|
||||
|
||||
async getPrecision(): Promise<ExchangePrecision | null> {
|
||||
try {
|
||||
const precision = await this.gateway.getPrecision();
|
||||
return {
|
||||
priceTick: precision.priceTick,
|
||||
qtyStep: precision.qtyStep,
|
||||
priceDecimals: precision.priceDecimals,
|
||||
sizeDecimals: precision.sizeDecimals,
|
||||
marketId: precision.marketId ?? undefined,
|
||||
};
|
||||
} catch (error) {
|
||||
this.logError("precision", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private ensureInitialized(context?: string): Promise<void> {
|
||||
if (!this.initPromise) {
|
||||
this.initContexts.clear();
|
||||
|
||||
Reference in New Issue
Block a user