fix(ticker): carry a rounded thousand to the next unit in compact() - #321
Merged
ralyodio merged 1 commit intoAug 8, 2026
Merged
Conversation
compact() picks its unit from the raw value but rounds the displayed number to 2 decimals afterward, so a value just under a boundary prints a thousand of the smaller unit instead of carrying: 999,999,999 rendered as "1000M" and 999,999,999,999 as "1000B". A market cap a hair under $1B read as "1000M". Round first, then carry: when the scaled value rounds to >= 1000 of the current unit, promote it to the next unit up. Values that legitimately sit below a boundary (999.5M) keep their more precise smaller-unit form. Adds a regression test that renders a report whose fundamentals land just under the million/billion/trillion boundaries.
Merged
ralyodio
added a commit
that referenced
this pull request
Aug 8, 2026
Bump to v0.27.0, releasing `/crypto` — crypto market data from advis0r.com as a CLI verb, a pit command, and a second Claude Code plugin (#322) — alongside two commits that have been sitting on main unreleased: the compact() carry fix for `ticker` (#321) and the move off the deprecated Node 20 runtime (#320). Minor rather than patch: it adds a command and a plugin, and changes no existing one. As with v0.26.0 and `ticker`, the release is what makes the plugin's primary path work. install.sh serves the latest release tarball, not main, so until a release carries it every installed binary answers `unknown command "crypto"` and the plugin's slash commands fall back to curl — which works, but skips the rendering the verb exists to do. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
compact() (src/advisor.mjs) chooses its magnitude unit from the raw value but rounds the displayed number to 2 decimals after the unit is fixed. A value just under a boundary then prints a full thousand of the smaller unit instead of carrying to the next one:
So a market cap a hair under $1B renders in a ticker report as "1000M".
Reproduce:
Fix: round first, then carry. When the scaled value rounds to >= 1000 of the current unit, promote it to the next unit up. Values that genuinely sit below a boundary (e.g. 999.5M) keep their more precise smaller-unit form, so this only changes the mis-rendered boundary cases.
Test: adds a regression test that renders a report whose fundamentals land just under the million / billion / trillion boundaries and asserts the carried form ("1B", "1M", "1T") with no "1000X" leaking through. Fails before, passes after. Full suite green (1122 pass, 0 fail).