Skip to content

Use oracle spread side for position execution prices - #476

Open
silentgeckoaudit3801 wants to merge 3 commits into
SO4-Markets:mainfrom
silentgeckoaudit3801:fix/execution-price-spread-252
Open

Use oracle spread side for position execution prices#476
silentgeckoaudit3801 wants to merge 3 commits into
SO4-Markets:mainfrom
silentgeckoaudit3801:fix/execution-price-spread-252

Conversation

@silentgeckoaudit3801

Copy link
Copy Markdown

Fixes #252.

Market position execution no longer collapses the oracle spread to the midpoint before slippage checks:

  • increases use pick_price_for_pnl(is_long, true), selecting max for long increases and min for short increases
  • decreases use pick_price_for_pnl(is_long, false), selecting min for long decreases and max for short decreases
  • static coverage locks both spread-side selections and prevents reintroducing mid_price() in those paths

I did not run local Rust/Soroban tests in this workspace because we are intentionally avoiding dependency installation and project toolchain execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

order_handler: market order executes at wrong price when oracle min/max spread is wide

1 participant