All notable changes to Robson Bot will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Removed dead legacy roots from the repository:
apps/,data/,k8s/,pyproject.toml, andsonar-project.properties. - Moved the worktree helper from
devtools/toscripts/and updated the live developer and deployment docs to match the current layout. - Updated the pull request template and frontend deployment runbook to
reference the current Rust + SvelteKit +
rbx-infrastructure.
- rustfmt.toml restored: Rich nightly-only configuration (
imports_granularity,group_imports,wrap_comments,brace_style,where_single_line,normalize_comments,format_code_in_doc_comments) reinstated after being stripped down to stable-only options. Obsolete optionsversionandedition_idiomsremoved (renamed/removed in current nightly). - CI uses nightly rustfmt: Added
rustup toolchain install nightly --component rustfmtstep; formatting check now runscargo +nightly fmt --all --checkinstead of stable. - GitOps paths corrected:
Build & Push Imagejob was targeting non-existent pathsapps/prod/robson/robsond-deploy.ymlin rbx-infra. Fixed to correct paths:apps/prod/robson/robsond-deploy.ymlandapps/prod/robson/robsond-db-migrate-job.yml. - Codebase reformatted with nightly rustfmt (62 files, net −534 lines).
-
Pattern Detection System: Deterministic, idempotent technical pattern recognition
- 7 patterns implemented (5 candlestick + 2 chart):
- Candlestick: Hammer, Inverted Hammer, Bullish Engulfing, Bearish Engulfing, Morning Star
- Chart: Head & Shoulders, Inverted Head & Shoulders
- Pure domain layer (NO Django dependencies in core)
- Hexagonal architecture (ports & adapters)
- All timestamps from exchange data (timezone-independent)
- Idempotent persistence (stable uniqueness keys)
- Module:
apps/backend/monolith/api/application/pattern_engine/(11 files, 3,176 lines)
- 7 patterns implemented (5 candlestick + 2 chart):
-
Pattern Detectors:
HammerDetector- Bullish reversal (1 candle, confidence: 0.75)InvertedHammerDetector- Bullish reversal (1 candle, confidence: 0.70)EngulfingDetector- Bullish/Bearish reversal (2 candles, confidence: 0.80)MorningStarDetector- Bullish reversal (3 candles, confidence: 0.85)HeadAndShouldersDetector- Bearish reversal (multi-bar, confidence: 0.80)InvertedHeadAndShouldersDetector- Bullish reversal (multi-bar, confidence: 0.80)
-
Pattern Lifecycle Management:
- States: FORMING → CONFIRMED → INVALIDATED
- Automatic confirmation checks (e.g., Hammer confirmed on close above high)
- Automatic invalidation checks (e.g., Hammer invalidated on close below low)
- PatternAlert emission (idempotent, uniqueness key: instance_id + alert_type + alert_ts)
-
Management Command:
python manage.py detect_patterns SYMBOL TIMEFRAME [--all|--candlestick|--chart]- Flexible detector selection (individual pattern flags: --hammer, --hns, etc.)
- Rich terminal output with idempotency tracking
- File:
apps/backend/monolith/api/management/commands/detect_patterns.py(371 lines)
-
Tests:
- 22+ test cases (869 lines)
- Pure unit tests (helpers, golden OHLC sequences)
- Idempotency integration tests (CRITICAL: 2nd run creates 0 instances/alerts)
- Property tests (optional, requires Hypothesis)
- File:
apps/backend/monolith/api/tests/test_pattern_engine.py
-
Documentation:
- ADR-0018: Architecture decision record
- PATTERN_ENGINE_V1.md: Technical specification with detection rules
- PATTERN_ENGINE_IMPLEMENTATION_PLAN.md: Milestones M1-M8
- PATTERN_ENGINE_IMPLEMENTATION_SUMMARY.md: Usage guide with examples
- PATTERN_ENGINE_SESSION_HANDOFF.md: Deployment guide
- ✅ Deterministic: Same OHLC → Same patterns (no randomness)
- ✅ Idempotent: Re-scans create 0 duplicates (verified: alerts_created=0 on 2nd run)
- ✅ Timezone-Independent: All timestamps from exchange data (no
datetime.now()) - ✅ Non-Executing: Emits alerts only (NO order placement)
- ✅ Zero Schema Changes: Uses existing production models (PatternInstance, PatternAlert)
- Uses existing
MarketDataServicefor candle fetching (with caching) - Uses existing Django pattern models (no migrations required)
- Output:
PatternAlerttable ready for EntryGate (CORE 1.2) consumption - Future: Hand-Span Trailing Stop (CORE 1.1) triggered on confirmed patterns
-
BTC-Portfolio Tracking: Complete portfolio valuation and profit tracking in BTC terms
- New transaction types:
DEPOSITandWITHDRAWALfor external flows - New movement category:
EXTERNALfor deposits/withdrawals - BTC fields in
BalanceSnapshot:total_equity_btc,spot_btc_value,margin_btc_value
- New transaction types:
-
BTCConversionService: Price discovery and conversion service
- Multi-route price discovery (direct pair, USDT, BUSD)
- 60-second price caching to avoid rate limits
- Converts any asset balance to BTC
- File:
apps/backend/monolith/api/services/btc_conversion_service.py(250 lines)
-
PortfolioBTCService: Portfolio calculation and profit tracking
- Total portfolio value denominated in BTC
- Profit formula:
Current Balance (BTC) + Withdrawals (BTC) - Deposits (BTC) - Historical BTC value tracking
- File:
apps/backend/monolith/api/services/portfolio_btc_service.py(358 lines)
-
Binance Sync: Automatic deposit/withdrawal synchronization
- Syncs from Binance API using
get_deposit_history()andget_withdraw_history() - Deduplicates by
binance_order_id - Only syncs successful transactions (status=6)
- Extended
AuditServicewithsync_deposits_and_withdrawals()method
- Syncs from Binance API using
-
REST API Endpoints:
GET /api/portfolio/btc/total/- Current portfolio value in BTCGET /api/portfolio/btc/profit/- Profit in BTC with breakdownGET /api/portfolio/btc/history/- Historical BTC value over timeGET /api/portfolio/deposits-withdrawals/- List of deposits/withdrawals
-
CLI Commands:
python manage.py portfolio_btc- Show portfolio in BTCpython manage.py portfolio_btc --profit- Show profit since inceptionpython manage.py sync_deposits --days-back 30- Sync deposits/withdrawals
-
BTCPortfolioDashboard Component: Complete portfolio dashboard with tabbed navigation
- Overview Tab: Total value, profit metrics, account breakdown
- History Tab: Interactive chart using Recharts with timeline filtering
- Transactions Tab: Filterable table of deposits/withdrawals
- Auto-refresh every 60 seconds
- File:
apps/frontend/src/components/logged/BTCPortfolioDashboard.jsx
-
Patrimony Component Updated: Now displays BTC-denominated portfolio
- Shows total portfolio value in BTC
- Displays profit/loss in BTC with color coding
- Account and transaction summaries
- File:
apps/frontend/src/components/logged/Patrimony.jsx
-
Footer Updated:
- Changed "Designed by Deepmind Team" → "Designed by RBX Robótica"
- Removed debug text about application mode and BACKEND_URL
-
Unit Tests:
test_btc_conversion_service.py- Price discovery edge cases
- Zero division handling
- Invalid asset handling
- Cache behavior verification
-
Integration Tests:
test_btc_portfolio_endpoints.py- Profit calculation correctness
- API error handling
- Transaction filtering
- Empty data handling
-
Frontend Tests:
BTCPortfolioDashboard.test.js- Loading and error states
- Tab navigation
- Data rendering
- Auto-refresh functionality
- Migration 0019: Added BTC portfolio tracking fields
- New transaction types:
DEPOSIT,WITHDRAWAL - New category:
EXTERNAL - New BalanceSnapshot fields:
total_equity_btc,spot_btc_value,margin_btc_value
- New transaction types:
- Updated
AuditServiceto support external flow synchronization - Extended
main_urls.pywith BTC portfolio routes - Updated
LoggedHomeScreen.jsxto include BTCPortfolioDashboard
- Architecture: Hexagonal (Ports & Adapters)
- Language: 100% English (code, comments, docs)
- Testing: pytest (backend), vitest (frontend)
- Frontend Library: Recharts 2.12.7 (already installed)
- Backend: Django 5.2, Python 3.12
# Apply database migration
python manage.py migrate api
# Sync historical deposits (last 90 days)
python manage.py sync_deposits --days-back 90
# Verify portfolio in BTC
python manage.py portfolio_btc --profitFor versions prior to 2025-12-26, please refer to git history.