Fix Kraken nonce recovery and Coinbase balance fallback in trading loop#1090
Merged
dantelrharrell-debug merged 2 commits intomainfrom Mar 31, 2026
Merged
Conversation
|
🚅 Deployed to the Nija-pr-1090 environment in patient-compassion
|
Agent-Logs-Url: https://github.com/dantelrharrell-debug/Nija/sessions/dedd56b1-3815-4307-9b41-9fed8d5ef2e5 Co-authored-by: dantelrharrell-debug <232652186+dantelrharrell-debug@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix nonce handling and balance fallback issues
Fix Kraken nonce recovery and Coinbase balance fallback in trading loop
Mar 31, 2026
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.
run_broker_trading_loop()had two silent failure paths: Coinbase balance checks bypassed the zero-balance retry logic, and Kraken nonce errors were counted as broker failures (accelerating dead-broker marking) instead of being recovered transparently.Changes
Balance fallback (
run_broker_trading_loop): Replace directbroker.get_account_balance()withself._get_broker_balance(broker, broker_type, broker_name), routing Coinbase through_retry_coinbase_balance_if_zero()to handle stale API-cached$0responses post-connect.Nonce error recovery (
run_broker_trading_loop): Before the standard failure path, detect Kraken nonce errors and recover without incrementing the failure counter:Import: Added graceful import of
jump_global_kraken_nonce_forwardfromglobal_kraken_nonce(falls back toNoneif unavailable, recovery path is skipped safely).