fix(crypto): lead the change with its sign so a down move is not "$-186.36" - #330
Merged
ralyodio merged 1 commit intoAug 8, 2026
Conversation
…6.36"
priceLine only ever prepended "+" for a gain and let price() render a loss,
which puts the minus after the currency mark: an up move showed "+$186.36"
but a down move showed "$-186.36". pct() already signs its own output for
exactly this reason; the absolute change now does the same, formatting the
magnitude and leading with a single +/- so both directions read alike
("-$186.36") and non-USD quotes keep their sign too ("-0.02950 BTC").
Regression test renders a report at a negative and a positive change and pins
the sign placement; it fails before this change and passes after.
Co-authored-by: Claude Opus 4.8 <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.
The report/quote price line signs the day change inconsistently by direction.
priceLine()only ever prepends+for a gain and hands a loss straight toprice(), which renders the minus inside the number — after the currency mark. So the two directions do not read alike:$-186.36puts the sign in the wrong place.pct()already signs its own output for exactly this reason ("+0.29% and -0.29% must never look alike"); the absolute change now does the same — it formats the magnitude and leads with a single+/-, so a loss reads-$186.36and a non-USD quote keeps its sign too (-0.02950 BTC).Reproduce (before):