Skip to content

feat(trading-signals-docs): move the trading knowledge to the website - #1377

Open
bennycode wants to merge 1 commit into
mainfrom
docs/trading-basics
Open

bennycode wants to merge 1 commit into
mainfrom
docs/trading-basics

Conversation

@bennycode

Copy link
Copy Markdown
Owner

Domain knowledge lived in package READMEs, where it was hard to find and impossible to link to. It now has a Trading Basics section on the docs site, sitting between Getting Started and the indicator categories:

  • Trading Glossary — the domain knowledge from the trading-strategies README, grouped into markets and infrastructure, orders and execution, positions and instruments, trader profiles, and evaluating a strategy. Kept as one page on purpose: a glossary is a lookup surface, so splitting it would turn every term lookup into a hunt across sub-pages.
  • Indicator Types — the classification section from the trading-signals README, with the four function categories linked to their index pages and the named examples linked to their own.
  • Risk Management — a new page covering why drawdowns are asymmetric, position sizing from a risk budget, stop placement (fixed, volatility-based, structural), fixed vs trailing stops, the win rate a given reward:risk actually needs, and the limit-vs-market trade-off on the way out.

Both READMEs keep a one-line summary that links to the page, so nothing is lost for people reading on npm or GitHub.

Closes #1289

Also in here

getPositionSize is added to the trading utilities. It answers "how many units do I buy so that being stopped out costs 1% of my account", which is the bridge between a stop price and a strategy's order size, and the one place where getting the arithmetic wrong costs real money.

Three decisions worth a look during review:

  • It returns a fractional size rather than rounding. Flooring would turn 0.0431 BTC into 0. Callers round to the exchange's step size, which the glossary now explains.
  • It uses the absolute distance between entry and stop, so shorts (stop above entry) work through the same call instead of returning a negative size.
  • It throws rather than returning NaN or Infinity. The subtle case is NaN: every comparison against it is false, so a NaN input slipped past all four range checks and came back as a NaN position size. A single finiteness check on the result covers that, infinite inputs, and overflow from inputs that are each individually finite.

The risk management page deliberately carries no code — it is conceptual trading knowledge, and the library reference for the utility lives in the README table and on the Utility Functions page.

Domain knowledge lived in package READMEs where it was hard to find and
impossible to link to. It now has a "Trading Basics" section on the docs site:

- Trading Glossary, from the trading-strategies README
- Indicator Types, from the trading-signals README
- Risk Management, a new page on position sizing, stop placement, trailing
  exits and the win rate a given reward:risk actually needs

Both READMEs keep a one-line summary that links to the page.

Also adds getPositionSize to the trading utilities, which sizes a position so
that being stopped out costs a fixed share of the account. It uses the absolute
distance between entry and stop, so it covers shorts as well, and returns a
fractional size for assets that trade in fractions.

Closes #1289

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move glossary to website

1 participant