mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 01:08:07 +00:00
feat: 增强 Lighter 适配器的账户更新逻辑,支持市场账户的实时更新和合并处理
This commit is contained in:
@@ -172,7 +172,8 @@ function lighterPositionToAster(symbol: string, position: LighterPosition): Aste
|
||||
const sign = position.sign ?? 0;
|
||||
const positionSide = sign > 0 ? "LONG" : sign < 0 ? "SHORT" : "BOTH";
|
||||
const magnitude = Number(position.position ?? 0);
|
||||
const signed = sign < 0 ? -Math.abs(magnitude) : Math.abs(magnitude);
|
||||
// Normalize: when sign is 0, treat as flat regardless of reported magnitude
|
||||
const signed = sign === 0 ? 0 : sign < 0 ? -Math.abs(magnitude) : Math.abs(magnitude);
|
||||
return {
|
||||
symbol,
|
||||
positionAmt: Number.isFinite(signed) ? signed.toString() : position.position ?? "0",
|
||||
|
||||
Reference in New Issue
Block a user