feat: enhance quantity and price rounding functions for improved precision in trading calculations

This commit is contained in:
discountry
2025-11-06 21:06:03 +08:00
parent 0f70c6b6aa
commit d0d1afa0ea
5 changed files with 92 additions and 18 deletions
+6 -3
View File
@@ -353,7 +353,8 @@ export class OffsetMakerEngine {
? (closeAskPrice != null ? Number(closeAskPrice) : null)
: (closeBidPrice != null ? Number(closeBidPrice) : null),
maxPct: this.config.maxCloseSlippagePct,
}
},
{ qtyStep: this.qtyStep }
);
} catch (error) {
if (isUnknownOrderError(error)) {
@@ -441,7 +442,8 @@ export class OffsetMakerEngine {
markPrice: position.markPrice,
expectedPrice: Number(closeSidePrice) || null,
maxPct: this.config.maxCloseSlippagePct,
}
},
{ qtyStep: this.qtyStep }
);
} catch (error) {
if (isUnknownOrderError(error)) {
@@ -587,7 +589,8 @@ export class OffsetMakerEngine {
markPrice: position.markPrice,
expectedPrice: Number(position.positionAmt > 0 ? bidPrice : askPrice) || null,
maxPct: this.config.maxCloseSlippagePct,
}
},
{ qtyStep: this.qtyStep }
);
} catch (error) {
if (isUnknownOrderError(error)) {