feat: Daily spot DCA — auto-buy SOL at midnight UTC#10
Merged
ArielB1980 merged 1 commit intomainfrom Feb 20, 2026
Merged
Conversation
Adds a background task that runs alongside the live trading loop. At midnight UTC each day, it fetches the available USD balance on the Kraken spot account and places a market buy for SOL (configurable). Components: - SpotDCAConfig: Pydantic config with asset, schedule, sizing controls - KrakenClient.place_spot_order(): New spot order method via CCXT - src/live/spot_dca.py: Scheduler + purchase executor with safety guards - LiveTrading: Background task integration with proper cleanup - Fix: get_account_balance() missing await (pre-existing bug) Safety guards: - Skips if available balance < min_purchase_usd ($5 default) - Respects reserve_usd (keeps N dollars untouched) - Caps at max_purchase_usd if configured - Graceful handling of API failures (no crash) - DRY_RUN mode support - Telegram alerts on success and failure 18 unit tests covering config, scheduling, purchase logic, and all safety edge cases. Co-authored-by: Cursor <cursoragent@cursor.com>
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on March 2. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
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
place_spot_order()method onKrakenClientusing the spot CCXT instanceget_account_balance()was missingawaitonfetch_balance()Safety guards
min_purchase_usd($5 default)reserve_usd— keeps configured amount untouchedmax_purchase_usdif configuredConfig (
config.yaml)Test plan
spot_dcasectionMade with Cursor