Skip to content

feat: Kraken per-user dust management — identify, convert to ZUSD, verify, prevent#792

Merged
dantelrharrell-debug merged 3 commits intomainfrom
copilot/identify-dust-trades-kraken
Feb 21, 2026
Merged

feat: Kraken per-user dust management — identify, convert to ZUSD, verify, prevent#792
dantelrharrell-debug merged 3 commits intomainfrom
copilot/identify-dust-trades-kraken

Conversation

Copy link
Contributor

Copilot AI commented Feb 21, 2026

Adds end-to-end dust lifecycle management scoped to individual Kraken users, covering identification, base-currency conversion, fund verification, and config-level prevention.

New: bot/kraken_dust_manager.py

Core module implementing a three-step pipeline per user:

manager = KrakenDustManager(dust_threshold_usd=10.0, dry_run=False)

# Step 1 – identify sub-threshold positions for a specific user
dust = manager.identify_user_dust("user_001", broker)

# Step 2 – sell dust → ZUSD (Kraken's internal USD denomination)
records = manager.convert_dust_to_base_currency("user_001", broker, dust)

# Step 3 – confirm ZUSD balance actually increased
passed, after, recovered = manager.verify_recovered_funds("user_001", broker, before, len(records))

# Or run all three in one call
report = manager.run_full_pipeline("user_001", broker)

# Multi-user batch
reports = manager.run_for_all_users([("alice", broker_a), ("bob", broker_b)])

Also exposes get_kraken_dust_prevention_config() — a ready-to-merge dict of dust-prevention keys for patching any NIJA config.

Config changes to prevent future dust

bot/exchange_risk_profiles.py — Kraken profile gains:

'dust_prevention_enabled': True,   # gate at order creation AND position open
'dust_threshold_usd': 10.00,       # Kraken effective minimum order value
'min_order_value_usd': 10.00,
'auto_dust_sweep_enabled': True,   # periodic sweep via ContinuousDustMonitor (30 min)
'base_currency': 'ZUSD',

bot/broker_configs/kraken_config.py — Same fields added to KrakenConfig dataclass; min_position_usd raised from $5$10 to prevent dust creation at entry.

Tests

14 unit tests in bot/tests/test_kraken_dust_manager.py covering all pipeline steps, dry-run behaviour, broker failure paths, multi-user dispatch, and config output.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@railway-app railway-app bot temporarily deployed to patient-compassion / Nija-pr-792 February 21, 2026 15:37 Destroyed
@railway-app
Copy link

railway-app bot commented Feb 21, 2026

🚅 Deployed to the Nija-pr-792 environment in patient-compassion

Service Status Web Updated (UTC)
Nija ✅ Success (View Logs) Feb 21, 2026 at 3:46 pm

Co-authored-by: dantelrharrell-debug <232652186+dantelrharrell-debug@users.noreply.github.com>
@railway-app railway-app bot temporarily deployed to patient-compassion / Nija-pr-792 February 21, 2026 15:39 Destroyed
… config)

Co-authored-by: dantelrharrell-debug <232652186+dantelrharrell-debug@users.noreply.github.com>
@railway-app railway-app bot temporarily deployed to patient-compassion / Nija-pr-792 February 21, 2026 15:45 Destroyed
Copilot AI changed the title [WIP] Identify and convert dust trades for users on Kraken feat: Kraken per-user dust management — identify, convert to ZUSD, verify, prevent Feb 21, 2026
@dantelrharrell-debug dantelrharrell-debug marked this pull request as ready for review February 21, 2026 15:47
@dantelrharrell-debug dantelrharrell-debug merged commit 55f4d27 into main Feb 21, 2026
28 of 29 checks passed
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