Skip to content

fix(liquidity): skip unconfigured exchanges instead of reporting zero balances#3870

Merged
davidleomay merged 1 commit into
developfrom
fix/liquidity-skip-unconfigured-exchanges
Jun 11, 2026
Merged

fix(liquidity): skip unconfigured exchanges instead of reporting zero balances#3870
davidleomay merged 1 commit into
developfrom
fix/liquidity-skip-unconfigured-exchanges

Conversation

@TaprootFreak

Copy link
Copy Markdown
Collaborator

Problem

Follow-up to #3859: getForExchange returns LiquidityBalance.create(a, 0, 0) for exchanges without API credentials. These fake zeros are persisted by saveBalanceResults and are visible to rule evaluation.

If a configured exchange ever loses its credentials (env regression), rules would see a sudden zero balance and could trigger rebalancing pipelines towards an exchange we cannot even query — with only a single warn log per process lifetime as a hint. A missing value must not be reported as 0.

Fix

Return [] instead — no balances are reported or persisted for unconfigured exchanges. verifyRule already handles this gracefully: findRelevantBalance finds nothing, logs balance not found (info) and skips the rule. Same skip semantics as intended by #3859, without inventing a value.

Checks

  • format:check, type-check, lint clean

… balances

Returning LiquidityBalance.create(a, 0, 0) for exchanges without API
credentials persists fake zero balances via saveBalanceResults. If a
configured exchange ever loses its credentials (env regression), the
rules would see a sudden zero balance and could trigger rebalancing
pipelines towards an exchange we cannot even query — with only a
single warn log per process lifetime as a hint.

Return no balances instead: verifyRule already handles a missing
balance gracefully (info log, rule skipped).
@TaprootFreak TaprootFreak marked this pull request as ready for review June 11, 2026 18:34
@davidleomay davidleomay merged commit 26eee6e into develop Jun 11, 2026
7 checks passed
@davidleomay davidleomay deleted the fix/liquidity-skip-unconfigured-exchanges branch June 11, 2026 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants