24 Commits

Author SHA1 Message Date
Thigazhezhilan J
298d245048 fix: surface SIP_NO_FILL warnings and prevent silent fund failures
- execution.py: dual-write SIP_NO_FILL and SIP_PARTIAL to engine_event
  so the strategy summary can surface them to users
- execution.py: emit SIP_NO_FILL event (with cash/required amounts) on
  the paper path instead of silently returning when funds are insufficient
- strategy_service.py: improve insufficient_funds message to show exact
  shortfall and reassure user that next SIP will auto-execute when funded
- strategy_service.py: clear SIP_NO_FILL warning after a successful
  SIP_TRIGGERED so it does not persist after funds are added
- runner.py: always write PRICE_FETCH_ERROR and HISTORY_LOAD_ERROR to
  engine_event regardless of ENGINE_DEBUG flag
- db.py (backend + engine): raise default pool sizes to 20/50 max
  connections to handle 100 concurrent users without pool exhaustion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 10:04:53 +05:30
Thigazhezhilan J
10e262231f feat: make paper and live trading fully independent
- start_strategy filters running check by mode so starting LIVE
  won't clash with an active PAPER run and vice versa
- stop_strategy and resume_strategy accept optional mode param
  so each tab stops/resumes only its own run
- paper_broker_service scopes all run lookups to mode=PAPER
- paper_mtm scopes run lookup to mode=PAPER
- routers/strategy exposes ?mode= query param on /stop and /resume
- run_service get_active_run_id and get_running_run_id already
  support mode filtering (added in previous session)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03 22:11:29 +05:30
Thigazhezhilan J
5dce19c7d8 Persist strategy change to DB when restarting an existing run
When start_strategy is called with a new strategy on an active run,
update strategy_config in DB before building engine config so the
new strategy is used both now and on future resumes/restarts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-01 10:47:14 +05:30
Thigazhezhilan J
dd2b9480d3 Fix strategy_name from request taking precedence over stale DB config
When restarting an existing run with a different strategy, the saved
DB config was winning over the user's selection. req.strategy_name
now takes priority so switching strategies works correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-01 10:41:57 +05:30
Thigazhezhilan J
b06f7d4ffa Fix strategy name fallback to use registry key instead of display name
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 18:33:52 +05:30
Thigazhezhilan J
9c171ba799 Fix broker reconciliation, health readiness, and live equity safety 2026-04-09 23:46:13 +05:30
Thigazhezhilan J
519addd78f Harden backend auth, execution safety, and market session logic 2026-04-08 22:02:24 +05:30
Thigazhezhilan J
c41f6f2411 Reconcile stale running strategy state 2026-04-06 11:10:03 +05:30
Thigazhezhilan J
28ec6c9a4d Add Groww live broker integration 2026-04-05 19:42:08 +05:30
Thigazhezhilan J
d5fa17b30d 2026-04-05 17:23:48 +05:30
Thigazhezhilan J
102f145553 Hide stale errors after strategy stop 2026-04-02 10:25:01 +05:30
Thigazhezhilan J
88ea093525 Fix live market time handling in strategy engine 2026-04-02 09:59:09 +05:30
Thigazhezhilan J
302edc5b79 Suppress stale market closed warnings 2026-04-01 21:07:40 +05:30
Thigazhezhilan J
1660b13778 Use run lifecycle for live strategy status 2026-04-01 10:12:03 +05:30
Thigazhezhilan J
4ae42baeb1 Make strategy stop idempotent 2026-04-01 09:49:42 +05:30
Thigazhezhilan J
c8edbf1a98 Ignore stale broker auth warnings after reconnect 2026-04-01 09:30:22 +05:30
Thigazhezhilan J
f92b5c5afc Fix resume lifecycle ordering 2026-03-28 14:37:42 +05:30
Thigazhezhilan J
bc79894cd1 Harden strategy resume failure handling 2026-03-28 14:25:42 +05:30
Thigazhezhilan J
382b5aa5f6 Improve resume strategy error handling and status updates 2026-03-28 13:45:51 +05:30
Thigazhezhilan J
79c036ca8b Add resume strategy functionality and update run status handling 2026-03-28 13:06:35 +05:30
Thigazhezhilan J
9770b7a338 Add live equity snapshots and improve broker handling 2026-03-25 23:33:09 +05:30
Thigazhezhilan J
c17222ad9c Refine live strategy execution flow 2026-03-24 21:59:17 +05:30
Thigazhezhilan J
7677895b05 thigal_test 2026-03-22 14:37:33 +05:30
thigazhezhilan
53be845b6e Backend full repo clean 2026-02-01 13:57:30 +00:00