优化做市引擎、偏移做市引擎和趋势引擎的订单管理逻辑,将待取消订单的类型从数字更改为字符串,确保在处理订单时的类型一致性。同时,增强风险检查逻辑,确保在平仓时使用正确的价格,提升交易策略的稳定性和准确性。

This commit is contained in:
discountry
2025-09-27 17:05:51 +08:00
parent dde7ab71a9
commit 0bb22d891f
9 changed files with 217 additions and 92 deletions
+2 -1
View File
@@ -14,7 +14,8 @@ export function roundQtyDownToStep(value: number, step: number): number {
export function decimalsOf(step: number): number {
const s = step.toString();
if (!s.includes(".")) return 0;
return s.split(".")[1].length;
const fraction = s.split(".")[1];
return fraction ? fraction.length : 0;
}
export function isNearlyZero(value: number, epsilon = 1e-5): boolean {