feat: Deduplicate coin list at startup with warning log#121
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
keitaj
commented
Apr 24, 2026
keitaj
left a comment
Owner
Author
There was a problem hiding this comment.
Review: Deduplicate coin list at startup
Simple, well-tested defensive validation. Addresses a real bug (TSLA duplication in US session).
1. Return type annotation (nit)
bot.py L253:
-> tuple could be more specific: -> Tuple[List[str], List[str]]. Minor readability improvement.
Verdict: LGTM
- No blockers or should-fix items
- 8 tests with real assertions covering all edge cases
- Additive-only change, fully backward compatible
- Static method is clean and testable
- One nit (return type annotation) — optional
Merging after CI check.
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.
Summary
.env.farmingandstart_farming_us.shboth added TSLA, causingXYZ_COINS=...,TSLA,TSLA,..._deduplicate_coins()static method for testabilityMotivation
A real bug was discovered where TSLA appeared twice in the US session coin list. This caused the bot to allocate double position slots to TSLA and potentially worsened cost efficiency ($/1K went from $0.058 to $0.202). This validation catches such configuration errors at startup.
Changes
bot.py: Add_deduplicate_coins()static method and call it during coin list assembly. LogsWARNINGwith duplicate names.tests/test_deduplicate_coins.py: 8 tests covering no-dups, single/multi dups, order preservation, empty list, mixed HL/HIP-3, case sensitivity.Test plan
flake8passespytestpasses (744 tests, 0 failures)🤖 Generated with Claude Code