You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the detailed write-up — confirmed on current master.
In ts/src/okx.tsparsePosition, the cross branch uses imr + upl as collateral, but the isolated branch uses only margin (collateralString = this.safeString (position, 'margin')). So for isolated positions collateral ignores unrealized PnL, and marginRatio = mmr / collateral stays around mmr / margin instead of rising toward liquidation. The unified position structure defines collateral as affected by PnL, so the isolated branch should be margin + upl, matching cross. With your numbers that gives 2.697 / 60.634 ≈ 0.0445.
OKX's native mgnRatio is a different metric (equity / (mmr + fee), higher is safer), with the inverse direction of ccxt's marginRatio, so it stays available as position['info']['mgnRatio'] and isn't mapped into the unified field.
I'll open a minimal fix for the isolated branch shortly.
Activity
carlotestor commentedon Sep 24, 2026
Thanks for the detailed write-up — confirmed on current master.
In
ts/src/okx.tsparsePosition, the cross branch usesimr + uplas collateral, but the isolated branch uses onlymargin(collateralString = this.safeString (position, 'margin')). So for isolated positionscollateralignores unrealized PnL, andmarginRatio = mmr / collateralstays aroundmmr / margininstead of rising toward liquidation. The unified position structure definescollateralas affected by PnL, so the isolated branch should bemargin + upl, matching cross. With your numbers that gives2.697 / 60.634 ≈ 0.0445.OKX's native
mgnRatiois a different metric (equity / (mmr + fee), higher is safer), with the inverse direction of ccxt'smarginRatio, so it stays available asposition['info']['mgnRatio']and isn't mapped into the unified field.I'll open a minimal fix for the isolated branch shortly.
carlotestor commentedon Sep 24, 2026
Opened #30611 with a minimal fix.
GUO-RUI-China commentedon Sep 24, 2026
if you have any question,feel free to connect with me