Skip to content

feat: add Position Size Calculator under /tool#30

Merged
ronload merged 1 commit into
mainfrom
feat/add-position-size-calculator
Apr 28, 2026
Merged

feat: add Position Size Calculator under /tool#30
ronload merged 1 commit into
mainfrom
feat/add-position-size-calculator

Conversation

@ronload
Copy link
Copy Markdown
Owner

@ronload ronload commented Apr 28, 2026

Why

The site has /tutorial as a content section but no parallel "tools" section. This PR introduces /tool as a sibling listing page and delivers its first tool — a position size calculator — giving traders a fast utility for sizing trades from either custom inputs or pasted community signals.

What's in here

  • /tool listing page (BentoCard pattern, parallel to /tutorial) and a Tool entry in the header nav
  • /tool/position-size-calculator with two modes:
    • Regular: manual dollarRisk / entryPrice / stopLoss → position size, direction, risk %, max loss
    • Community: paste a Chinese signal → auto-parse symbol / direction / entry range / multi-level TPs / stop loss → result with TP PnL
  • /tool index card uses a screenshot-style demo of the Community result block as background, to preview what the tool produces

Key decisions

  • Pure logic (calculations / validation / strategy parsing) is a verbatim port from Kaiyn-landing-page/.../position-calculator/lib, zero external deps
  • UI rebuilt with this project's stack (Tailwind v4 + shadcn wrapper + base-ui) instead of the source's CSS Modules; visual structure preserved, design tokens swapped
  • Mode switcher is a hand-rolled pill toggle (no Tabs primitive) to keep visual parity with the source
  • Total capital assumption hardcoded at $10k (matches source); revisit later as a configurable input
  • Strategy parser keeps Chinese keywords (标的 / 方向 / 进场 / 止盈 / 止损) verbatim regardless of UI locale — they're domain tokens, not UI strings

Test plan

  • /tool index renders title, description, and Position Calculator card across en / zh-TW / zh-CN
  • Card hover shows CTA; click navigates to /{locale}/tool/position-size-calculator
  • Regular: `100 / 50000 / 48000` → Long, 0.05 units, $2500 USDT, 1% risk, $100 max loss
  • Community: paste `标的:BTC / 方向:多 / 进场:49000-50000 / 止盈:52000/55000 / 止损:48000` → parses, shows three TP PnL rows
  • Parse failure (`abc`) shows i18n error message
  • Numeric inputs filter non-digits live (digits + single decimal allowed)
  • Mode switcher keyboard nav works (Arrow / Home / End)
  • `pnpm typecheck && pnpm lint` clean

Close #29

Add /tool listing page (sibling of /tutorial) and ship its first tool
with two modes:

- Regular: manual dollarRisk / entryPrice / stopLoss inputs
- Community: paste a Chinese signal, auto-parse symbol / direction /
  entry range / multi-level take profits / stop loss

Pure logic (calculations / validation / strategy parsing) ported
verbatim from Kaiyn-landing-page; UI rebuilt with this project's
Tailwind v4 + shadcn + base-ui conventions instead of CSS Modules.
The /tool index card uses a screenshot-style demo of the Community
result block as background to preview what the tool produces.

All UI strings localized in en / zh-TW / zh-CN; the parser keeps its
Chinese keywords (标的 / 方向 / 进场 / 止盈 / 止损) verbatim regardless
of UI locale.
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
kaiyn-website Ready Ready Preview, Comment Apr 28, 2026 4:18pm

@ronload ronload self-assigned this Apr 28, 2026
@ronload ronload added the enhancement New feature or request label Apr 28, 2026
@ronload ronload merged commit b03e2ec into main Apr 28, 2026
5 of 6 checks passed
@ronload ronload deleted the feat/add-position-size-calculator branch April 28, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement a position size calculator

1 participant