feat: Add per-coin order size overrides#123
Merged
Merged
Conversation
Allow configuring ORDER_SIZE_USD per coin to reduce notional exposure on high-volatility assets while keeping the global default for others. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
keitaj
commented
Apr 25, 2026
keitaj
left a comment
Owner
Author
There was a problem hiding this comment.
Review: Per-coin order size overrides
Clean implementation following the established _get_coin_*() pattern. 13 tests with real assertions.
1. Existing test helpers need _coin_size_overrides (informational)
8 existing test files updated to add _coin_size_overrides = {} — this is correct and necessary because those tests bypass __init__ and manually set attributes. ✓
2. _get_coin_size follows exact same pattern (informational)
Identical to _get_coin_offset() and _get_coin_spread(): full name → bare name → global default. Consistent. ✓
3. inventory_skew still uses global order_size_usd (informational)
_calculate_inventory_skew() normalizes position value by self.order_size_usd, not the per-coin size. This is correct — skew normalization is about the account-level position scale, not the per-coin order size. ✓
Verdict: LGTM
- No blockers or should-fix items
- 13 new tests covering all lookup scenarios, fallback, zero value, risk multiplier
- Fully backward compatible (empty string default)
- Clean reuse of existing
_parse_coin_overrides()parser - README updated for both human and AI reference
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
--coin-size-overridesCLI flag to configure ORDER_SIZE_USD per coin (e.g.,"TSLA:150,NVDA:150")--order-size-usdvalue0skips order placement for that coin--coin-offset-overridesand--coin-spread-overrides(full name -> bare name -> global default)Changes
_coin_size_overridesdict,_get_coin_size()helper, and updatecalculate_position_size()to use per-coin lookup--coin-size-overridesargparse flag and wire it into_STRATEGY_PARAMS_coin_size_overrides = {}to test helpers that bypass__init__Test plan
pytest tests/ -q)flake8 --max-line-length=120)--coin-size-overrides "TSLA:150"reduces TSLA order size while other coins use global default--coin-size-overrides "TSLA:0"skips TSLA orders entirely🤖 Generated with Claude Code