fix(perps): use live price for reverse position orders#8481
fix(perps): use live price for reverse position orders#8481
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit f681e4a. Configure here.
| PERPS_EVENT_PROPERTY, | ||
| PERPS_EVENT_VALUE, | ||
| } from '../constants/eventNames'; | ||
| import { ESTIMATED_FEE_RATE } from '../constants/hyperLiquidConfig'; |
There was a problem hiding this comment.
Orphaned constant after removing its only usage
Low Severity
The ESTIMATED_FEE_RATE import was removed from TradingService.ts along with the fee validation block, but the constant itself is still exported from hyperLiquidConfig.ts. A repo-wide search confirms it has zero remaining references — it's now dead code introduced by this change.
Reviewed by Cursor Bugbot for commit f681e4a. Configure here.
f681e4a to
a12f5dd
Compare
|
core/main already contains these perps-controller changes, so this PR is superseded. The reverse position live price fix and the later follow-up sync changes are now present on main. |


Explanation
Sync the perps controller fix from mobile so reverse-position orders no longer use a stale entry price during flip order placement.
The issue was in
TradingService.flipPosition(): it passedposition.entryPriceascurrentPricefor the market flip order. That value could be stale relative to the live market, which meant provider side validation and IOC pricing could use the wrong price and cause reverse position failures. This change removes that stale price from the flip order params so the provider uses live market pricing instead, and it updates the order value analytics fallback accordingly.This PR also updates the perps controller changelog entry and sync state as part of the standard mobile-to-core sync flow.
References
perps/fix-reverse-order-priceChecklist
Note
Medium Risk
Changes perps position-flip order submission by removing fee/balance prechecks and no longer sending a potentially stale
currentPrice, which could affect provider-side validation and analytics values if assumptions differ.Overview
Fixes reverse-position (flip) market orders by stopping
flipPosition()from passingposition.entryPriceascurrentPrice, forcing providers to validate/price against live market data.Removes the flip fee/balance prevalidation based on
ESTIMATED_FEE_RATE, and updates flip analyticsORDER_VALUEto use the executedaveragePrice(falling back to entry price) instead. Changelog and.sync-state.jsonare updated to reflect the synced fix.Reviewed by Cursor Bugbot for commit a12f5dd. Bugbot is set up for automated code reviews on this repo. Configure here.