Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-strategiesREADME, 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.trading-signalsREADME, with the four function categories linked to their index pages and the named examples linked to their own.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
getPositionSizeis 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:
0.0431 BTCinto0. Callers round to the exchange's step size, which the glossary now explains.NaNorInfinity. The subtle case isNaN: every comparison against it is false, so aNaNinput slipped past all four range checks and came back as aNaNposition 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.