fix(analysis): survive numeric botFunds values in analyze-orders - #13
Open
Impulssi wants to merge 1 commit into
Open
fix(analysis): survive numeric botFunds values in analyze-orders#13Impulssi wants to merge 1 commit into
Impulssi wants to merge 1 commit into
Conversation
Impulssi
force-pushed
the
fix/analyze-orders-numeric-botfunds
branch
from
August 26, 2026 06:03
da44fd9 to
c130f63
Compare
bots.json documents botFunds as accepting either percentage strings
("90%") or absolute numbers (35 meaning 35 units of the side's asset),
and the bot editor writes numbers when a bare value is entered. The
"Funds:" display path in analyze-orders called string methods
(padEnd/stripColorCodes) directly on the raw config values, so a numeric
setting aborted the whole per-bot analysis with
"str.replace is not a function" and the bot was skipped from the report.
Normalize both botFunds sides to strings when the analysis object is
built, so every display consumer (width alignment, Funds line) receives
a string regardless of the configured type. Percentage strings pass
through unchanged.
## Testing Notes
- tests/test_analyze_orders_dynamic_weight.ts: new
testAnalyzeOrderFormatsNumericBotFunds covering numeric normalization
("35" -> "35"), percentage passthrough ("35%" unchanged), and that
formatAnalysis renders the Funds line without throwing for both forms.
Verified the new test fails with the pre-fix analyzer (reproduces the
original crash) and passes with the fix.
- npm run typecheck clean.
Impulssi
force-pushed
the
fix/analyze-orders-numeric-botfunds
branch
from
August 26, 2026 06:34
c130f63 to
ee9482a
Compare
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.
bots.json documents botFunds as accepting either percentage strings ("90%") or absolute numbers (35 meaning 35 units of the side's asset), and the bot editor writes numbers when a bare value is entered. The "Funds:" display path in analyze-orders called string methods (padEnd/stripColorCodes) directly on the raw config values, so a numeric setting aborted the whole per-bot analysis with
"str.replace is not a function" and the bot was skipped from the report.
Normalize both botFunds sides to strings when the analysis object is built, so every display consumer (width alignment, Funds line) receives a string regardless of the configured type. Percentage strings pass through unchanged.
Testing Notes
Note: I'm new to this codebase and worked through this change with an AI
coding assistant (opencode). The bug was hit on my own live instance and
all measurements / reproduction steps are mine — but please flag anything
in the code that looks off and I'll dig in and follow up.