Skip to content

feat: enhanced TP/SL inputs with preset buttons and P/L amount#201

Open
jiangyj545 wants to merge 1 commit into
capofficial:mainfrom
jiangyj545:enhance-tpsl-17
Open

feat: enhanced TP/SL inputs with preset buttons and P/L amount#201
jiangyj545 wants to merge 1 commit into
capofficial:mainfrom
jiangyj545:enhance-tpsl-17

Conversation

@jiangyj545
Copy link
Copy Markdown

Enhanced Take-Profit / Stop-Loss Inputs

Closes #17

What this adds

Quick TP/SL preset buttons (+1%, +2%, +5% / -1%, -2%, -5%):

  • Buttons auto-adjust for long vs short direction
  • For long: TP = entry * (1 + %), SL = entry * (1 - %)
  • For short: TP = entry * (1 - %), SL = entry * (1 + %)
  • Highlighted state tracks which preset is active

Estimated P/L amount display:

  • Shows actual profit/loss amount in selected collateral asset
  • Formula: size * leverage * |targetPrice - entryPrice| / entryPrice
  • Updates in real-time as TP/SL price or percent changes

Three-way sync: Price ↔ Percent ↔ Amount — editing any one updates the others

Changes

  • Modified only src/components/trade/order/NewOrder.svelte (1 file, +101/-16)
  • No new dependencies, no order submission logic changes

Verification

  • npm install
  • npx rollup -c ✅ (build passes)
  • Circular dependency warnings are pre-existing (stores↔formatters↔utils)

Wallet: jiangyj545

- Add quick TP/SL preset buttons (+1%, +2%, +5% / -1%, -2%, -5%)
  that calculate target price based on entry price and direction (long/short)
- Add estimated P/L amount display alongside price and percent inputs
- Three-way sync: price ↔ percent ↔ amount
- Preset buttons adjust for long vs short position direction
- Reset all TP/SL state (percent, amount, highlights) on uncheck

Bounty: capofficial#17 (00)
Build verified: rollup -c passes
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.

Enhanced Take-profit and Stop-loss inputs

1 participant