Risk Engineering

Build strategy packages with risk gates, not hidden assumptions.

Stockey turns trading ideas into structured, testable, self-hosted packages with explicit risk rules, historical backtest review, dry-run defaults, and live-disabled safeguards.

Risk checklist

Stop lossRequired
Target or exitRequired
Position sizingRequired
Max daily lossRecommended
Max open positionsRequired
Broker checklistRequired
Historical backtestRequired before package readiness
AI reviewRecommended
Live modeDisabled by default

Strategy risk state

Strategy
BankNifty Short Straddle
Segment
Multi-leg options
Backtest range
Broker-provided historical data
Risk completeness
76%
Data gaps
Detected
Live readiness
Locked
Deployment mode
Self-hosted only
76% risk completeness

Live safety guard

DRY_RUNtrue
LIVE_TRADING_ENABLEDfalse
RISK_ACKNOWLEDGEDfalse
BROKER_SECRET_STOREfalse
ORDER_ENDPOINTS_IN_STOCKEYfalse
No Stockey-side orders
Broker secrets excluded
Backtest ≠ prediction
AI review ≠ advice
Live locked by default
User-controlled runtime

Risk starts before code generation.

Stockey does not treat entry rules as a complete strategy. It asks for the missing risk, data, broker, and deployment details before a package is considered ready.

Explicit risk rules

Stop loss, target, time exit, sizing, exposure, and kill-switch rules are captured as structured fields.

Data limitations

Backtests are limited by broker-provided historical data or user-uploaded CSVs.

Broker constraints

Order types, data availability, static IP needs, and setup steps are surfaced before export.

AI review boundaries

AI explains assumptions and test results, but does not recommend securities or live trades.

Package safeguards

Generated packages include dry-run defaults, live guards, and risk acknowledgement checks.

User-controlled deployment

Live deployment happens outside Stockey, on infrastructure controlled by the user.

Every package moves through risk gates.

Each stage keeps strategy rules, risk controls, review steps, and package readiness visible before export.

Rules defined

strategy conditions are captured in StrategySchema

Risk controls added

sizing, stop loss, exit, and exposure rules are explicit

Historical backtest reviewed

results are based on available broker/CSV history

AI analysis reviewed

AI highlights weaknesses, data gaps, and improvement tests

Package baked

package includes configs, disclosures, and safety guards

Self-hosted deployment checklist

user controls final runtime and credentials

Risk assumptions become part of the StrategySchema.

strategy_schema.risk.json
{
  "risk_controls": {
    "stop_loss": "required",
    "target_or_exit": "required",
    "position_sizing": "required",
    "max_daily_loss": "recommended",
    "max_open_positions": "required",
    "kill_switch": "recommended"
  },
  "execution_boundary": {
    "stockey_order_execution": false,
    "live_mode_default": "disabled",
    "runtime": "self_hosted"
  },
  "data_boundary": {
    "source": "broker_historical_or_csv",
    "range": "available_data_only",
    "missing_data": "reported"
  }
}

Contract checks

StrategySchema records what the user confirmed
Missing assumptions block readiness
Backtest data windows are documented
Package versions preserve changes over time

Backtests explain the past. They do not predict the future.

Stockey backtests strategy logic against historical data available from the user's broker connection or uploaded CSV. Results are used for review, not performance guarantees.

Backtest Risk Report
Needs risk changes
Data window
Broker-provided
Data gaps
3 warnings
Trades tested
124
Max drawdown
Review required
Stop-loss behavior
Inconsistent
Exposure concentration
High
Cost/slippage assumptions
Configured
Readiness
Needs risk changes

AI analysis side panel

Drawdown clusters around opening volatility
Risk per trade may be too high for selected capital
Exit rule depends heavily on timeframe selection
Data gaps may affect result reliability
Suggested tests: stricter SL, time filter, max daily loss

Backtest analysis is educational and diagnostic. It is not investment advice and does not guarantee future results.

Live mode is disabled until the user enables it locally.

The exported package keeps runtime gates local, explicit, and user-controlled.

Required local acknowledgements

DRY_RUN manually changed by user
LIVE_TRADING_ENABLED manually changed by user
RISK_ACKNOWLEDGED set locally
Broker credentials added locally
Static IP acknowledged where required
Deployment checklist completed
safety_gate.py
if DRY_RUN != false:
    block_live_orders()
if LIVE_TRADING_ENABLED != true:
    block_live_orders()
if RISK_ACKNOWLEDGED != true:
    block_live_orders()
if broker_credentials_missing:
    block_live_orders()
Stockey does not enable live mode inside the SaaS. Live settings are configured only in the user's exported package environment.

AI can critique a strategy. It cannot approve a trade.

AI review stays diagnostic, bounded, and tied to the user's own strategy assumptions.

Assumption review

AI explains missing risk fields, ambiguous rules, unsupported logic, and data limitations.

Backtest analysis

AI summarizes drawdowns, trade distribution, stop-loss behavior, exposure, and weak points.

Experiment suggestions

AI suggests tests the user may choose to run, such as alternate exits, tighter risk limits, or different time windows.

AI review does not provide security recommendations, buy/sell calls, portfolio advice, or guaranteed outcomes.

Broker secrets stay outside the generated package.

The public product boundary keeps Stockey-side handling temporary and package credentials user-local.

Stockey side

  • Temporary historical-data access only when user requests it
  • No permanent broker-secret storage by default
  • No Stockey-side order placement
  • Secrets excluded from ZIP files
  • Package includes .env.example placeholders

User side

  • User enters broker credentials locally after export
  • User controls static IP or VPS setup
  • User controls final runtime
  • User accepts broker/API responsibilities
  • User monitors execution and logs

Every strategy shows a readiness state.

Readiness states make missing rules, review gates, package status, and deployment readiness visible.

Draft

Rules are incomplete.

Backtest Ready

Data source and core rules are ready for historical testing.

Review Required

Risk, data, or broker assumptions need user confirmation.

Package Ready

Strategy can be baked into an exportable package.

Deployment Ready

Self-hosted checklist is complete; live still disabled by default.

Treat risk as part of the strategy, not an afterthought.

Stockey helps you define risk rules, test assumptions, review limitations, and export packages with safety defaults before self-hosted deployment.