Security

Your keys. Your machine. Your call.

AES-256-GCM encrypted vault · SEBI-ready audit trail · circuit-breaker aware guards · no broker passwords, no plaintext, no cloud retention.

The vault

Broker API keys live encrypted — per user, per session.

scrypt key derivation against a per-user salt. Same broker secret, different user → different ciphertext → no shared-state attack surface.

CredentialVault.ts

Format: salt:iv:authTag:ciphertext · base64 · colon-separated

derivedKey = scrypt(
  ENCRYPTION_SECRET + ':' + userId,
  salt,
  32
)
iv      = randomBytes(12)
cipher  = createCipheriv('aes-256-gcm', derivedKey, iv)
ct      = cipher.update(plaintext) + cipher.final()
authTag = cipher.getAuthTag()
row     = [salt, iv, authTag, ct].map(b => b.toString('base64')).join(':')
Zerodha Kite Connect, Angel One SmartAPI, Upstox OAuth, 5paisa TOTP — all stored the same way.

Risk guards

Seven guardrails. Every one overridable.

Defaults tuned for Indian market hours and SEBI ALGO guidelines. Tweak per strategy, per script.

GuardDefaultEffect
maxDailyLossPct2%Strategy auto-pauses when unrealised + realised loss exceeds 2% of deployed capital.
maxScripExposure30%Per-script position capped at 30% of total capital. Prevents single-name blowup.
circuitFilterAwareAlwaysAll orders skip stocks currently in upper/lower circuit. Auto-resume when band lifts.
minOrderEdgePct0.05% post-taxOrders rejected if post-STT edge < 5 bps. Configurable per strategy.
orderRateLimit10/secPer broker, per minute. SEBI ALGO guideline-compliant.
spanMarginBuffer15%F&O shorts reserve 15% over SPAN requirement for intraday MTM swings.
maxOpenOrders5 per scriptPrevents iceberg overflow.

Compliance

SEBI-ready from day one.

Every order carries a unique client-code-tagged ID. Full audit trail exportable for broker or regulator queries.

Order-ID tagged

Every fill traceable to strategy, timestamp, IP, client code

CAS-mapped

Connects to your CDSL/NSDL consolidated statement for full portfolio view

CA-friendly exports

CSV formatted for STCG/LTCG/intraday sections in ITR-2/ITR-3

Trust is a stack, not a slogan.

Every layer above is in production today. Ask hard questions — we ship the answers in code.