18 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
489408cf21 fix: pass equity_symbol to execution so Alpha Shield uses JUNIORBEES
_try_execute_sip_paper and _try_execute_sip_live were hardcoding
NIFTYBEES.NS regardless of strategy. Added equity_symbol/gold_symbol
params to try_execute_sip and propagated from runner using _EQUITY_SYM
(_GOLD_SYM). Also fixed JUNIORBEES check in state accounting helpers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03 10:13:25 +05:30
Thigazhezhilan J
622a74724b Fix price fetch failing after market hours by adding 5-day daily fallback
period=1d interval=1m returns empty after NSE closes at 3:30 PM IST.
Fall back to period=5d interval=1d to get last available close price.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 18:50:48 +05:30
Thigazhezhilan J
2309b78286 Add temporary debug print to verify strategy dispatch on server
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 02:55:33 +05:30
Thigazhezhilan J
3580e123e4 Add Alpha Shield strategy dispatch (JuniorBees + 60-month SMA allocation)
Introduces STRATEGY_REGISTRY, alpha_shield_allocation(), and compute_weights()
in strategy.py. Updates runner.py to dynamically load equity symbol, gold
symbol, and SMA window from the registry based on strategy_name, enabling
Alpha Shield (JUNIORBEES.NS + GOLDBEES.NS, 60M SMA) alongside Golden Nifty.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-03 02:41:59 +05:30
Thigazhezhilan J
247a1c5107 Make engine event payloads JSON safe 2026-04-15 09:54:35 +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
99e48144aa Fix live runner next-cycle timestamp parsing 2026-04-07 10:09:16 +05:30
Thigazhezhilan J
49950d4028 Fix MTM timestamp comparison in engine loop 2026-04-06 21:20:33 +05:30
Thigazhezhilan J
28ec6c9a4d Add Groww live broker integration 2026-04-05 19:42:08 +05:30
Thigazhezhilan J
6147a2e3e5 Handle Zerodha API order rejections gracefully 2026-04-05 14:49:34 +05:30
Thigazhezhilan J
88ea093525 Fix live market time handling in strategy engine 2026-04-02 09:59:09 +05:30
Thigazhezhilan J
f5bd36df64 Persist engine heartbeats during wait loops 2026-04-01 23:08:17 +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
root
db7315911b Fixed Errors 2026-02-01 20:34:57 +00:00
thigazhezhilan
53be845b6e Backend full repo clean 2026-02-01 13:57:30 +00:00