{"components":{"schemas":{"DeployRequest":{"properties":{"channels":{"example":["webhook"],"items":{"enum":["webhook","telegram","sse"],"type":"string"},"type":"array"},"model_name":{"description":"Model PKL stem or display name.","type":"string"},"telegram_chat_id":{"type":"string"},"webhook_url":{"format":"uri","type":"string"}},"required":["model_name"],"type":"object"},"DeployResponse":{"properties":{"channels":{"items":{"type":"string"},"type":"array"},"model":{"type":"string"},"status":{"example":"deployed","type":"string"}},"type":"object"},"DeployedList":{"properties":{"count":{"type":"integer"},"deployed":{"items":{"$ref":"#/components/schemas/DeployedModel"},"type":"array"}},"type":"object"},"DeployedModel":{"properties":{"channels":{"items":{"type":"string"},"type":"array"},"created_at":{"format":"date-time","type":"string"},"model":{"type":"string"},"telegram_chat_id":{"type":"string"},"webhook_url":{"type":"string"}},"type":"object"},"ErrorResponse":{"properties":{"code":{"example":401,"type":"integer"},"error":{"example":"Invalid or missing API key","type":"string"}},"required":["error"],"type":"object"},"FromTemplateRequest":{"properties":{"claude_model":{"type":"string"},"end_date":{"format":"date","type":"string"},"indicators":{"$ref":"#/components/schemas/Indicators"},"model":{"type":"string"},"pos_rules":{"$ref":"#/components/schemas/PosRules"},"start_date":{"format":"date","type":"string"},"symbol":{"default":"EURUSD","enum":["EURUSD","GBPUSD","USDJPY","USDCHF","AUDUSD","NZDUSD","USDCAD"],"type":"string"},"template":{"enum":["macd_momentum","mean_reversion","trend_following","scalper","conservative_long"],"type":"string"},"timeframe":{"default":"15min","enum":["1min","5min","15min","1h"],"type":"string"},"train_split":{"type":"number"}},"required":["template"],"type":"object"},"GenerateRequest":{"properties":{"claude_model":{"enum":["sonnet","opus","haiku"],"type":"string"},"description":{"description":"Optional one-line natural-language summary; Claude treats it as PRIMARY USER REQUEST.","type":"string"},"end_date":{"example":"2026-04-01","format":"date","type":"string"},"features":{"example":"RSI 14, Bollinger Bands","type":"string"},"indicators":{"$ref":"#/components/schemas/Indicators"},"model":{"example":"Random Forest","type":"string"},"optimization":{"type":"string"},"pos_rules":{"$ref":"#/components/schemas/PosRules"},"risk":{"example":"0.5% stop loss","type":"string"},"risk_function":{"type":"string"},"signals":{"example":"Buy when RSI < 30","type":"string"},"start_date":{"example":"2025-01-01","format":"date","type":"string"},"symbol":{"default":"EURUSD","description":"Forex pair to train/backtest on.","enum":["EURUSD","GBPUSD","USDJPY","USDCHF","AUDUSD","NZDUSD","USDCAD"],"type":"string"},"timeframe":{"default":"15min","description":"OHLC bar size.","enum":["1min","5min","15min","1h"],"type":"string"},"train_split":{"example":0.7,"type":"number"}},"type":"object"},"GenerateResponse":{"properties":{"code":{"description":"Full generated Python strategy code (feature_engineering + strategy_config functions).","type":"string"},"credits_remaining":{"type":"integer"}},"type":"object"},"Indicators":{"additionalProperties":true,"description":"Flat indicator config. See GET /api/v1/indicator-schema for full param list.","example":{"macd_enabled":true,"macd_fast":12,"macd_signal":9,"macd_slow":26,"rsi_enabled":true,"rsi_period":14},"properties":{},"type":"object"},"JobStatus":{"properties":{"error":{"type":"string"},"job_id":{"type":"integer"},"long_stats":{"$ref":"#/components/schemas/TradeStats"},"model_name":{"type":"string"},"model_stem":{"type":"string"},"short_stats":{"$ref":"#/components/schemas/TradeStats"},"status":{"enum":["queued","running","done","failed"],"type":"string"},"test_stats":{"$ref":"#/components/schemas/TradeStats"},"train_stats":{"$ref":"#/components/schemas/TradeStats"}},"type":"object"},"ModelInfo":{"properties":{"model_name":{"type":"string"},"name":{"description":"PKL stem: <user_id>_<SYMBOL>_<timeframe>_<model_name>","type":"string"},"test_stats":{"$ref":"#/components/schemas/TradeStats"},"train_stats":{"$ref":"#/components/schemas/TradeStats"},"trained_at":{"format":"date-time","type":"string"}},"type":"object"},"ModelsList":{"properties":{"count":{"type":"integer"},"models":{"items":{"$ref":"#/components/schemas/ModelInfo"},"type":"array"}},"type":"object"},"OhlcCandle":{"properties":{"close":{"type":"number"},"high":{"type":"number"},"low":{"type":"number"},"open":{"type":"number"},"timestamp":{"format":"date-time","type":"string"},"volume":{"type":"number"}},"type":"object"},"OneShotRequest":{"properties":{"deliver_to":{"description":"Channels to wire on deploy. Keys: webhook (bool|url), telegram (chat_id).","example":{"webhook":true},"type":"object"},"prompt":{"example":"Buy when RSI hits 30, sell when RSI hits 70","type":"string"}},"required":["prompt"],"type":"object"},"OneShotSseEvents":{"description":"Server-Sent Events stream (text/event-stream). See `description` for event types.","properties":{"_event_done":{"description":"Event: done. Terminal success.","properties":{"channels":{"items":{"type":"string"},"type":"array"},"live_url":{"type":"string"},"model":{"type":"string"},"stem":{"type":"string"}},"type":"object"},"_event_error":{"description":"Event: error. Terminal failure.","properties":{"error":{"type":"string"}},"type":"object"},"_event_step":{"description":"Event: step. Coarse progress between phases.","properties":{"msg":{"type":"string"},"pct":{"type":"integer"},"stage":{"enum":["generate","train","deploy"],"type":"string"}},"type":"object"},"_event_token":{"description":"Event: token. Streamed during code generation.","properties":{"text":{"type":"string"}},"type":"object"}},"type":"object"},"PosRules":{"properties":{"cooldown":{"example":0,"type":"integer"},"direction":{"enum":["both","long","short"],"type":"string"},"max_pos":{"example":1,"type":"integer"},"on_opposite":{"enum":["reverse","close_only","ignore"],"type":"string"}},"type":"object"},"PredictRequest":{"properties":{"end_date":{"format":"date","type":"string"},"model_name":{"type":"string"},"start_date":{"format":"date","type":"string"}},"required":["model_name"],"type":"object"},"PredictResponse":{"properties":{"n_signals":{"type":"integer"},"pnl":{"type":"number"},"signals":{"items":{"type":"object"},"type":"array"},"stats":{"$ref":"#/components/schemas/TradeStats"},"win_rate":{"type":"number"}},"type":"object"},"TradeStats":{"properties":{"avg":{"description":"Avg trade return (decimal pct)","type":"number"},"best":{"type":"number"},"expect":{"description":"Expectancy ($/trade)","type":"number"},"losses":{"type":"integer"},"mdd":{"description":"Max drawdown (decimal pct, signed)","type":"number"},"n":{"description":"Total trades","type":"integer"},"np":{"description":"Net profit ($)","type":"number"},"pf":{"description":"Profit factor (gross wins / gross losses)","type":"number"},"ret":{"description":"Total return (decimal pct)","type":"number"},"rr":{"description":"Risk:Reward (avg win / avg loss)","type":"number"},"wins":{"type":"integer"},"worst":{"type":"number"},"wr":{"description":"Win rate (0-1)","type":"number"}},"type":"object"},"TrainRequest":{"properties":{"capital":{"description":"Account balance in USD. Drives the $ P&L and return-on-equity (P&L % = $ P&L / balance).","example":10000,"type":"number"},"claude_model":{"type":"string"},"code":{"description":"Full Python strategy code (typically from /api/v1/generate).","type":"string"},"commission":{"example":6.0,"type":"number"},"confidence_threshold":{"example":55,"type":"number"},"end_date":{"format":"date","type":"string"},"indicators":{"$ref":"#/components/schemas/Indicators"},"leverage":{"description":"Margin only \u2014 sets required margin (notional / leverage); does NOT multiply P&L. Stored for future margin/liquidation modeling.","example":30,"type":"number"},"lot_size":{"description":"Position size in standard lots (1.0 = 100,000 units). This is the P&L driver: $ P&L = units \u00d7 (exit\u2212entry) / FX_conv \u2212 commission/swap.","example":1.0,"type":"number"},"model_name":{"description":"Optional. Auto-named Model N+1 if omitted.","example":"Model 1","type":"string"},"risk_unit":{"default":"pips","description":"How stop_loss/take_profit are interpreted. 'pips' = pip distance; 'usd' = $ risk at this lot; 'pct' = legacy fraction of price. The engine back-solves the price level per pair (pip_size + FX conversion).","enum":["pips","usd","pct"],"type":"string"},"start_date":{"format":"date","type":"string"},"stop_loss":{"description":"Stop-loss magnitude in risk_unit (e.g. 25 pips, or $250 when risk_unit='usd'). Omit/null to disable. Overrides the value in strategy_config().","example":25,"type":"number"},"swap_long":{"type":"number"},"swap_short":{"type":"number"},"symbol":{"default":"EURUSD","description":"Must match the symbol the code was generated for.","enum":["EURUSD","GBPUSD","USDJPY","USDCHF","AUDUSD","NZDUSD","USDCAD"],"type":"string"},"take_profit":{"description":"Take-profit magnitude in risk_unit (e.g. 50 pips). Omit/null to disable. Overrides the value in strategy_config().","example":50,"type":"number"},"timeframe":{"default":"15min","enum":["1min","5min","15min","1h"],"type":"string"},"train_split":{"example":0.7,"type":"number"}},"required":["code"],"type":"object"},"TrainStartResponse":{"properties":{"job_id":{"type":"integer"},"model_name":{"type":"string"},"model_stem":{"description":"PKL filename stem: <user_id>_<SYMBOL>_<timeframe>_<model_name>","type":"string"},"status":{"example":"queued","type":"string"}},"type":"object"},"TrialKeyRequest":{"description":"Optional body for /api/v1/key/trial. All fields optional.","properties":{"username":{"description":"Optional custom handle for /community. 3-20 chars, alphanumeric/dash/underscore. Returns 409 if taken. Omit to get an auto-generated 'adj-noun-NN' handle (e.g. swift-fox-247). Permanent \u2014 can't be changed later.","example":"my-bot-name","maxLength":20,"minLength":3,"pattern":"^[A-Za-z0-9][A-Za-z0-9_\\-]{2,19}$","type":"string"}},"type":"object"},"TrialKeyResponse":{"description":"Anonymous trial key, 10,000 credits, browser-bound, rate-limited 5/IP/hr.","properties":{"api_key":{"example":"qm_a1b2c3d4e5f6...","type":"string"},"credits":{"example":10000,"type":"integer"},"is_trial":{"example":true,"type":"boolean"},"user_id":{"example":42,"type":"integer"},"username":{"example":"swift-fox-247","type":"string"}},"type":"object"},"WhoamiResponse":{"properties":{"api_key":{"type":"string"},"is_trial":{"example":false,"type":"boolean"},"plan":{"enum":["free","pro"],"type":"string"},"user_id":{"type":"integer"},"username":{"example":"malco","type":"string"}},"type":"object"}},"securitySchemes":{"ApiKeyAuth":{"description":"Get a key via POST /api/v1/key/trial (anonymous) or sign in at quantifyme.ai.","in":"header","name":"X-API-Key","type":"apiKey"}}},"info":{"contact":{"email":"support@quantifyme.ai","name":"QuantifyMe","url":"https://quantifyme.ai"},"description":"QuantifyMe is a no-code quantitative trading platform. Describe a strategy in natural language \u2192 AI generates Python code \u2192 backtest on forex OHLC (7 majors: EUR/USD, GBP/USD, USD/JPY, USD/CHF, AUD/USD, NZD/USD, USD/CAD; timeframes 1min / 5min / 15min / 1h) \u2192 deploy live signals via webhook, Telegram, or SSE.\n\n**For AI agents**: the single endpoint `POST /api/v1/one_shot` performs the full generate \u2192 train \u2192 deploy flow as one SSE call. Use `POST /api/v1/key/trial` to obtain an anonymous key (no signup) \u2014 10,000 credits, browser-bound.","license":{"name":"MIT"},"title":"QuantifyMe API","version":"1.0.0"},"openapi":"3.1.0","paths":{"/api/v1/activity":{"get":{"operationId":"activity","parameters":[{"in":"query","name":"limit","schema":{"default":50,"maximum":200,"type":"integer"}},{"description":"ISO timestamp cursor for pagination.","in":"query","name":"before","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"security":[],"summary":"Recent public ecosystem activity (trains, deploys, shares) \u2014 paginated","tags":["Community"]}},"/api/v1/activity/stream":{"get":{"operationId":"activityStream","responses":{"200":{"content":{"text/event-stream":{"schema":{"$ref":"#/components/schemas/OneShotSseEvents"}}},"description":"Successful response \u2014 Server-Sent Events stream. Each message is `event: <type>\\ndata: <json>\\n\\n`."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"security":[],"summary":"Live public ecosystem activity as Server-Sent Events","tags":["Community"]}},"/api/v1/caps":{"get":{"operationId":"caps","responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Current usage caps for the authenticated key (daily compute/generation limits, platform cost-guard)","tags":["Auth"]}},"/api/v1/community.json":{"get":{"operationId":"communityJson","responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"security":[],"summary":"Full /community catalogue as JSON (every shared strategy with metrics)","tags":["Community"]}},"/api/v1/deploy":{"post":{"operationId":"deploy","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeployRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeployResponse"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Deploy a trained model for live signal delivery (free tier auto-swaps)","tags":["Deploy"]}},"/api/v1/deploy/{model}":{"delete":{"operationId":"undeploy","parameters":[{"in":"path","name":"model","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Undeploy a live model","tags":["Deploy"]}},"/api/v1/deployed":{"get":{"operationId":"listDeployed","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeployedList"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"List the user's currently deployed (live) models","tags":["Deploy"]}},"/api/v1/examples":{"get":{"operationId":"examples","parameters":[{"in":"query","name":"category","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"security":[],"summary":"Browseable API usage examples","tags":["Discovery"]}},"/api/v1/fork/{community_id}":{"post":{"operationId":"fork","parameters":[{"in":"path","name":"community_id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Fork a community strategy into the caller's account (copies the code; re-train to materialise a model)","tags":["Community"]}},"/api/v1/generate":{"post":{"operationId":"generateStrategy","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateResponse"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Generate Python strategy code from natural language","tags":["Strategy"]}},"/api/v1/generate/from-template":{"post":{"operationId":"generateFromTemplate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FromTemplateRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateResponse"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Generate strategy code from a curated template with optional overrides","tags":["Strategy"]}},"/api/v1/generate/stream":{"post":{"operationId":"generateStrategyStream","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateRequest"}}},"required":true},"responses":{"200":{"content":{"text/event-stream":{"schema":{"$ref":"#/components/schemas/OneShotSseEvents"}}},"description":"SSE stream. Events: `token` `{text}`, `done` `{code}`, `error` `{error}`. \u2014 Server-Sent Events stream. Each message is `event: <type>\\ndata: <json>\\n\\n`."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Stream strategy code generation token-by-token (SSE)","tags":["Strategy"]}},"/api/v1/indicator-schema":{"get":{"operationId":"indicatorSchema","responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"security":[],"summary":"List available indicators with parameter names, types, defaults","tags":["Discovery"]}},"/api/v1/indicators":{"post":{"operationId":"computeIndicators","responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Compute built-in indicators on OHLC without training","tags":["Data"]}},"/api/v1/indicators/custom":{"post":{"operationId":"customIndicator","responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Convert Pine Script or NL to a computed indicator (Claude)","tags":["Data"]}},"/api/v1/key/generate":{"post":{"operationId":"generateKey","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrialKeyResponse"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Generate or rotate a personal API key (logged-in users)","tags":["Auth"]}},"/api/v1/key/trial":{"post":{"operationId":"createTrialKey","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrialKeyRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrialKeyResponse"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"security":[],"summary":"Create an anonymous trial API key (no signup). Optional body: {\"username\": \"my-bot-name\"} to claim a custom handle on /community (3-20 chars, alphanumeric/dash/underscore). Without a username, you get an auto-generated 'adj-noun-NN' handle (e.g. swift-fox-247).","tags":["Auth"]}},"/api/v1/key/usage":{"get":{"operationId":"keyUsage","responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Get current key's credit balance and usage history","tags":["Auth"]}},"/api/v1/leaderboard":{"get":{"operationId":"leaderboard","parameters":[{"in":"query","name":"sort","schema":{"default":"pf","enum":["wr","pf","ret"],"type":"string"}},{"in":"query","name":"symbol","schema":{"type":"string"}},{"in":"query","name":"timeframe","schema":{"type":"string"}},{"in":"query","name":"limit","schema":{"default":50,"type":"integer"}}],"responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"security":[],"summary":"Top community strategies ranked by win rate / profit factor / return","tags":["Community"]}},"/api/v1/lineage/{community_id}":{"get":{"operationId":"lineage","parameters":[{"in":"path","name":"community_id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"security":[],"summary":"Fork lineage (ancestors + descendants) for a community strategy","tags":["Community"]}},"/api/v1/models":{"get":{"operationId":"listModels","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelsList"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"List the user's trained models with pre-computed train/test stats","tags":["Models"]}},"/api/v1/models/{name}":{"delete":{"operationId":"deleteModel","parameters":[{"in":"path","name":"name","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Delete a model (PKL + strategy file)","tags":["Models"]}},"/api/v1/ohlc":{"get":{"operationId":"getOhlc","parameters":[{"in":"query","name":"symbol","schema":{"default":"EURUSD","type":"string"}},{"in":"query","name":"timeframe","schema":{"default":"15min","enum":["1min","5min","15min","1h"],"type":"string"}},{"in":"query","name":"start","schema":{"format":"date","type":"string"}},{"in":"query","name":"end","schema":{"format":"date","type":"string"}},{"in":"query","name":"limit","schema":{"default":1000,"maximum":5000,"type":"integer"}}],"responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Get OHLC candle data","tags":["Data"]}},"/api/v1/one_shot":{"post":{"operationId":"oneShot","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OneShotRequest"}}},"required":true},"responses":{"200":{"content":{"text/event-stream":{"schema":{"$ref":"#/components/schemas/OneShotSseEvents"}}},"description":"SSE stream of token/step/done/error events. Terminal `event: done` carries `{live_url, model, stem, channels}`. \u2014 Server-Sent Events stream. Each message is `event: <type>\\ndata: <json>\\n\\n`."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"End-to-end deploy from one prompt (generate \u2192 train \u2192 deploy)","tags":["AI agents"]}},"/api/v1/payouts":{"get":{"operationId":"payouts","responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"security":[],"summary":"Charity-payout ledger (the markup-derived donations the platform has made)","tags":["Community"]}},"/api/v1/predict":{"post":{"operationId":"predict","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PredictResponse"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Run prediction (forward inference) on a trained model over a date range","tags":["Prediction"]}},"/api/v1/presets":{"get":{"operationId":"presets","responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"security":[],"summary":"List chip presets, position-rules schema, and curated templates","tags":["Discovery"]}},"/api/v1/results/{model}":{"get":{"operationId":"getResults","parameters":[{"in":"path","name":"model","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Full backtest results: metrics, trades, equity curve","tags":["Models"]}},"/api/v1/share":{"post":{"operationId":"share","responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Publish the caller's most-recent trained model to /community (gated: n_trades >= 1 AND total return > 0)","tags":["Community"]}},"/api/v1/signals/{model}":{"get":{"operationId":"getSignals","parameters":[{"in":"path","name":"model","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Get cached prediction signals for a model","tags":["Prediction"]}},"/api/v1/telegram/code":{"get":{"operationId":"telegramCode","responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Get/poll the user's Telegram pairing code","tags":["Deploy"]}},"/api/v1/ticks":{"get":{"operationId":"getTicks","responses":{"200":{"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Get raw orderbook ticks (legacy; prefer /ohlc)","tags":["Data"]}},"/api/v1/train":{"post":{"operationId":"train","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrainRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrainStartResponse"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Submit a training job (non-blocking, returns job_id for polling)","tags":["Training"]}},"/api/v1/train/{job_id}":{"get":{"operationId":"trainStatus","parameters":[{"in":"path","name":"job_id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobStatus"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"summary":"Poll training job status. Returns metrics when status=done.","tags":["Training"]}},"/api/v1/whoami-key":{"get":{"operationId":"whoami","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhoamiResponse"}}},"description":"Successful response"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Invalid or missing API key"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Rate limit exceeded"}},"security":[],"summary":"Resolve session cookie or X-API-Key into the user's identity","tags":["Auth"]}}},"security":[{"ApiKeyAuth":[]}],"servers":[{"description":"Production","url":"https://api.quantifyme.ai"}],"tags":[{"description":"End-to-end automation for ChatGPT, Claude, scripts.","name":"AI agents"},{"description":"Trial keys, personal keys, identity.","name":"Auth"},{"description":"Generate Python strategy code from natural language.","name":"Strategy"},{"description":"Submit and poll training jobs.","name":"Training"},{"description":"List, fetch, delete trained models.","name":"Models"},{"description":"Run inference, fetch cached signals.","name":"Prediction"},{"description":"Live signal delivery (webhook, Telegram).","name":"Deploy"},{"description":"OHLC candles, indicators.","name":"Data"},{"description":"Public catalogue, leaderboard, activity feed, forking, payouts.","name":"Community"},{"description":"Public schemas \u2014 no auth required.","name":"Discovery"}]}
