{"openapi":"3.1.0","info":{"title":"Chart Library API","description":"Chart pattern intelligence engine for financial markets.\n\nSpecify a (symbol, date, timeframe) anchor to find the top 10 most similar historical chart patterns from 800M+ minute bars. Get cohort distributions, per-feature attribution, regime stratification, Layer 5 memory, and AI-generated narratives. Text + agent-first.\n\n## Authentication\n- **Frontend users**: JWT Bearer token from `/api/v1/auth/login`\n- **Developers / AI agents**: API key (`cl_` prefix) from `/api/v1/keys`\n\n## Quick Start\n1. Create an account at [chartlibrary.io/login](https://chartlibrary.io/login)\n2. Generate an API key at `/api/v1/keys`\n3. Use the key as `Authorization: Bearer cl_your_key`\n4. Search: `POST /api/v1/search/text` with `{\"query\": \"AAPL 2024-06-15\"}`\n5. Get returns: `POST /api/v1/follow-through` with the search results\n\n## API Key Tiers\n| Tier | Rate Limit | Monthly Quota | Price |\n|------|-----------|---------------|-------|\n| free | 10/min | 100/day | $0 |\n| pro | 60/min | 10,000/mo | $49/mo |\n| business | 300/min | 100,000/mo | $199/mo |\n\n## Agent Hints\n- `similarity` < 10 = excellent match, 10-25 = good, > 50 = weak\n- `match_score` is 0-100 (higher = better), derived from L2 distance\n- Always call `/api/v1/follow-through` after search to get forward returns\n- Use `timeframe=rth` for regular hours, `premarket` for pre-market\n\n## Links\n- Website: [chartlibrary.io](https://chartlibrary.io)\n- Developer portal: [chartlibrary.io/developers](https://chartlibrary.io/developers)\n","contact":{"name":"Chart Library","url":"https://chartlibrary.io/developers"},"license":{"name":"Proprietary","url":"https://chartlibrary.io/terms"},"version":"1.2.0"},"paths":{"/api/v1/stats/agents":{"get":{"tags":["Admin"],"summary":"Agent Stats","description":"View MCP/agent API usage stats.","operationId":"agent_stats_api_v1_stats_agents_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/search/text":{"post":{"tags":["Search"],"summary":"Search Text","description":"Search for similar patterns by symbol + date text query.\n\nPass `Authorization: Bearer cl_...` (API key) or a JWT token.","operationId":"search_text_api_v1_search_text_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TextSearchRequest"}}},"required":true},"responses":{"200":{"description":"Similar patterns found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResponse"}}}},"404":{"description":"No data for the given symbol/date"},"422":{"description":"Invalid query format"},"429":{"description":"Rate limit or quota exceeded"}},"security":[{"HTTPBearer":[]}]}},"/api/v1/analyze":{"post":{"tags":["Search"],"summary":"Analyze Pattern","description":"[DEPRECATED — use /api/v1/cohort_analyze] Combined endpoint: search + follow-through + AI summary in one call.\n\nAudit caught this returning 200 with empty results after 20s for valid\ntrading days. The successor /api/v1/cohort_analyze is faster, more\ninformative, and handles weekend dates with a structured 422 hint.\nThis endpoint will be removed after 2026-08-01. RFC 8594 Deprecation\n+ Sunset headers are set on every response.\n\nSearches for similar historical chart patterns, computes forward returns,\nand optionally generates an AI summary — all in a single request.\n\nPass `Authorization: Bearer cl_...` (API key) or a JWT token.\nAnonymous access is allowed with standard free-tier limits.","operationId":"analyze_pattern_api_v1_analyze_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyzeRequest"}}},"required":true},"responses":{"200":{"description":"Complete pattern analysis (search + follow-through + summary). DEPRECATED — use /api/v1/cohort_analyze.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyzeResponse"}}}},"404":{"description":"No data for the given symbol/date"},"422":{"description":"Invalid query format"},"429":{"description":"Rate limit or quota exceeded"}},"deprecated":true,"security":[{"HTTPBearer":[]}]}},"/api/v1/peer-comparison/{symbol}":{"get":{"tags":["Agent Intelligence"],"summary":"Peer Comparison","description":"Compare a pattern's sector-peer response vs. market-wide response.\n\nRuns two searches side-by-side: all matches, then same-sector-only.\nReturns forward-return stats for each plus a divergence score showing\nwhether the sector reacts differently than the market does to this\npattern shape. Useful for peer-relative analysis — \"when semis looked\nlike this, they moved X vs. the broader market at Y.\"","operationId":"peer_comparison_api_v1_peer_comparison__symbol__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}},{"name":"date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date"}},{"name":"timeframe","in":"query","required":false,"schema":{"type":"string","default":"rth","title":"Timeframe"}},{"name":"top_n","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Top N"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PeerComparisonResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/follow-through":{"post":{"tags":["Follow-Through"],"summary":"Follow Through","description":"Compute forward returns for search results.\n\nTakes the results from a search endpoint and computes what happened next\n(1, 3, 5, and 10-day forward returns) for each matching pattern.\nAlso computes distance-weighted statistics.","operationId":"follow_through_api_v1_follow_through_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FollowThroughRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FollowThroughResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/cohort":{"post":{"tags":["Cohort"],"summary":"Conditional distribution for a chart pattern","description":"Return the distribution of forward outcomes (return, MAE, MFE) for a cohort of historical chart-pattern matches filtered by regime, sector, liquidity, events, and date range. Designed for AI agents that need conditional base rates, not point estimates.","operationId":"cohort_endpoint_api_v1_cohort_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/cohort/{cohort_id}/filter":{"post":{"tags":["Cohort"],"summary":"Narrow a stored cohort with additional filters (sub-second, no kNN re-run)","operationId":"cohort_refine_api_v1_cohort__cohort_id__filter_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string","title":"Cohort Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortRefineRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cohort_analyze":{"post":{"tags":["Cohort"],"summary":"Layer 3 cohort intelligence (V5 retrieval + Layer 2 metadata)","description":"Given a (symbol, date, timeframe) anchor, retrieve the K nearest V5 analogs, optionally filter by Layer 2 metadata, and return: outcome distribution per horizon, per-feature importance, regime stratification, risk profile, and a cohort tightness score.\n\nEmpirical-distribution analysis — does NOT predict a point return. It surfaces what historical analogs did and which features separated winners from losers within this specific cohort.\n\n**Trimming the response**: pass `fields=[\"outcome_distribution\"]` (or any subset of the optional top-level keys) to slim the JSON to just what you need. Always-on keys (`anchor`, `cohort_size_actual`, `elapsed_ms`, `warnings`) are returned regardless. See `CohortAnalyzeRequest.fields` for the full list.","operationId":"cohort_analyze_api_v1_cohort_analyze_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortAnalyzeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/cohort_live":{"post":{"tags":["Cohort"],"summary":"Live cohort — analogs of the symbol's CURRENT intraday state","description":"Computes a fresh V5 embedding from the symbol's most recent bars and retrieves the K nearest historical analogs. Returns the same outcome-distribution shape as /cohort_analyze but anchored to intraday-current instead of a stored EOD date.\n\nCached internally for ~60s per (symbol, scale). Safe to call every minute from a live UI.\n\nDoes NOT predict a return — it surfaces the conditional distribution of what historical analogs did next.","operationId":"cohort_live_api_v1_cohort_live_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__CohortLiveRequest__1"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/decision_brief":{"post":{"tags":["Cohort"],"summary":"Decision-grade orchestrator — output-first synthesis","description":"Single call that composes cohort_analyze (depth=full) + anchor metadata + symbol_intelligence + narrative_pulse into a structured decision brief. Output schema is shaped to force conditional language: 'in current regime X, historical analogs returned Y' rather than 'predicted Y'. Includes a `system_prompt_excerpt` field the agent can quote verbatim.\n\nUse this as the default first call from any new agent integration. Power users can still call the underlying primitives (`cohort_analyze`, `symbol_intelligence`, `narrative_pulse`) directly for granular control.\n\nReturns roughly: current_regime · cohort_total · in_current_regime · outside_current_regime · conditional_edge (the alpha read) · thesis_invalidation_triggers · memory_context · narrative_context · conviction · decision_card · system_prompt_excerpt.","operationId":"decision_brief_endpoint_api_v1_decision_brief_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecisionBriefRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/cohort_summary":{"post":{"tags":["Cohort"],"summary":"Plain-English summary of a cohort_analyze result (Claude Haiku)","description":"Runs cohort_analyze internally and wraps the structured output in a concise narrative. Three fields: summary (3-4 sentences leading with the most actionable signal), takeaway (one-sentence actionable point), caveats (sample-size, tightness, news-coverage caveats). Cached at the (anchor, cohort_size, filters) hash for one hour. Agents using /v1/cohort_analyze directly should ignore this endpoint and consume the structured JSON natively — this exists for human-facing surfaces only.","operationId":"cohort_summary_api_v1_cohort_summary_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortSummaryRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/symbol_intelligence/{symbol}":{"get":{"tags":["Cohort"],"summary":"Per-symbol memory: hit rate, regime exposure, feature reliability","description":"Aggregates the past N days of cohort_observations for this symbol. Returns hit-rate per horizon, regime-exposure histogram, conformal coverage, top features ranked by sign-alignment with realized returns, and the most recent observations. Empty / 'insufficient_history' until enough cohort_analyze calls have been logged for this ticker.","operationId":"symbol_intelligence_api_v1_symbol_intelligence__symbol__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}},{"name":"lookback_days","in":"query","required":false,"schema":{"type":"integer","default":365,"title":"Lookback Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/similar_cohorts":{"get":{"tags":["Cohort"],"summary":"Cohort-of-cohorts retrieval — prior analyses similar to this anchor","description":"Second-order retrieval: V5 finds chart shapes, this finds *analyses*. Embeds each cohort_analyze response into a 256-dim fingerprint (distribution moments + top feature importances + regime onehot + score components) and returns the k nearest prior observations. Surfaces the 'this looks like the time when...' insight for both humans and agents.","operationId":"similar_cohorts_api_v1_similar_cohorts_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"symbol","in":"query","required":true,"schema":{"type":"string","title":"Symbol"}},{"name":"date","in":"query","required":true,"schema":{"type":"string","title":"Date"}},{"name":"timeframe","in":"query","required":false,"schema":{"type":"string","default":"1h","title":"Timeframe"}},{"name":"top_k","in":"query","required":false,"schema":{"type":"integer","default":8,"title":"Top K"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/feature_reliability":{"get":{"tags":["Cohort"],"summary":"Cross-cohort meta-learned feature predictiveness","description":"Returns rows from feature_reliability — per (feature, regime, horizon) sign-alignment of within-cohort feature importance with realized returns. Refit nightly from cohort_observations. Useful for understanding which features have actually been predictive in different regimes, not just statistically significant in-cohort.","operationId":"feature_reliability_api_v1_feature_reliability_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"feature","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Feature"}},{"name":"regime","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Regime"}},{"name":"horizon","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Horizon"}},{"name":"min_n","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Min N"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cohort_compare":{"get":{"tags":["Cohort"],"summary":"Diff two cohort analyses (cross-anchor structural comparison)","description":"Runs cohort_analyze on two anchors and returns a structured diff: distribution moments, top-feature overlap/divergence + sign-direction disagreement, regime fingerprint deltas (vol, macro, news posture), and risk profile comparison. Designed for the 'this looks like the time when...' transfer-learning question. Direction-disagreement features are the most actionable structural difference.","operationId":"cohort_compare_api_v1_cohort_compare_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"a_symbol","in":"query","required":true,"schema":{"type":"string","title":"A Symbol"}},{"name":"a_date","in":"query","required":true,"schema":{"type":"string","title":"A Date"}},{"name":"b_symbol","in":"query","required":true,"schema":{"type":"string","title":"B Symbol"}},{"name":"b_date","in":"query","required":true,"schema":{"type":"string","title":"B Date"}},{"name":"a_timeframe","in":"query","required":false,"schema":{"type":"string","default":"1h","title":"A Timeframe"}},{"name":"b_timeframe","in":"query","required":false,"schema":{"type":"string","default":"1h","title":"B Timeframe"}},{"name":"cohort_size","in":"query","required":false,"schema":{"type":"integer","default":300,"title":"Cohort Size"}},{"name":"horizon","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Horizon"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cohort_compare_summary":{"get":{"tags":["Cohort"],"summary":"Plain-English summary of a cohort comparison (Claude Haiku)","description":"Runs cohort_compare internally and wraps the structural diff in a headline + paragraph narrative. Presentation-layer only — agents consume /v1/cohort_compare JSON directly. Cached on the (anchor_a, anchor_b, horizon) tuple.","operationId":"cohort_compare_summary_api_v1_cohort_compare_summary_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"a_symbol","in":"query","required":true,"schema":{"type":"string","title":"A Symbol"}},{"name":"a_date","in":"query","required":true,"schema":{"type":"string","title":"A Date"}},{"name":"b_symbol","in":"query","required":true,"schema":{"type":"string","title":"B Symbol"}},{"name":"b_date","in":"query","required":true,"schema":{"type":"string","title":"B Date"}},{"name":"a_timeframe","in":"query","required":false,"schema":{"type":"string","default":"1h","title":"A Timeframe"}},{"name":"b_timeframe","in":"query","required":false,"schema":{"type":"string","default":"1h","title":"B Timeframe"}},{"name":"cohort_size","in":"query","required":false,"schema":{"type":"integer","default":300,"title":"Cohort Size"}},{"name":"horizon","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Horizon"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/narrative_pulse/{symbol}":{"get":{"tags":["Cohort"],"summary":"Single-symbol narrative pulse + recent articles","description":"Returns today's narrative pulse for one symbol along with up to 5 recent articles as evidence. Used by /app to surface News v2 inline with the cohort analysis. Renders gracefully when there are no articles today (status='no_articles_today') or no 30d baseline (status='no_baseline').","operationId":"narrative_pulse_for_symbol_api_v1_narrative_pulse__symbol__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cohort_introspect":{"post":{"tags":["Agent Intelligence"],"summary":"Slice a stored cohort by attributes — the agent-introspection primitive","description":"Given a cohort_id from a prior cohort_analyze or /cohort call, filter cohort members by ANY attribute (macro state, technicals, events, news, sector) and return per-subset stats with comparison to the full-cohort baseline. The agent-introspection primitive: lets an agent probe a cohort the way a quant analyst does without re-running the expensive KNN retrieval. Stateless — reads from the existing cohort_cache (6-hour TTL).","operationId":"cohort_introspect_endpoint_api_v1_cohort_introspect_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Body"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/market_briefing":{"get":{"tags":["Agent Intelligence"],"summary":"One-call market synthesis: regime + sectors + movers + setups + catalysts","description":"The synthesis surface. Combines macro regime, sector rotation, today's top movers, highest-cohort-score setups, and top narrative catalysts into a single structured payload. Built for agent prompts like 'what's going on in the market?' or 'find me interesting stocks today' that previously required chaining 4-5 atomic tools. All stats are templated server-side from the underlying primitives (context, bar_metadata, cohort_observations, news_articles); the caller renders the prose layer.","operationId":"market_briefing_api_v1_market_briefing_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"n_movers","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"N Movers"}},{"name":"n_setups","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"N Setups"}},{"name":"n_catalysts","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"N Catalysts"}},{"name":"horizon","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Horizon"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/narrative_alerts":{"get":{"tags":["Cohort"],"summary":"Realtime narrative anomalies — News v2 Phase 3","description":"Returns symbols with elevated intra-day narrative pulse (0.6 * news-count-anomaly + 0.4 * sentiment-tone-shift) computed from today's news_articles + sentiment + cached 30-day baseline from bar_news_features. Scored by the realtime FinBERT pass that runs every ~3 minutes; pulse refreshes whenever new articles land or get scored. Use this surface to catch catalyst-driven setups in real time — drill into the symbol with /cohort_analyze for the full intelligence stack.","operationId":"narrative_alerts_api_v1_narrative_alerts_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"min_pulse","in":"query","required":false,"schema":{"type":"number","default":0.3,"title":"Min Pulse"}},{"name":"min_articles_today","in":"query","required":false,"schema":{"type":"integer","default":2,"title":"Min Articles Today"}},{"name":"min_scored_today","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Min Scored Today"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cohort_track_record":{"get":{"tags":["Cohort"],"summary":"Layer 5 validation — does cohort_score actually predict?","description":"Aggregates cohort_observations with realized returns to answer: (1) does cohort_score correlate with realized 5d magnitude? (2) does the sign of the predicted median match realized direction? (3) per-score-quintile hit rate. The honesty layer for the intelligence stack — without this, all the surfacing is unproven storytelling.","operationId":"cohort_track_record_api_v1_cohort_track_record_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"horizon","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Horizon"}},{"name":"lookback_days","in":"query","required":false,"schema":{"type":"integer","default":365,"title":"Lookback Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/strategy_backtest":{"post":{"tags":["Cohort"],"summary":"Backtest a cohort-conditioned rule over historical observations","description":"Backtests a rule on the cohort signal against ~5 years of historical anchors (cohort_observations, 2021-2026). Conditions filter on the cohort stats available at decision time (median, win_rate, std, n, cohort_score, cohort_size); the rule's realized forward returns are aggregated vs the unconditional base rate. Equal-weight per signal, overlapping holds, no costs — an empirical edge check, not a live-P&L sim.","operationId":"strategy_backtest_api_v1_strategy_backtest_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StrategyBacktestRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/screener":{"get":{"tags":["Cohort"],"summary":"Outcome screener — rank the market by historical cohort outcomes","description":"Ranks symbols by what their CURRENT pattern's cohort did historically — median forward return, win rate, or expected move (cohort sigma, and vs the symbol's own baseline vol). Reads the daily scan (cohort_observations source='scan'). A discovery axis based on OUTCOMES, not indicators. sort = expected_move | median | win_rate | vol_ratio | cohort_score.","operationId":"screener_api_v1_screener_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"sort","in":"query","required":false,"schema":{"type":"string","default":"expected_move","title":"Sort"}},{"name":"horizon","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Horizon"}},{"name":"lookback_days","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Lookback Days"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"min_n","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Min N"}},{"name":"min_win_rate","in":"query","required":false,"schema":{"type":"number","default":0.0,"title":"Min Win Rate"}},{"name":"direction","in":"query","required":false,"schema":{"type":"string","default":"desc","title":"Direction"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/discover_picks":{"get":{"tags":["Cohort"],"summary":"Discover engine — anchors ranked by cohort_score","description":"Returns the top picks from the most recent nightly scan, ranked by cohort_score. Response surfaces `as_of_scan_date` so callers know the data freshness explicitly. A `warning` field flags stale scans (>48h old). The daily scripts/discover_scan.py job populates the underlying cohort_observations table; consumers see highest-conviction analyses without re-running cohort_analyze.","operationId":"discover_picks_api_v1_discover_picks_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}},{"name":"horizon","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Horizon"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v2/search":{"post":{"tags":["v2 Primitives"],"summary":"Primitive 1/6: entry point — returns cohort_id","description":"The v2 composable-primitives surface. `search` establishes a cohort\nhandle without computing distributions; downstream primitives (cohort,\nanalyze, explain) reference the cohort_id.","operationId":"v2_search_endpoint_api_v2_search_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2SearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v2/analyze":{"post":{"tags":["v2 Primitives"],"summary":"Primitive 3/6: metric-dispatched analytics on a cohort or symbol","description":"One endpoint, six metrics. Resolves anchor from cohort_id (preferred)\nor symbol+date, then dispatches to the corresponding v1 endpoint\nin-process via TestClient.","operationId":"v2_analyze_endpoint_api_v2_analyze_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2AnalyzeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v2/context":{"post":{"tags":["v2 Primitives"],"summary":"Primitive 4/6: situational data (regime / sector / ticker meta)","operationId":"v2_context_endpoint_api_v2_context_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2ContextRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v2/portfolio":{"post":{"tags":["v2 Primitives"],"summary":"Primitive 6/6: portfolio-level weighted distribution","operationId":"v2_portfolio_endpoint_api_v2_portfolio_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2PortfolioRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v2/explain":{"post":{"tags":["v2 Primitives"],"summary":"Primitive 5/6: narrative + filter-importance for a cohort","operationId":"v2_explain_endpoint_api_v2_explain_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2ExplainRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v2/cohort":{"post":{"tags":["v2 Primitives"],"summary":"Primitive 2/6: conditional distribution for a cohort","description":"Refine a stored cohort (cohort_id) or build a fresh one (query).\nReturns distribution percentiles, MAE/MFE/RV, survivorship, top_matches.","operationId":"v2_cohort_endpoint_api_v2_cohort_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/V2CohortRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portfolio/cohort":{"post":{"tags":["Cohort"],"summary":"Portfolio-level conditional distribution (weighted across holdings)","description":"Run a cohort for each holding in parallel and weight-average the\nreturn distributions by position weight. Returns the portfolio-level\npercentiles at each horizon plus a per-holding breakdown and a\nranked 'tail contributors' list.\n\nEvery call runs N cohorts (one per holding) so latency is roughly\nmax(per-holding cohort latency) since they run in a thread pool.\nTypical 10-holding portfolio: 2-4s total.","operationId":"portfolio_cohort_api_v1_portfolio_cohort_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortfolioCohortRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/og-image/cohort/{symbol}/{date}.png":{"get":{"tags":["Cohort"],"summary":"Dynamic OG card for a (symbol, date) — builds cohort on the fly","description":"Renders a 1200x630 Open Graph card for any (symbol, date). Runs a\nfresh cohort (top_k=300 for latency) and draws a hero card with:\nsymbol, date, 5d median return, p10-p90 range, sample size, and a\nframed fan chart. Cache-Control 1hr so social scrapers don't hammer.\n\nNo auth required — public OG endpoint. Rate-limiter applies normally.","operationId":"cohort_og_image_api_v1_og_image_cohort__symbol___date__png_get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}},{"name":"date","in":"path","required":true,"schema":{"type":"string","title":"Date"}},{"name":"timeframe","in":"query","required":false,"schema":{"type":"string","default":"rth","title":"Timeframe"}}],"responses":{"200":{"description":"Successful Response","content":{"image/png":{}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cohort/{cohort_id}/fan-chart.png":{"get":{"tags":["Cohort"],"summary":"Rendered fan-chart PNG for a stored cohort — shareable asset","description":"Return a PNG fan chart for the cohort — median + p25/p75 + p10/p90\nbands across horizons. Uses the stored cohort (no kNN re-run).\nSuitable for embedding in blog posts, social cards, and OG images.","operationId":"cohort_fan_chart_api_v1_cohort__cohort_id__fan_chart_png_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string","title":"Cohort Id"}}],"responses":{"200":{"description":"Successful Response","content":{"image/png":{}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cohort/{cohort_id}/explain":{"get":{"tags":["Cohort"],"summary":"Discover which filter moves the distribution most for a stored cohort","description":"Runs a small set of candidate filters against the stored cohort and\nranks them by absolute shift in above_entry hit rate at the given horizon.\n\nLets agents (and users) discover conditional structure: which dimension\nactually matters for *this* setup in *this* regime. The edge-mining loop.","operationId":"cohort_explain_api_v1_cohort__cohort_id__explain_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string","title":"Cohort Id"}},{"name":"horizon","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Horizon"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortExplainResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cohort/{cohort_id}/members":{"get":{"tags":["Cohort"],"summary":"Return the full cohort, one record per analog, for customer-side bucketing/reranking","description":"The customer-objective-layer handover: hand back every historical analog\nin the cohort with rich per-member metadata, so the caller can bucket,\nfilter, or rerank by whatever they care about (vol, sector, regime, event,\noutcome). We never collapse to a single number here — that's the point.\n\nThe cohort_id comes from a prior /cohort or /cohort_analyze call (6h TTL).","operationId":"cohort_members_endpoint_api_v1_cohort__cohort_id__members_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string","title":"Cohort Id"}},{"name":"fields","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated metadata groups to attach. 'all' for every group. Default: outcomes,regime. Valid: outcomes, regime, anchor_meta, news, chart_events.","title":"Fields"},"description":"Comma-separated metadata groups to attach. 'all' for every group. Default: outcomes,regime. Valid: outcomes, regime, anchor_meta, news, chart_events."},{"name":"sort_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Member key to sort by; members missing it sort last.","title":"Sort By"},"description":"Member key to sort by; members missing it sort last."},{"name":"sort_desc","in":"query","required":false,"schema":{"type":"boolean","description":"Sort descending instead of ascending.","default":false,"title":"Sort Desc"},"description":"Sort descending instead of ascending."},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":2000,"minimum":1},{"type":"null"}],"description":"Page size (omit for all).","title":"Limit"},"description":"Page size (omit for all)."},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Page offset over the sorted members.","default":0,"title":"Offset"},"description":"Page offset over the sorted members."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cohort/{cohort_id}/groupby":{"get":{"tags":["Cohort"],"summary":"Partition a stored cohort by a member dimension; per-group outcome distributions vs baseline","description":"Hand back the cohort split into buckets along one dimension, each with its\nown forward-return distribution plus the whole-cohort baseline. The customer\npicks the dimension; we never pick the slice. Descriptive history, not a call.\n\nThe cohort_id comes from a prior /cohort or /cohort_analyze call (6h TTL).","operationId":"cohort_groupby_endpoint_api_v1_cohort__cohort_id__groupby_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string","title":"Cohort Id"}},{"name":"by","in":"query","required":true,"schema":{"type":"string","description":"Member dimension to group by. Categorical (vol_regime, sector_etf, has_news, broke_50d_high/low, broke_ath) group by value; numeric (distance, relative_volume, realized_vol_20d, momentum_5d/20d/60d, pct_off_ath, vix, ctx_vix_level, ctx_spy_trend_20d, sector_rs_60d, market_rs_60d, days_since/to_earnings) split into quantile buckets.","title":"By"},"description":"Member dimension to group by. Categorical (vol_regime, sector_etf, has_news, broke_50d_high/low, broke_ath) group by value; numeric (distance, relative_volume, realized_vol_20d, momentum_5d/20d/60d, pct_off_ath, vix, ctx_vix_level, ctx_spy_trend_20d, sector_rs_60d, market_rs_60d, days_since/to_earnings) split into quantile buckets."},{"name":"horizons","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated forward horizons (subset of 1,5,10). Default all three.","title":"Horizons"},"description":"Comma-separated forward horizons (subset of 1,5,10). Default all three."},{"name":"buckets","in":"query","required":false,"schema":{"type":"integer","maximum":10,"minimum":2,"description":"Quantile buckets for numeric keys.","default":4,"title":"Buckets"},"description":"Quantile buckets for numeric keys."},{"name":"min_group","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Groups smaller than this come back without stats.","default":3,"title":"Min Group"},"description":"Groups smaller than this come back without stats."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cohort/{cohort_id}/rerank":{"get":{"tags":["Cohort"],"summary":"Reorder a stored cohort by a weighted composite of member fields (the caller's objective)","description":"Reorder the cohort's historical analogs by the caller's own relevance\nfunction — a weighted blend of numeric member fields — instead of our L2\ndistance. Single-field ordering is already on /members (sort_by); this is the\nmulti-field expression form. Each member comes back with rerank_score and the\nper-field contributions, so the ranking is fully auditable.\n\nThe cohort_id comes from a prior /cohort or /cohort_analyze call (6h TTL).","operationId":"cohort_rerank_endpoint_api_v1_cohort__cohort_id__rerank_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string","title":"Cohort Id"}},{"name":"by","in":"query","required":true,"schema":{"type":"string","description":"Weighted composite as a comma list of field[:weight]; weight defaults to 1.0 and its sign sets direction. Each field is standardized within the cohort (z-score) before blending. Example: 'ret_5d:1.0,distance:-0.5,momentum_20d:0.3' ranks high 5-day-return, nearer, up-momentum analogs first. Numeric member fields only (ret_1d/5d/10d, mae/mfe_5d/10d, distance, vix, ctx_vix_level, ctx_spy_trend_20d, relative_volume, realized_vol_20d, momentum_5d/20d/60d, pct_off_ath, sector_rs_60d, market_rs_60d, days_since/to_earnings).","title":"By"},"description":"Weighted composite as a comma list of field[:weight]; weight defaults to 1.0 and its sign sets direction. Each field is standardized within the cohort (z-score) before blending. Example: 'ret_5d:1.0,distance:-0.5,momentum_20d:0.3' ranks high 5-day-return, nearer, up-momentum analogs first. Numeric member fields only (ret_1d/5d/10d, mae/mfe_5d/10d, distance, vix, ctx_vix_level, ctx_spy_trend_20d, relative_volume, realized_vol_20d, momentum_5d/20d/60d, pct_off_ath, sector_rs_60d, market_rs_60d, days_since/to_earnings)."},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":2000,"minimum":1},{"type":"null"}],"description":"Page size (omit for all).","title":"Limit"},"description":"Page size (omit for all)."},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Page offset over the reranked members.","default":0,"title":"Offset"},"description":"Page offset over the reranked members."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/calibration":{"get":{"tags":["Calibration"],"summary":"Track record — historical predicted-vs-realized coverage of our calibrated bands","description":"The READ companion to the calibration that cohort_analyze APPLIES. Reports, in past tense, how often the realized return actually fell inside our nominal band across prior cohort analyses — globally and sliced by vol_regime and/or tightness. Serves the nightly precomputed calibration map (no per-request DB work). Audited past outcomes, never a forward claim.","operationId":"track_record_endpoint_api_v1_calibration_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"vol_regime","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"high | mid | low | unknown","title":"Vol Regime"},"description":"high | mid | low | unknown"},{"name":"tightness","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"1_loose | 2_mid | 3_firm | 4_tight","title":"Tightness"},"description":"1_loose | 2_mid | 3_firm | 4_tight"},{"name":"horizon","in":"query","required":false,"schema":{"type":"string","description":"Return horizon; only 5d is computed today","default":"5d","title":"Horizon"},"description":"Return horizon; only 5d is computed today"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cohort/live":{"post":{"tags":["Cohort"],"summary":"Encode a live chart window and find similar historical patterns","description":"Accept raw OHLCV bars, encode with the V5 intraday encoder, kNN\nagainst bar_embeddings_v5, return top matches. This is the endpoint\nthat powers drag-select chart search: the user highlights N bars on\ntheir chart, the client sends the OHLCV, we return the closest\nhistorical setups.\n\nUnlike /cohort which needs a (symbol, date) anchor present in our\nDB, this works for any live data — even symbols / dates we've never\nembedded. The encoder runs server-side (~2ms on CPU for 384 bars)\nso total latency is dominated by the pgvector kNN (~1-2ms).","operationId":"cohort_live_endpoint_api_v1_cohort_live_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__CohortLiveRequest__2"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/cohort/{cohort_id}/decompose":{"get":{"tags":["Cohort"],"summary":"Decompose a cohort into ranked slice conditions that differentiate forward returns","description":"Given a stored cohort_id, automatically discover slice conditions\n(volume regime, trend state, sector, intraday behavior, catalyst\nproximity, etc.) that partition the cohort's forward returns into\nstatistically different distributions.\n\nReturns ranked conditions with (n matches, slice median, delta vs\ncohort baseline, 95% CI, stat-sig flag, hit-rate, above-5pct rate).\nThis is the \"what differentiated the winners from the losers\"\nprimitive SMB/prop traders externalize mentally — we do it at\n500-match scale with bootstrap CIs.","operationId":"cohort_decompose_endpoint_api_v1_cohort__cohort_id__decompose_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string","title":"Cohort Id"}},{"name":"horizon","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Horizon"}},{"name":"max_slices","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Max Slices"}},{"name":"min_n","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Min N"}},{"name":"explain","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Explain"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cohort/{cohort_id}/clusters":{"get":{"tags":["Cohort"],"summary":"K-means cluster a cohort's matches by how they resolved (forward-day intraday behavior)","description":"Given a stored cohort, cluster its matches by the intraday\nbehavior of the first FORWARD trading day (i.e. \"how did the setup\nresolve\"). K auto-chosen via silhouette unless overridden.\n\nReturns per-cluster: (n, label, centroid features, forward-return\ndistribution, representative matches). Complements /decompose which\nslices by input conditions — clusters slice by output behavior.","operationId":"cohort_clusters_endpoint_api_v1_cohort__cohort_id__clusters_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string","title":"Cohort Id"}},{"name":"horizon","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Horizon"}},{"name":"k","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"K"}},{"name":"min_cluster_size","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Min Cluster Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/summary":{"post":{"tags":["Follow-Through"],"summary":"Summary","description":"Generate a Claude Haiku plain English summary of pattern analysis.\n\nPro users and API key users get unlimited summaries.\nFree/anonymous users get 3 per day.","operationId":"summary_api_v1_summary_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SummaryRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SummaryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/simulate":{"post":{"tags":["Follow-Through"],"summary":"Simulate","description":"Run 'What If' scenario simulation with stop loss / profit target (Pro only).","operationId":"simulate_api_v1_simulate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimulateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/events/{symbol}/{date}":{"get":{"tags":["Follow-Through"],"summary":"Events","description":"Get event context badges (FOMC, earnings gap) for a symbol + date.","operationId":"events_api_v1_events__symbol___date__get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}},{"name":"date","in":"path","required":true,"schema":{"type":"string","title":"Date"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EventBadge"},"title":"Response Events Api V1 Events  Symbol   Date  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/share-card":{"post":{"tags":["Follow-Through"],"summary":"Share Card","description":"Generate a shareable 1200x630 PNG card for social sharing (Pro only).","operationId":"share_card_api_v1_share_card_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareCardRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/search/batch":{"post":{"tags":["Search"],"summary":"Search Batch","description":"Batch search: find similar patterns for multiple symbols at once (Pro only).","operationId":"search_batch_api_v1_search_batch_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchSearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchSearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/export/csv":{"post":{"tags":["Search"],"summary":"Export Csv","description":"Export search results with forward returns as a CSV file download (Pro only).","operationId":"export_csv_api_v1_export_csv_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CsvExportRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/search/stats":{"post":{"tags":["Follow-Through"],"summary":"Search Stats","description":"Compute detailed statistics (mean, median, win rate) for horizon returns.","operationId":"search_stats_api_v1_search_stats_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/oauth/authorize/details":{"get":{"tags":["OAuth"],"summary":"Oauth Authorize Details","description":"Public details endpoint for the consent UI. Returns the client's\ndisplay name + scope description for the consent screen.","operationId":"oauth_authorize_details_api_v1_oauth_authorize_details_get","parameters":[{"name":"client_id","in":"query","required":true,"schema":{"type":"string","title":"Client Id"}},{"name":"redirect_uri","in":"query","required":true,"schema":{"type":"string","title":"Redirect Uri"}},{"name":"scope","in":"query","required":false,"schema":{"type":"string","default":"read","title":"Scope"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/oauth/authorize/grant":{"post":{"tags":["OAuth"],"summary":"Oauth Authorize Grant","description":"User clicked Allow on the consent screen. Mint an authorization\ncode bound to (client_id, redirect_uri, code_challenge, user_id).\n\nAuthenticated via the user's JWT (Authorization: Bearer <jwt>) — the\nconsent page passes the user's normal app session through.","operationId":"oauth_authorize_grant_api_v1_oauth_authorize_grant_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_oauth_authorize_grant_api_v1_oauth_authorize_grant_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/status":{"get":{"tags":["Status"],"summary":"Get Api Status","description":"Get embedding pipeline stats — total embeddings, coverage, date range (cached 60s).","operationId":"get_api_status_api_v1_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}}}}},"/api/v1/health":{"get":{"tags":["Status"],"summary":"Get Health","description":"System health check.\n\nUnauthenticated: returns {\"status\": \"ok\"|\"degraded\"|\"unhealthy\"}.\nAuthenticated admin: returns full diagnostic details (HealthCheck model).","operationId":"get_health_api_v1_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/version":{"get":{"tags":["Status"],"summary":"Get Version","description":"Build + version info. Public, unauthenticated.\n\nAgent-dev audit flagged this as an integration blocker — callers\nneed to detect contract drift across deploys without waiting for\na user-visible regression. Returns the git SHA we're serving, the\ndeploy timestamp, and the canonical api_version string that\nappears in every /cohort compliance envelope.","operationId":"get_version_api_v1_version_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/metrics":{"get":{"tags":["Status"],"summary":"Get Metrics","description":"Internal ops metrics. Admin-only (same ADMIN_EMAILS gate as /health\ndetails). Returns cache sizes, freshness, and backfill progress —\nfoundation for a Grafana dashboard.\n\nIntentionally cheap: just COUNT + MAX/MIN on small tables. Run under\n100ms warm. No kNN, no Haiku.","operationId":"get_metrics_api_v1_metrics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/discover/picks":{"get":{"tags":["Discover"],"summary":"Get Daily Picks","description":"Get top daily picks ranked by interest score. No auth required.\n\nReturns the most interesting chart patterns from the automated nightly scan,\nranked by confidence and pattern interest score.\n\nField semantics:\n  - `n_matches` is the TOP-K sample (default K=10) used for the nightly\n    weighted prediction, NOT the full cohort. The full cohort (default\n    n=300) is accessible via POST /api/v1/cohort_analyze with this\n    anchor, or pre-enriched in GET /api/v1/agent/setups.\n  - `cohort_compatible` is True when the anchor exists in V5 embeddings.\n    Picks are now filtered to V5-covered symbols (since 2026-05-04) so\n    this is always true; the field stays for forward compatibility if a\n    future relaxation re-introduces non-V5 picks.","operationId":"get_daily_picks_api_v1_discover_picks_get","parameters":[{"name":"date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Date (YYYY-MM-DD). Defaults to latest available.","title":"Date"},"description":"Date (YYYY-MM-DD). Defaults to latest available."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"description":"Max picks to return","default":20,"title":"Limit"},"description":"Max picks to return"},{"name":"include_full_cohort","in":"query","required":false,"schema":{"type":"boolean","description":"When true, each pick is enriched with full-cohort (n=300) outcome distribution via parallel cohort_analyze, and picks are re-ranked by cohort_score (instead of K=10 interest_score). Cold response ~30-60s the first call; cached 23h. Pre-warmed at API startup. Use this for the calibrated picks experience.","default":false,"title":"Include Full Cohort"},"description":"When true, each pick is enriched with full-cohort (n=300) outcome distribution via parallel cohort_analyze, and picks are re-ranked by cohort_score (instead of K=10 interest_score). Cold response ~30-60s the first call; cached 23h. Pre-warmed at API startup. Use this for the calibrated picks experience."},{"name":"timeframe","in":"query","required":false,"schema":{"type":"string","description":"V5 timeframe used for cohort_analyze when include_full_cohort=true.","default":"1d","title":"Timeframe"},"description":"V5 timeframe used for cohort_analyze when include_full_cohort=true."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DailyPicksResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/predictions/log":{"get":{"tags":["Track Record"],"summary":"Prediction Log","description":"Chronological log of every forward-test prediction we've made + its actual outcome.\n\nTransparency tool: no cherry-picking, no 'best calls' filter. Returns the raw\nstream of predictions ordered by date descending. Useful for auditing the\nsystem's actual performance in real time.","operationId":"prediction_log_api_v1_predictions_log_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"description":"Max entries to return","default":50,"title":"Limit"},"description":"Max entries to return"},{"name":"horizon","in":"query","required":false,"schema":{"type":"integer","description":"Forward horizon (1, 3, 5, or 10)","default":5,"title":"Horizon"},"description":"Forward horizon (1, 3, 5, or 10)"},{"name":"only_with_actuals","in":"query","required":false,"schema":{"type":"boolean","description":"Only return predictions we've scored","default":false,"title":"Only With Actuals"},"description":"Only return predictions we've scored"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/discover/best-calls":{"get":{"tags":["Discover"],"summary":"Get Best Calls","description":"Get recent best calls — predictions closest to actuals. No auth required.\n\nReturns forward test rows where actual_1d is available, wpred_1d had a meaningful\nsignal (|wpred_1d| >= 1.0), ordered by smallest absolute error.","operationId":"get_best_calls_api_v1_discover_best_calls_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":20,"minimum":1,"description":"Max best calls to return","default":5,"title":"Limit"},"description":"Max best calls to return"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BestCallsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/discover/recent-recap":{"get":{"tags":["Discover"],"summary":"Get Recent Recap","description":"Aggregated recap of the most recent picks day with realized actuals.\n\nFinds the latest test_date with actual_1d available (typically yesterday\nor the prior trading day on weekends/holidays), runs the same liquidity\nand quality filter as /discover/picks, takes the top 20 by interest_score,\nand returns headline stats: count, average realized 1d return, directional\naccuracy, best and worst picks.","operationId":"get_recent_recap_api_v1_discover_recent_recap_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecentRecapResponse"}}}}}}},"/api/v1/blog/daily":{"get":{"tags":["Blog"],"summary":"List Daily Blog Posts","description":"List recent daily blog posts (Layer 2 of the content factory).","operationId":"list_daily_blog_posts_api_v1_blog_daily_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DailyBlogPostList"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/blog/daily/by-date/{post_date}":{"get":{"tags":["Blog"],"summary":"Get Daily Blog Post","description":"Fetch a single daily blog post by date (YYYY-MM-DD).","operationId":"get_daily_blog_post_api_v1_blog_daily_by_date__post_date__get","parameters":[{"name":"post_date","in":"path","required":true,"schema":{"type":"string","title":"Post Date"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/DailyBlogPost"},{"type":"null"}],"title":"Response Get Daily Blog Post Api V1 Blog Daily By Date  Post Date  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/blog/daily/by-symbol/{symbol}":{"get":{"tags":["Blog"],"summary":"Get Latest Daily Post By Symbol","description":"Most recent daily post where this symbol was the hero (Layer 4 of\nthe content factory). Used by /patterns/{symbol} to render a daily\nbrief block when the symbol was featured.","operationId":"get_latest_daily_post_by_symbol_api_v1_blog_daily_by_symbol__symbol__get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/DailyBlogPost"},{"type":"null"}],"title":"Response Get Latest Daily Post By Symbol Api V1 Blog Daily By Symbol  Symbol  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/agent-trader/summary":{"get":{"tags":["Agent Trader"],"summary":"Agent Trader Summary","description":"Headline numbers for the public Cohort-Aware Trader dashboard.\n\nMethodology-honest disclaimer: first ~60 trades are noise, period.\nReturns are paper-trading (no broker, no slippage modeled).","operationId":"agent_trader_summary_api_v1_agent_trader_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentTraderSummary"}}}}}}},"/api/v1/agent-trader/track-record":{"get":{"tags":["Agent Trader"],"summary":"Agent Trader Track Record","description":"All trades (open + closed) most-recent first. Reasoning visible.\nBoth wins and losses surface — published track record.","operationId":"agent_trader_track_record_api_v1_agent_trader_track_record_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AgentTraderTrade"},"title":"Response Agent Trader Track Record Api V1 Agent Trader Track Record Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/agent-trader/lessons":{"get":{"tags":["Agent Trader"],"summary":"Agent Trader Lessons","description":"The agent's accumulated lessons, most recent first.\nTransparency surface — every lesson the agent reads as memory is public.","operationId":"agent_trader_lessons_api_v1_agent_trader_lessons_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AgentTraderLesson"},"title":"Response Agent Trader Lessons Api V1 Agent Trader Lessons Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/agent-trader/equity-curve":{"get":{"tags":["Agent Trader"],"summary":"Agent Trader Equity Curve","description":"Daily equity points after each scoring event, paired with a\nSPY-benchmark equity that started at the same $10K bankroll.\nDrives the equity-curve chart on /agent-trader.","operationId":"agent_trader_equity_curve_api_v1_agent_trader_equity_curve_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/AgentTraderEquityPoint"},"type":"array","title":"Response Agent Trader Equity Curve Api V1 Agent Trader Equity Curve Get"}}}}}}},"/api/v1/agent/chat":{"post":{"tags":["Agent Chat"],"summary":"Agent Chat Endpoint","description":"Anthropic tool-use loop wired to Chart Library's canonical MCP tools.\n\nLogged-in users only. Free tier is capped per day (each message is a paid\nClaude call with up to 10 tool iterations — cost control); Pro/trialing\nusers are unlimited. Returns the final assistant text + tool trace + log.","operationId":"agent_chat_endpoint_api_v1_agent_chat_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentChatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentChatResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/agent/setups":{"get":{"tags":["Agent"],"summary":"Top picks pre-enriched with cohort + features + yesterday's recap","description":"Single-call agent endpoint. Returns the top-K picks from the most recent nightly scan, each enriched with full-cohort statistics (default n=300), top-3 most-discriminative features, and yesterday's calibration recap. Replaces the typical multi-call discovery dance (picks → recap → cohort_analyze × N).\n\nPicks are V5-coverage-filtered, so every cohort lookup succeeds. Cached 4h per (top, timeframe) tuple. Cold call latency ~5-10s; warm call latency <50ms.\n\n**Trimming the response**: pass `?fields=setups` (or any subset of `setups,yesterday_recap`) to drop the keys you don't need. `as_of_date` and `cohort_timeframe` are always returned. Use this when you only need the picks and not yesterday's recap.","operationId":"get_agent_setups_api_v1_agent_setups_get","parameters":[{"name":"top","in":"query","required":false,"schema":{"type":"integer","maximum":10,"minimum":1,"description":"Number of top setups to return.","default":3,"title":"Top"},"description":"Number of top setups to return."},{"name":"timeframe","in":"query","required":false,"schema":{"type":"string","description":"V5 timeframe for cohort analysis. One of 5m, 15m, 30m, 1h, 1d. Default 1d matches the daily forward_test pipeline.","default":"1d","title":"Timeframe"},"description":"V5 timeframe for cohort analysis. One of 5m, 15m, 30m, 1h, 1d. Default 1d matches the daily forward_test pipeline."},{"name":"fields","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Optional comma-separated allowlist of top-level response keys to return. Valid values: setups, yesterday_recap. When omitted, the full payload is returned. `as_of_date` and `cohort_timeframe` are always returned regardless.","title":"Fields"},"description":"Optional comma-separated allowlist of top-level response keys to return. Valid values: setups, yesterday_recap. When omitted, the full payload is returned. `as_of_date` and `cohort_timeframe` are always returned regardless."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSetupsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/regime-tracker":{"get":{"tags":["Regime Tracker"],"summary":"Get Regime Tracker","description":"Get the latest regime similarity analysis for SPY or QQQ.\n\nCompares the most recent 30-trading-day window (using 2-hour bars)\nagainst all historical windows via L2 distance. Returns the top 10\nclosest deduplicated historical matches with follow-through returns.","operationId":"get_regime_tracker_api_v1_regime_tracker_get","parameters":[{"name":"symbol","in":"query","required":false,"schema":{"type":"string","description":"Symbol to analyze (SPY or QQQ)","default":"SPY","title":"Symbol"},"description":"Symbol to analyze (SPY or QQQ)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegimeTrackerResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/regime-tracker/sectors":{"get":{"tags":["Regime Tracker"],"summary":"Get Sector Regimes","description":"Get regime summary for all sector ETFs (heatmap data).","operationId":"get_sector_regimes_api_v1_regime_tracker_sectors_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/intelligence/{symbol}":{"get":{"tags":["Agent Intelligence"],"summary":"Get Intelligence","description":"One-call endpoint for AI agents: pattern matches + regime + forward returns + summary.\n\nReturns everything an agent needs to understand a symbol's current chart pattern\nin a single request. Designed for AI agent consumption.","operationId":"get_intelligence_api_v1_intelligence__symbol__get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}},{"name":"date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Date (YYYY-MM-DD). Defaults to most recent trading day.","title":"Date"},"description":"Date (YYYY-MM-DD). Defaults to most recent trading day."},{"name":"compact","in":"query","required":false,"schema":{"type":"boolean","description":"Compact mode: omit large arrays (pct_series, paths)","default":false,"title":"Compact"},"description":"Compact mode: omit large arrays (pct_series, paths)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntelligenceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/regime/current":{"get":{"tags":["Agent Intelligence"],"summary":"Get Regime Current","description":"Market-wide regime snapshot: SPY + QQQ + all sectors in one response.\n\nDesigned for AI agents that need a quick market overview.","operationId":"get_regime_current_api_v1_regime_current_get","parameters":[{"name":"compact","in":"query","required":false,"schema":{"type":"boolean","description":"Compact mode: shorter summaries","default":false,"title":"Compact"},"description":"Compact mode: shorter summaries"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/regime-win-rates":{"get":{"tags":["Agent Intelligence"],"summary":"Regime Win Rates Endpoint","description":"Pattern win rates filtered by current market regime.\n\nShows how bullish/bearish signals perform in different VIX/trend regimes\nand highlights which regime we're in now.","operationId":"regime_win_rates_endpoint_api_v1_regime_win_rates_get","parameters":[{"name":"symbol","in":"query","required":true,"schema":{"type":"string","description":"Ticker symbol (e.g. NVDA)","title":"Symbol"},"description":"Ticker symbol (e.g. NVDA)"},{"name":"date","in":"query","required":false,"schema":{"type":"string","description":"Date in YYYY-MM-DD (defaults to most recent)","default":"","title":"Date"},"description":"Date in YYYY-MM-DD (defaults to most recent)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/exit-signal":{"get":{"tags":["Agent Intelligence"],"summary":"Exit Signal Endpoint","description":"Pattern-based exit recommendations for open positions.\n\nUses historical forward test data and drawdown analysis to recommend\nhold, take_profit, cut_loss, or exit.","operationId":"exit_signal_endpoint_api_v1_exit_signal_get","parameters":[{"name":"symbol","in":"query","required":true,"schema":{"type":"string","description":"Ticker symbol you're holding","title":"Symbol"},"description":"Ticker symbol you're holding"},{"name":"entry_date","in":"query","required":true,"schema":{"type":"string","description":"Date you entered the trade (YYYY-MM-DD)","title":"Entry Date"},"description":"Date you entered the trade (YYYY-MM-DD)"},{"name":"side","in":"query","required":false,"schema":{"type":"string","description":"'long' or 'short'","default":"long","title":"Side"},"description":"'long' or 'short'"},{"name":"days_held","in":"query","required":false,"schema":{"type":"integer","description":"How many trading days held so far","default":0,"title":"Days Held"},"description":"How many trading days held so far"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/pattern-degradation":{"get":{"tags":["Agent Intelligence"],"summary":"Pattern Degradation Endpoint","description":"Are pattern signals getting weaker recently?\n\nCompares recent accuracy vs historical baseline for bullish and bearish signals.","operationId":"pattern_degradation_endpoint_api_v1_pattern_degradation_get","parameters":[{"name":"symbol","in":"query","required":false,"schema":{"type":"string","description":"Ticker symbol (empty = all symbols)","default":"","title":"Symbol"},"description":"Ticker symbol (empty = all symbols)"},{"name":"lookback_days","in":"query","required":false,"schema":{"type":"integer","description":"Recent days to compare against history","default":30,"title":"Lookback Days"},"description":"Recent days to compare against history"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/risk-adjusted-picks":{"get":{"tags":["Agent Intelligence"],"summary":"Risk Adjusted Picks Endpoint","description":"Today's strongest risk/reward setups — LONG or SHORT — scored by the\nmagnitude of the expected move relative to its range.\n\nRanked by |predicted_5d| / range, so a strong DOWN setup ranks alongside a\nstrong UP setup; read each pick's `side` (long/short) for direction. The\nscore (and setup_strength tier) measures risk/reward ratio strength, NOT\nthe probability a name rises. These are historical-analog distributions,\nnot forecasts. Filters out leveraged ETFs, micro-caps (<$100M), and\nilliquid names so the setups are ones agents can reason about for real\nportfolios.","operationId":"risk_adjusted_picks_endpoint_api_v1_risk_adjusted_picks_get","parameters":[{"name":"date","in":"query","required":false,"schema":{"type":"string","description":"Date (YYYY-MM-DD, defaults to most recent)","default":"","title":"Date"},"description":"Date (YYYY-MM-DD, defaults to most recent)"},{"name":"min_sharpe","in":"query","required":false,"schema":{"type":"number","description":"Minimum risk-adjusted score","default":0.3,"title":"Min Sharpe"},"description":"Minimum risk-adjusted score"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/macro-calendar":{"get":{"tags":["Agent Intelligence"],"summary":"Macro Calendar","description":"Upcoming macro events (FOMC, CPI, NFP) + earnings for mega-caps.\n\nUses our earnings_calendar table (populated from SEC EDGAR for 2000+\nUS-listed companies) and a static FOMC schedule. For a morning briefing,\nan agent can call this once to know what's coming this week.","operationId":"macro_calendar_api_v1_macro_calendar_get","parameters":[{"name":"days_ahead","in":"query","required":false,"schema":{"type":"integer","maximum":60,"minimum":1,"description":"How many days forward to look","default":14,"title":"Days Ahead"},"description":"How many days forward to look"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/market-context":{"get":{"tags":["Agent Intelligence"],"summary":"Get Market Context","description":"One-call market awareness for AI agents.\n\nReturns current SPY/QQQ/VIX prices, regime label, sector rotation,\nand upcoming economic/earnings events. Designed to give an agent\ninstant market context without multiple API calls.","operationId":"get_market_context_api_v1_market_context_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/portfolio/analyze":{"post":{"tags":["Agent Intelligence"],"summary":"Portfolio Analyze","description":"One-call portfolio health check for AI agents.\n\nAccepts a list of symbols and returns a condensed per-position summary\nplus portfolio-level risk flags. Designed for agents monitoring portfolios.","operationId":"portfolio_analyze_api_v1_portfolio_analyze_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortfolioAnalysisRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/feedback":{"post":{"tags":["Agent Intelligence"],"summary":"Submit Feedback","description":"Submit feedback from an AI agent or developer.\n\nUse this to report errors, unexpected results, or suggestions.","operationId":"submit_feedback_api_v1_feedback_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FeedbackRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/resend":{"post":{"tags":["Webhooks"],"summary":"Resend Webhook Handler","description":"Persist Resend webhook events to email_events for engagement tracking.","operationId":"resend_webhook_handler_api_v1_webhooks_resend_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/outreach/auto_post/{action}":{"get":{"tags":["Agent Intelligence"],"summary":"Outreach Auto Post Toggle","description":"Mobile-friendly global kill switch for the outreach auto-post pipeline.\n\n`action` must be one of: pause | resume | status\n\nDesigned to be a one-tap link from any email Graham sees. Auto-post\nrunner reads `outreach_config.auto_post_enabled` on every cycle, so\nflipping this here instantly stops/starts the next 10-min cron fire.\n\nPer the mobile-first design (see feedback_mobile_first.md): this MUST\nwork from a phone tap. No auth required because the URL itself is\nnot guessable enough to require it AND the worst case (someone flips\nGraham's flag) is \"outreach pauses briefly\" which is recoverable in\none click. Treat as soft-secret operational endpoint.","operationId":"outreach_auto_post_toggle_api_v1_outreach_auto_post__action__get","parameters":[{"name":"action","in":"path","required":true,"schema":{"type":"string","title":"Action"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/outreach/mark/{lead_id}":{"get":{"tags":["Agent Intelligence"],"summary":"Mark Outreach Lead","description":"One-tap closure from the daily outreach-discovery email — Graham\nclicks the link in his inbox to record whether he actually posted the\ndrafted reply for a given lead. The lead_id is a UUID set at INSERT\ntime; the UUID itself acts as a capability token (unguessable).\n\nReturns a small HTML confirmation page so the click feels resolved.","operationId":"mark_outreach_lead_api_v1_outreach_mark__lead_id__get","parameters":[{"name":"lead_id","in":"path","required":true,"schema":{"type":"string","title":"Lead Id"}},{"name":"action","in":"query","required":false,"schema":{"type":"string","pattern":"^(posted|skipped)$","default":"posted","title":"Action"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/feedback/cohort_modes":{"post":{"tags":["Agent Intelligence"],"summary":"Submit Cohort Modes Feedback","description":"One-tap feedback from the CohortModesCard thumbs widget.\n\nRecorded to `feedback_cohort_modes`. No PII — IPs are hashed, no body\ntext. Used to gauge whether the outcome-mode playbook surface lands\nwith users for the 2026-05/06 user-focus sprint.","operationId":"submit_cohort_modes_feedback_api_v1_feedback_cohort_modes_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortModesFeedbackRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patterns/save":{"post":{"tags":["Saved Patterns"],"summary":"Save Pattern Endpoint","description":"Save a pattern search to the library (requires authentication).","operationId":"save_pattern_endpoint_api_v1_patterns_save_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavePatternRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/patterns":{"get":{"tags":["Saved Patterns"],"summary":"List Patterns","description":"List saved patterns for the authenticated user (newest first).","operationId":"list_patterns_api_v1_patterns_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patterns/{pattern_id}":{"delete":{"tags":["Saved Patterns"],"summary":"Delete Pattern Endpoint","description":"Delete a saved pattern (verifies ownership).","operationId":"delete_pattern_endpoint_api_v1_patterns__pattern_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"pattern_id","in":"path","required":true,"schema":{"type":"integer","title":"Pattern Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/alerts":{"get":{"tags":["Alerts"],"summary":"List Alerts","description":"List all active pattern alerts for the authenticated user.","operationId":"list_alerts_api_v1_alerts_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["Alerts"],"summary":"Create Alert","description":"Create a pattern alert — get notified when similar patterns appear (Pro unlimited, free up to 2).","operationId":"create_alert_api_v1_alerts_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertCreateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/alerts/{alert_id}":{"delete":{"tags":["Alerts"],"summary":"Delete Alert","description":"Delete a pattern alert. This is irreversible.","operationId":"delete_alert_api_v1_alerts__alert_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"alert_id","in":"path","required":true,"schema":{"type":"integer","title":"Alert Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/alerts/{alert_id}/events":{"get":{"tags":["Alerts"],"summary":"List Alert Events","description":"List triggered events for a pattern alert — matched symbols, dates, and distances.","operationId":"list_alert_events_api_v1_alerts__alert_id__events_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"alert_id","in":"path","required":true,"schema":{"type":"integer","title":"Alert Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/signup":{"post":{"tags":["Auth"],"summary":"Auth Signup","description":"Create a new user account. Returns JWT tokens on success.","operationId":"auth_signup_api_v1_auth_signup_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignupRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/verify":{"get":{"tags":["Auth"],"summary":"Auth Verify Email","description":"Verify a user's email address using the token from the verification email.\n\nOn success, issues a fresh access + refresh token pair so the user lands\non /app already authenticated — eliminates the verify→login second-hop\nfriction that was the top activation funnel leak per the 2026-05-17 audit\n(F1).\n\nSafe because verify_email() clears the verification_token on first\nsuccessful use; a re-click of an old email link returns None → 400.","operationId":"auth_verify_email_api_v1_auth_verify_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/login":{"post":{"tags":["Auth"],"summary":"Auth Login","description":"Log in with email + password. Returns JWT access and refresh tokens.\n\nPer-IP rate limited at 8 attempts / 15-minute window to make\nbrute-force attacks impractical against the bcrypt pipeline.","operationId":"auth_login_api_v1_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/me":{"get":{"tags":["Auth"],"summary":"Auth Me","description":"Get current authenticated user info (profile, subscription status, credits).","operationId":"auth_me_api_v1_auth_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/auth/resend-verification":{"post":{"tags":["Auth"],"summary":"Auth Resend Verification","description":"Re-send the verification email to a user who didn't get / lost the\noriginal. Always returns 200 with the same message regardless of\nwhether the email matched a real account — anti-enumeration.\n\nIf the email is for an unverified account, a fresh verification_token\nis generated and a new verification email is sent in the background.\nVerified accounts are silently no-op.","operationId":"auth_resend_verification_api_v1_auth_resend_verification_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResendVerificationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/user/intent":{"get":{"tags":["User"],"summary":"Get User Intent","description":"Returns whether the current user has captured onboarding intent.\nFrontend calls this on /app load — if `captured` is false, it shows\nthe OnboardingIntentModal.","operationId":"get_user_intent_api_v1_user_intent_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["User"],"summary":"Save User Intent","description":"Save (or update) onboarding intent for the current user. UPSERT —\nsafe to call multiple times if they want to revise.","operationId":"save_user_intent_api_v1_user_intent_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserIntentRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/referral/code":{"get":{"tags":["Referral"],"summary":"Get Referral Code","description":"Get the current user's referral code. Generates one if not set.","operationId":"get_referral_code_api_v1_referral_code_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/referral/apply":{"post":{"tags":["Referral"],"summary":"Apply Referral","description":"Apply a referral code. Both referrer and referee get 5 bonus search credits.","operationId":"apply_referral_api_v1_referral_apply_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyReferralRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/referral/stats":{"get":{"tags":["Referral"],"summary":"Get Referral Stats Endpoint","description":"Get referral stats: how many people used your code, bonus credits earned.","operationId":"get_referral_stats_endpoint_api_v1_referral_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/auth/google":{"post":{"tags":["Auth"],"summary":"Auth Google","description":"Authenticate with Google ID token (from Google Sign-In).","operationId":"auth_google_api_v1_auth_google_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoogleAuthRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/refresh":{"post":{"tags":["Auth"],"summary":"Auth Refresh","description":"Exchange a valid refresh token for a new access token.","operationId":"auth_refresh_api_v1_auth_refresh_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/forgot-password":{"post":{"tags":["Auth"],"summary":"Auth Forgot Password","description":"Request a password reset email. Always returns 200 (does not leak whether email exists).","operationId":"auth_forgot_password_api_v1_auth_forgot_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForgotPasswordRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/reset-password":{"post":{"tags":["Auth"],"summary":"Auth Reset Password","description":"Reset password using a valid reset token.","operationId":"auth_reset_password_api_v1_auth_reset_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPasswordRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/stripe/create-checkout":{"post":{"tags":["Billing"],"summary":"Stripe Checkout","description":"Create a Stripe Checkout session for consumer Pro ($19.99/mo or $190/yr).","operationId":"stripe_checkout_api_v1_stripe_create_checkout_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"trial","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Trial"}},{"name":"plan","in":"query","required":false,"schema":{"type":"string","pattern":"^(monthly|annual)$","default":"monthly","title":"Plan"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/stripe/create-credit-checkout":{"post":{"tags":["Billing"],"summary":"Stripe Credit Checkout","description":"Create a Stripe Checkout session for a one-time credit pack purchase.","operationId":"stripe_credit_checkout_api_v1_stripe_create_credit_checkout_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"pack_id","in":"query","required":true,"schema":{"type":"string","pattern":"^pack_(25|100)$","title":"Pack Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/credits":{"get":{"tags":["Billing"],"summary":"Get Credits","description":"Get the user's current search credit balance.","operationId":"get_credits_api_v1_credits_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/stripe/portal":{"post":{"tags":["Billing"],"summary":"Stripe Portal","description":"Create a Stripe Customer Portal session for managing subscription.","operationId":"stripe_portal_api_v1_stripe_portal_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/library/patterns":{"post":{"tags":["Pattern Library"],"summary":"Library List Patterns","description":"List detected chart patterns with filters and pagination.","operationId":"library_list_patterns_api_v1_library_patterns_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatternListRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatternListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/library/stats":{"get":{"tags":["Pattern Library"],"summary":"Library Stats","description":"Aggregate stats per pattern type — count, confidence, win rate (cached 5 min).","operationId":"library_stats_api_v1_library_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/PatternTypeStatsItem"},"type":"array","title":"Response Library Stats Api V1 Library Stats Get"}}}}}}},"/api/v1/library/patterns/{pattern_id}":{"get":{"tags":["Pattern Library"],"summary":"Library Pattern Detail","description":"Get full pattern detail with metadata, confidence, and forward returns.","operationId":"library_pattern_detail_api_v1_library_patterns__pattern_id__get","parameters":[{"name":"pattern_id","in":"path","required":true,"schema":{"type":"integer","title":"Pattern Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/library/scan-status":{"get":{"tags":["Pattern Library"],"summary":"Library Scan Status","description":"Get the pattern scan pipeline progress and last run time.","operationId":"library_scan_status_api_v1_library_scan_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/regime/today":{"get":{"tags":["Regime"],"summary":"Regime Today","description":"Get today's market regime snapshot — VIX, yield curve, sector rotation (cached 60s).","operationId":"regime_today_api_v1_regime_today_get","parameters":[{"name":"top_n","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Top N"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/regime/{date}":{"get":{"tags":["Regime"],"summary":"Regime By Date","description":"Get regime snapshot for a historical date (cached 60s).","operationId":"regime_by_date_api_v1_regime__date__get","parameters":[{"name":"date","in":"path","required":true,"schema":{"type":"string","title":"Date"}},{"name":"top_n","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Top N"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/regime/symbol/{symbol}/{date}":{"get":{"tags":["Regime"],"summary":"Regime Symbol","description":"Get regime classification for a single stock on a date.","operationId":"regime_symbol_api_v1_regime_symbol__symbol___date__get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}},{"name":"date","in":"path","required":true,"schema":{"type":"string","title":"Date"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/track-record/strategies":{"get":{"tags":["Track Record"],"summary":"Track Record Strategies","description":"List all prediction strategies with summary stats.","operationId":"track_record_strategies_api_v1_track_record_strategies_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/track-record/comparison":{"get":{"tags":["Track Record"],"summary":"Track Record Comparison","description":"Side-by-side comparison of all prediction strategies.","operationId":"track_record_comparison_api_v1_track_record_comparison_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/track-record/{strategy_id}":{"get":{"tags":["Track Record"],"summary":"Track Record Detail","description":"Full equity curve, stats, and performance breakdown for one strategy.","operationId":"track_record_detail_api_v1_track_record__strategy_id__get","parameters":[{"name":"strategy_id","in":"path","required":true,"schema":{"type":"string","title":"Strategy Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/history":{"get":{"tags":["Track Record"],"summary":"Search History","description":"Get the authenticated user's search history with pagination.","operationId":"search_history_api_v1_history_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/history/performance":{"get":{"tags":["Track Record"],"summary":"Search Performance","description":"Get the authenticated user's cumulative P&L from past searches.","operationId":"search_performance_api_v1_history_performance_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/competition/latest":{"get":{"tags":["Competition"],"summary":"Competition Latest","description":"Get the most recent AI agent competition run with all agents and results.","operationId":"competition_latest_api_v1_competition_latest_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/competition/{run_id}":{"get":{"tags":["Competition"],"summary":"Competition Run","description":"Get a specific competition run with all agent results.","operationId":"competition_run_api_v1_competition__run_id__get","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"integer","title":"Run Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/competition/{run_id}/agent/{agent_name}":{"get":{"tags":["Competition"],"summary":"Competition Agent Detail","description":"Get detailed results (trades, equity curve) for a specific agent in a competition run.","operationId":"competition_agent_detail_api_v1_competition__run_id__agent__agent_name__get","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"integer","title":"Run Id"}},{"name":"agent_name","in":"path","required":true,"schema":{"type":"string","title":"Agent Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/keys":{"get":{"tags":["API Keys"],"summary":"List Keys","description":"List all API keys for the current user (keys are masked).","operationId":"list_keys_api_v1_keys_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ApiKeyListItem"},"type":"array","title":"Response List Keys Api V1 Keys Get"}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["API Keys"],"summary":"Create Key","description":"Create a new API key for programmatic access.\n\nThe full key is returned only once in the response. Store it securely.\nUse it as `Authorization: Bearer cl_...` in API requests.","operationId":"create_key_api_v1_keys_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyRequest"}}},"required":true},"responses":{"200":{"description":"API key created. Save the `key` field -- it will not be shown again.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyResponse"}}}},"401":{"description":"Authentication required"},"422":{"description":"Invalid tier"}},"security":[{"HTTPBearer":[]}]}},"/api/v1/keys/{key_id}":{"delete":{"tags":["API Keys"],"summary":"Revoke Key","description":"Revoke an API key. This is irreversible.","operationId":"revoke_key_api_v1_keys__key_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"integer","title":"Key Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/usage":{"get":{"tags":["API Keys"],"summary":"Usage Stats","description":"Get usage statistics for the current API key.\n\nCan be called with either a JWT token (returns stats for all user keys)\nor an API key (returns stats for that specific key).","operationId":"usage_stats_api_v1_usage_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":1,"description":"Number of days to look back","default":30,"title":"Days"},"description":"Number of days to look back"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageStatsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/usage/summary":{"get":{"tags":["API Keys"],"summary":"Usage Summary","description":"Get monthly usage summary for billing.\n\nRequires API key auth or JWT with at least one API key.","operationId":"usage_summary_api_v1_usage_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonthlySummaryResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/keys/tiers":{"get":{"tags":["API Keys"],"summary":"List Tiers","description":"List available API key tiers with rate limits, quotas, and features.","operationId":"list_tiers_api_v1_keys_tiers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/portfolio":{"get":{"tags":["Portfolio"],"summary":"Portfolio Overview","description":"Get all holdings with their latest pattern analyses in a single call.","operationId":"portfolio_overview_api_v1_portfolio_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portfolio/holdings":{"post":{"tags":["Portfolio"],"summary":"Portfolio Add Holding","description":"Add a ticker to the user's portfolio. Free: 5 max, Pro: 25 max.","operationId":"portfolio_add_holding_api_v1_portfolio_holdings_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddHoldingRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portfolio/holdings/{holding_id}":{"delete":{"tags":["Portfolio"],"summary":"Portfolio Remove Holding","description":"Remove a ticker from the portfolio (verifies ownership).","operationId":"portfolio_remove_holding_api_v1_portfolio_holdings__holding_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"holding_id","in":"path","required":true,"schema":{"type":"integer","title":"Holding Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portfolio/holdings/{holding_id}/history":{"get":{"tags":["Portfolio"],"summary":"Portfolio Holding History","description":"Get the last 30 analyses for one holding (for trend view).","operationId":"portfolio_holding_history_api_v1_portfolio_holdings__holding_id__history_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"holding_id","in":"path","required":true,"schema":{"type":"integer","title":"Holding Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portfolio/track-record":{"get":{"tags":["Portfolio"],"summary":"Portfolio Track Record","description":"Predicted vs actual return stats for this user's portfolio analyses.","operationId":"portfolio_track_record_api_v1_portfolio_track_record_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/funnel":{"get":{"summary":"Admin Funnel","description":"Signup → activation → retention → paid funnel by cohort week.\n\nJoins users + user_searches + api_keys + api_usage to compute every\nstage from the data already in the DB — no new instrumentation needed.\nStages:\n  - activated_web:   >=1 user_searches row\n  - engaged_web:     >=3 user_searches rows\n  - created_api_key: any api_keys row\n  - activated_api:   >=1 api_usage row via their key\n  - engaged_api:     >=10 api_usage rows via their key\n  - retained_7d:     any activity 7+ days after signup\n  - paid:            subscription_status in (active, trialing)","operationId":"admin_funnel_api_v1_admin_funnel_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"window_days","in":"query","required":false,"schema":{"type":"integer","default":90,"title":"Window Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/accuracy/summary":{"get":{"tags":["Track Record"],"summary":"Accuracy Summary","description":"Public-facing prediction accuracy from forward_tests (daily automated pipeline).\n\nReturns bias-corrected direction accuracy when sufficient samples exist.\nIncludes holdout test set metrics and random baseline for comparison.","operationId":"accuracy_summary_api_v1_accuracy_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/patterns/{symbol}":{"get":{"tags":["Patterns"],"summary":"Get Ticker Pattern","description":"Get latest pattern analysis for a ticker. No auth required (public SEO page).\n\nReturns the most recent forward test data, ticker metadata, and outcome stats.","operationId":"get_ticker_pattern_api_v1_patterns__symbol__get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TickerPatternResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/accuracy/by-regime":{"get":{"tags":["Track Record"],"summary":"Accuracy By Regime","description":"Forward test accuracy bucketed by a context dimension.\n\nTells users whether pattern matching is more accurate in specific market\nregimes (e.g., \"our predictions hit 62% in calm markets vs 48% in high VIX\").\nThis is the trust signal for context-aware matching.\n\nJoins forward_tests with bar_embeddings to get the context dimension for\neach prediction's (symbol, test_date), then buckets and computes direction\naccuracy + avg return per bucket.","operationId":"accuracy_by_regime_api_v1_accuracy_by_regime_get","parameters":[{"name":"dimension","in":"query","required":false,"schema":{"type":"string","description":"Context dimension to bucket by: vix_level, trailing_vol_pct, market_breadth, spy_trend_20d, variance_risk_prem, credit_spread","default":"vix_level","title":"Dimension"},"description":"Context dimension to bucket by: vix_level, trailing_vol_pct, market_breadth, spy_trend_20d, variance_risk_prem, credit_spread"},{"name":"horizon","in":"query","required":false,"schema":{"type":"integer","description":"Forward return horizon (1/3/5/10)","default":5,"title":"Horizon"},"description":"Forward return horizon (1/3/5/10)"},{"name":"buckets","in":"query","required":false,"schema":{"type":"integer","maximum":10,"minimum":2,"description":"Number of buckets (quartiles=4)","default":4,"title":"Buckets"},"description":"Number of buckets (quartiles=4)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/anomaly/{symbol}":{"get":{"tags":["Market Intelligence"],"summary":"Get Anomaly Score","description":"Detect whether a symbol's current pattern is anomalous compared to historical norms.\n\nRuns V5 similarity search and compares average match distance against a\nbaseline. If the current distance is >1.5x the baseline, the pattern is\nflagged as anomalous.","operationId":"get_anomaly_score_api_v1_anomaly__symbol__get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}},{"name":"date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Date (YYYY-MM-DD). Defaults to latest available trading day with a V5 embedding.","title":"Date"},"description":"Date (YYYY-MM-DD). Defaults to latest available trading day with a V5 embedding."},{"name":"timeframe","in":"query","required":false,"schema":{"type":"string","description":"V5 embedding scale. One of: 5m, 15m, 30m, 1h.","default":"1h","title":"Timeframe"},"description":"V5 embedding scale. One of: 5m, 15m, 30m, 1h."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/volume-profile/{symbol}":{"get":{"tags":["Market Intelligence"],"summary":"Get Volume Profile","description":"Intraday volume profile bucketed into 30-min intervals.\n\nCompares current-day volume per bucket against the 20-day historical average\nand flags any bucket where volume exceeds 2x the average.","operationId":"get_volume_profile_api_v1_volume_profile__symbol__get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}},{"name":"date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Date (YYYY-MM-DD). Defaults to latest trading day.","title":"Date"},"description":"Date (YYYY-MM-DD). Defaults to latest trading day."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sector-rotation":{"get":{"tags":["Market Intelligence"],"summary":"Get Sector Rotation","description":"Sector rotation analysis: cumulative returns and relative strength vs SPY.\n\nRanks all 11 sector ETFs by cumulative return over the lookback period\nand computes relative strength (sector return minus SPY return).","operationId":"get_sector_rotation_api_v1_sector_rotation_get","parameters":[{"name":"lookback","in":"query","required":false,"schema":{"type":"integer","maximum":60,"minimum":1,"description":"Number of trading days to look back","default":5,"title":"Lookback"},"description":"Number of trading days to look back"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/crowding":{"get":{"tags":["Market Intelligence"],"summary":"Get Crowding Indicator","description":"Signal-crowding indicator over the nightly forward-test set.\n\nNOT a whole-market breadth measure. The universe is exactly the\nsymbols the nightly forward test scored for `date` — typically ~15-25\nnames, skewed toward high-interest/high-volatility tickers — so read\nthis as \"how one-sided is today's signal set\", not \"how one-sided is\nthe market\". When >60% of those signals point the same direction the\nset is flagged \"crowded\".","operationId":"get_crowding_indicator_api_v1_crowding_get","parameters":[{"name":"date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Date (YYYY-MM-DD). Defaults to latest forward test date.","title":"Date"},"description":"Date (YYYY-MM-DD). Defaults to latest forward test date."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/earnings-reaction/{symbol}":{"get":{"tags":["Market Intelligence"],"summary":"Get Earnings Reaction","description":"Earnings/gap reaction analysis: find all overnight gaps and what happened next.\n\nScans daily bars for overnight gaps exceeding min_gap%, then computes\nforward 1d/5d returns and continuation rates. No auth required.","operationId":"get_earnings_reaction_api_v1_earnings_reaction__symbol__get","parameters":[{"name":"symbol","in":"path","required":true,"schema":{"type":"string","title":"Symbol"}},{"name":"min_gap","in":"query","required":false,"schema":{"type":"number","description":"Minimum absolute overnight gap % to include","default":3.0,"title":"Min Gap"},"description":"Minimum absolute overnight gap % to include"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/correlation-shift":{"get":{"tags":["Market Intelligence"],"summary":"Get Correlation Shift","description":"Correlation shift detector: which stocks are diverging from their normal SPY correlation?\n\nComputes rolling correlation of each symbol vs SPY over the lookback period,\nthen flags symbols whose current correlation has shifted significantly. No auth required.","operationId":"get_correlation_shift_api_v1_correlation_shift_get","parameters":[{"name":"symbols","in":"query","required":false,"schema":{"type":"string","description":"Comma-separated symbols to compare vs SPY","default":"NVDA,AAPL,MSFT,GOOGL,AMZN,TSLA,META","title":"Symbols"},"description":"Comma-separated symbols to compare vs SPY"},{"name":"lookback","in":"query","required":false,"schema":{"type":"integer","maximum":252,"minimum":10,"description":"Lookback period in trading days","default":60,"title":"Lookback"},"description":"Lookback period in trading days"},{"name":"window","in":"query","required":false,"schema":{"type":"integer","maximum":60,"minimum":5,"description":"Rolling correlation window in days","default":20,"title":"Window"},"description":"Rolling correlation window in days"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/scenario":{"post":{"tags":["Market Intelligence"],"summary":"Post Scenario Analysis","description":"Scenario analysis: when SPY moves X%, what does this symbol typically do?\n\nFinds all historical days where SPY moved within +/-0.5% of the given market_move_pct,\nthen looks up the symbol's forward returns over horizon_days. No auth required.","operationId":"post_scenario_analysis_api_v1_scenario_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScenarioRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/match_winning_vector":{"post":{"tags":["Winning Vectors"],"summary":"Post Match Winning Vector","description":"Match a (symbol, date, timeframe) anchor against the catalog of mined\nwinning/losing vectors.\n\nReturns the nearest cluster, whether it's a winner / loser / unranked,\nsignature_match_score (how well the anchor's CURRENT Layer 2 features\nalign with the cluster's signature), and cohort-percentile-derived\nsuggested stop / target / hold.\n\nBody:\n  {\"symbol\": \"AAPL\", \"date\": \"2024-06-21\", \"timeframe\": \"1d\"}","operationId":"post_match_winning_vector_api_v1_match_winning_vector_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Req"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/list_winning_vectors":{"get":{"tags":["Winning Vectors"],"summary":"Get List Winning Vectors","description":"List the catalog of mined winning and/or losing vectors with their\nheadline stats.\n\nQuery params:\n  kind: 'winners' | 'losers' | 'both' (default both)\n  top_n: how many of each (default 20)","operationId":"get_list_winning_vectors_api_v1_list_winning_vectors_get","parameters":[{"name":"top_n","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Top N"}},{"name":"kind","in":"query","required":false,"schema":{"type":"string","default":"both","title":"Kind"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/get_cluster_signature/{cluster_id}":{"get":{"tags":["Winning Vectors"],"summary":"Get Cluster Signature","description":"Full signature for a cluster: numeric features with |z| > 0.5 vs population\nbaseline, train/test outcome distribution, top symbols. Use this to teach an\nagent what a particular winning or losing pattern actually looks like.","operationId":"get_cluster_signature_api_v1_get_cluster_signature__cluster_id__get","parameters":[{"name":"cluster_id","in":"path","required":true,"schema":{"type":"integer","title":"Cluster Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AddHoldingRequest":{"properties":{"symbol":{"type":"string","title":"Symbol","description":"Ticker symbol to add (e.g. AAPL)"}},"type":"object","required":["symbol"],"title":"AddHoldingRequest"},"AdminStatsResponse":{"properties":{"users":{"additionalProperties":true,"type":"object","title":"Users"},"searches":{"additionalProperties":true,"type":"object","title":"Searches"},"api_keys":{"additionalProperties":true,"type":"object","title":"Api Keys"},"portfolio":{"additionalProperties":true,"type":"object","title":"Portfolio"}},"type":"object","required":["users","searches","api_keys","portfolio"],"title":"AdminStatsResponse"},"AgentChatMessage":{"properties":{"role":{"type":"string","enum":["user","assistant"],"title":"Role"},"content":{"title":"Content"}},"type":"object","required":["role","content"],"title":"AgentChatMessage"},"AgentChatRequest":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/AgentChatMessage"},"type":"array","title":"Messages"},"max_iterations":{"type":"integer","maximum":20.0,"minimum":1.0,"title":"Max Iterations","default":10}},"type":"object","required":["messages"],"title":"AgentChatRequest"},"AgentChatResponse":{"properties":{"final_text":{"type":"string","title":"Final Text"},"messages":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Messages"},"tool_calls":{"items":{"$ref":"#/components/schemas/AgentChatToolTrace"},"type":"array","title":"Tool Calls"},"stop_reason":{"type":"string","title":"Stop Reason"},"iterations":{"type":"integer","title":"Iterations"},"model":{"type":"string","title":"Model"}},"type":"object","required":["final_text","messages","tool_calls","stop_reason","iterations","model"],"title":"AgentChatResponse"},"AgentChatToolTrace":{"properties":{"tool":{"type":"string","title":"Tool"},"input":{"additionalProperties":true,"type":"object","title":"Input"},"result_preview":{"type":"string","title":"Result Preview"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["tool","input","result_preview"],"title":"AgentChatToolTrace"},"AgentSetup":{"properties":{"rank":{"type":"integer","title":"Rank"},"symbol":{"type":"string","title":"Symbol"},"test_date":{"type":"string","title":"Test Date"},"direction":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Direction","description":"Cohort majority direction over the 5-day forward horizon. Based on the count of positive 5d match returns (≥6/10 = bullish). Can disagree with sign(pred_1d) — that's not a contradiction, the two fields measure different things on different horizons. See DailyPick.direction for details."},"interest_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Interest Score"},"pred_1d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Pred 1D","description":"Distance-weighted mean of 1-day match returns (top-K=10)."},"pred_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Pred 5D","description":"Distance-weighted mean of 5-day match returns (top-K=10)."},"pred_10d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Pred 10D","description":"Distance-weighted mean of 10-day match returns (top-K=10)."},"summary_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary Text"},"cohort":{"anyOf":[{"$ref":"#/components/schemas/AgentSetupCohort"},{"type":"null"}]},"top_features":{"items":{"$ref":"#/components/schemas/AgentSetupFeature"},"type":"array","title":"Top Features","default":[]},"cohort_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cohort Error"},"cohort_anchor_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cohort Anchor Date","description":"Date the cohort was actually anchored at. Usually equals test_date, but when the V5 embedding for test_date isn't available yet (the 1d V5 backfill lags the pick pipeline by a few days) the cohort falls back to the most recent prior trading day that has an embedding."},"cohort_anchor_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cohort Anchor Note","description":"Set when cohort_anchor_date differs from test_date."}},"type":"object","required":["rank","symbol","test_date"],"title":"AgentSetup"},"AgentSetupCohort":{"properties":{"n":{"type":"integer","title":"N"},"win_rate_1d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Win Rate 1D"},"mean_1d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Mean 1D"},"median_1d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Median 1D"},"win_rate_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Win Rate 5D"},"mean_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Mean 5D"},"median_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Median 5D"},"win_rate_10d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Win Rate 10D"},"mean_10d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Mean 10D"},"median_10d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Median 10D"},"cohort_score":{"type":"number","title":"Cohort Score","default":0.0},"cohort_tightness_score":{"type":"number","title":"Cohort Tightness Score","default":0.0}},"type":"object","required":["n"],"title":"AgentSetupCohort"},"AgentSetupFeature":{"properties":{"feature":{"type":"string","title":"Feature"},"importance":{"type":"number","title":"Importance"},"direction":{"type":"string","title":"Direction"}},"type":"object","required":["feature","importance","direction"],"title":"AgentSetupFeature"},"AgentSetupsResponse":{"properties":{"as_of_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"As Of Date"},"cohort_timeframe":{"type":"string","title":"Cohort Timeframe","default":"1d"},"yesterday_recap":{"anyOf":[{"$ref":"#/components/schemas/RecentRecapResponse"},{"type":"null"}]},"setups":{"items":{"$ref":"#/components/schemas/AgentSetup"},"type":"array","title":"Setups","default":[]}},"type":"object","title":"AgentSetupsResponse"},"AgentTraderEquityPoint":{"properties":{"date":{"type":"string","title":"Date"},"equity":{"type":"number","title":"Equity"},"spy_equity":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Spy Equity"}},"type":"object","required":["date","equity"],"title":"AgentTraderEquityPoint"},"AgentTraderLesson":{"properties":{"lesson_date":{"type":"string","title":"Lesson Date"},"lesson_text":{"type":"string","title":"Lesson Text"},"n_picks":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N Picks"},"portfolio_return_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Portfolio Return 5D"},"spy_return_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Spy Return 5D"},"excess_return":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Excess Return"}},"type":"object","required":["lesson_date","lesson_text"],"title":"AgentTraderLesson"},"AgentTraderSummary":{"properties":{"starting_capital":{"type":"number","title":"Starting Capital","default":10000.0},"realized_pnl":{"type":"number","title":"Realized Pnl"},"current_equity":{"type":"number","title":"Current Equity"},"return_pct":{"type":"number","title":"Return Pct"},"n_closed":{"type":"integer","title":"N Closed"},"n_open":{"type":"integer","title":"N Open"},"win_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Win Rate"},"spy_benchmark_return_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Spy Benchmark Return Pct"},"excess_return_vs_spy_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Excess Return Vs Spy Pct"},"n_lessons":{"type":"integer","title":"N Lessons"},"last_trade_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Trade Date"}},"type":"object","required":["realized_pnl","current_equity","return_pct","n_closed","n_open","n_lessons"],"title":"AgentTraderSummary"},"AgentTraderTrade":{"properties":{"trade_date":{"type":"string","title":"Trade Date"},"symbol":{"type":"string","title":"Symbol"},"side":{"type":"string","title":"Side"},"entry_price":{"type":"number","title":"Entry Price"},"exit_price":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Exit Price"},"exit_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Exit Date"},"return_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Return Pct"},"pnl_dollars":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Pnl Dollars"},"benchmark_spy_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Benchmark Spy 5D"},"cohort_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Cohort Score"},"cohort_win_rate_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Cohort Win Rate 5D"},"cohort_n":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cohort N"},"conviction":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conviction"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"status":{"type":"string","title":"Status"}},"type":"object","required":["trade_date","symbol","side","entry_price","status"],"title":"AgentTraderTrade"},"AlertCreateRequest":{"properties":{"embedding":{"items":{"type":"number"},"type":"array","title":"Embedding","description":"384-dim embedding vector (from query_embedding in search response)"},"timeframe":{"type":"string","title":"Timeframe","description":"Timeframe to monitor","default":"rth","examples":["rth"]},"threshold":{"type":"number","title":"Threshold","description":"L2 distance threshold — patterns closer than this trigger an alert. Lower = more selective.","default":10.0,"examples":[10.0]},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label","description":"Human-readable label for this alert","examples":["AAPL breakout pattern"]},"symbol":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Symbol","description":"Optional symbol filter — only match this symbol","examples":["AAPL"]}},"type":"object","required":["embedding"],"title":"AlertCreateRequest","description":"Create a pattern alert to monitor for similar chart patterns."},"AnalyzeRequest":{"properties":{"query":{"type":"string","title":"Query","description":"Symbol + date query string","examples":["AAPL 2024-06-15","TSLA 6/15/24 3d"]},"timeframe":{"type":"string","title":"Timeframe","description":"rth, premarket, rth_3d, rth_5d, rth_10d, or auto","default":"auto","examples":["rth"]},"top_n":{"type":"integer","maximum":50.0,"minimum":1.0,"title":"Top N","description":"Number of similar patterns to return","default":10},"include_summary":{"type":"boolean","title":"Include Summary","description":"Include AI-generated summary (requires Pro for JWT users)","default":true},"format":{"type":"string","title":"Format","description":"Response format: 'full' (default) or 'agent' (strips paths/bars/share_urls for LLM consumption)","default":"full"},"context_weight":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Context Weight","description":"Context re-ranking weight: 0.0 = shape only (default), 0.05 = recommended, 1.0 = context dominates. When > 0, matches are re-ranked by market regime similarity (VIX, yield curve, credit spreads, breadth).","default":0.0},"sector":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sector","description":"Filter results by GICS sector (e.g. 'Information Technology')"},"same_sector":{"type":"boolean","title":"Same Sector","description":"Restrict matches to the query symbol's own GICS sector (auto-resolves sector).","default":false},"min_market_cap":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min Market Cap","description":"Minimum market cap in dollars"},"max_market_cap":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max Market Cap","description":"Maximum market cap in dollars"},"exclude_etps":{"type":"boolean","title":"Exclude Etps","description":"Exclude ETFs and ETNs from results","default":false}},"type":"object","required":["query"],"title":"AnalyzeRequest","description":"Combined analysis: search + follow-through + AI summary in one call."},"AnalyzeResponse":{"properties":{"query":{"additionalProperties":true,"type":"object","title":"Query","description":"Echo of the original query parameters"},"timeframe":{"type":"string","title":"Timeframe","description":"Timeframe used for the search"},"results":{"items":{"$ref":"#/components/schemas/SimilarDay"},"type":"array","title":"Results","description":"Top matching historical patterns"},"count":{"type":"integer","title":"Count","description":"Number of results returned"},"follow_through":{"anyOf":[{"$ref":"#/components/schemas/FollowThroughResponse"},{"type":"null"}],"description":"Forward return analysis for the matches"},"outcome_distribution":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Outcome Distribution","description":"Outcome distribution for 5-day forward returns"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary","description":"AI-generated plain English summary"},"share_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Share Url","description":"Shareable link to reproduce this search on chartlibrary.io"}},"type":"object","required":["query","timeframe","results","count"],"title":"AnalyzeResponse","description":"Combined search + follow-through + summary response."},"ApiKeyListItem":{"properties":{"id":{"type":"integer","title":"Id"},"key_prefix":{"type":"string","title":"Key Prefix","description":"Masked key prefix (e.g. 'cl_a1b2c3d4')"},"name":{"type":"string","title":"Name"},"tier":{"type":"string","title":"Tier"},"daily_limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Daily Limit"},"monthly_limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Monthly Limit"},"rate_limit_rpm":{"type":"integer","title":"Rate Limit Rpm"},"is_active":{"type":"boolean","title":"Is Active"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","key_prefix","name","tier","daily_limit","monthly_limit","rate_limit_rpm","is_active","last_used_at","created_at"],"title":"ApiKeyListItem"},"ApiKeyResponse":{"properties":{"id":{"type":"integer","title":"Id","description":"Unique API key ID"},"key":{"type":"string","title":"Key","description":"Full API key (shown only once -- save it securely)","examples":["cl_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"]},"key_prefix":{"type":"string","title":"Key Prefix","description":"First 10 chars for identification","examples":["cl_a1b2c3"]},"name":{"type":"string","title":"Name","description":"Label for this key","examples":["My Trading Bot"]},"tier":{"type":"string","title":"Tier","description":"API tier","examples":["free"]},"daily_limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Daily Limit","description":"Daily request limit (null for unlimited)","examples":[100]},"monthly_limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Monthly Limit","description":"Monthly request limit (null for unlimited)","examples":[null]},"rate_limit_rpm":{"type":"integer","title":"Rate Limit Rpm","description":"Requests per minute limit","examples":[10]},"created_at":{"type":"string","title":"Created At","description":"ISO 8601 creation timestamp"}},"type":"object","required":["id","key","key_prefix","name","tier","daily_limit","monthly_limit","rate_limit_rpm","created_at"],"title":"ApiKeyResponse","description":"Response when creating a new API key. The full key is shown only once."},"ApplyReferralRequest":{"properties":{"code":{"type":"string","title":"Code"}},"type":"object","required":["code"],"title":"ApplyReferralRequest"},"BacktestCondition":{"properties":{"field":{"type":"string","title":"Field","description":"median | win_rate | std | n | cohort_score | cohort_size"},"op":{"type":"string","title":"Op","description":"> | >= | < | <= | ="},"value":{"type":"number","title":"Value"}},"type":"object","required":["field","op","value"],"title":"BacktestCondition"},"BatchSearchRequest":{"properties":{"symbols":{"items":{"type":"string"},"type":"array","maxItems":20,"minItems":1,"title":"Symbols","description":"List of ticker symbols (max 20)","examples":[["AAPL","MSFT","NVDA"]]},"date":{"type":"string","title":"Date","description":"Date in YYYY-MM-DD format","examples":["2024-06-15"]},"timeframe":{"type":"string","title":"Timeframe","description":"Timeframe for all searches","default":"rth","examples":["rth"]},"top_n":{"type":"integer","maximum":50.0,"minimum":1.0,"title":"Top N","default":10},"sector":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sector","description":"Filter results by GICS sector"},"min_market_cap":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min Market Cap","description":"Minimum market cap in dollars"},"max_market_cap":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max Market Cap","description":"Maximum market cap in dollars"},"exclude_etps":{"type":"boolean","title":"Exclude Etps","description":"Exclude ETFs and ETNs from results","default":false}},"type":"object","required":["symbols","date"],"title":"BatchSearchRequest","description":"Search for similar patterns across multiple symbols at once."},"BatchSearchResponse":{"properties":{"date":{"type":"string","title":"Date"},"timeframe":{"type":"string","title":"Timeframe"},"results":{"items":{"$ref":"#/components/schemas/BatchSymbolResult"},"type":"array","title":"Results"}},"type":"object","required":["date","timeframe","results"],"title":"BatchSearchResponse"},"BatchSymbolResult":{"properties":{"symbol":{"type":"string","title":"Symbol"},"date":{"type":"string","title":"Date"},"count":{"type":"integer","title":"Count"},"horizon_returns":{"additionalProperties":{"items":{"type":"number"},"type":"array"},"type":"object","title":"Horizon Returns"},"stats":{"additionalProperties":{"additionalProperties":true,"type":"object"},"type":"object","title":"Stats"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["symbol","date","count","horizon_returns","stats"],"title":"BatchSymbolResult"},"BestCall":{"properties":{"symbol":{"type":"string","title":"Symbol"},"test_date":{"type":"string","title":"Test Date"},"wpred_1d":{"type":"number","title":"Wpred 1D"},"actual_1d":{"type":"number","title":"Actual 1D"},"error":{"type":"number","title":"Error"},"n_matches":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N Matches"},"direction":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Direction"}},"type":"object","required":["symbol","test_date","wpred_1d","actual_1d","error"],"title":"BestCall"},"BestCallsResponse":{"properties":{"calls":{"items":{"$ref":"#/components/schemas/BestCall"},"type":"array","title":"Calls"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["calls","count"],"title":"BestCallsResponse"},"Body_oauth_authorize_grant_api_v1_oauth_authorize_grant_post":{"properties":{"client_id":{"type":"string","title":"Client Id"},"redirect_uri":{"type":"string","title":"Redirect Uri"},"code_challenge":{"type":"string","title":"Code Challenge"},"code_challenge_method":{"type":"string","title":"Code Challenge Method","default":"S256"},"scope":{"type":"string","title":"Scope","default":"read"},"state":{"type":"string","title":"State","default":""}},"type":"object","required":["client_id","redirect_uri","code_challenge"],"title":"Body_oauth_authorize_grant_api_v1_oauth_authorize_grant_post"},"CohortAnalyzeAnchor":{"properties":{"symbol":{"type":"string","title":"Symbol","examples":["NVDA"]},"date":{"type":"string","title":"Date","description":"ISO YYYY-MM-DD","examples":["2024-06-14"]},"timeframe":{"type":"string","title":"Timeframe","description":"One of 5m / 15m / 30m / 1h / 1d","examples":["1h"]}},"type":"object","required":["symbol","date","timeframe"],"title":"CohortAnalyzeAnchor"},"CohortAnalyzeFilters":{"properties":{"vol_regime":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Vol Regime","examples":[["mid","high"]]},"days_since_earnings":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Days Since Earnings","examples":[{"max":10,"min":0}]},"days_since_ath":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Days Since Ath"},"sector_rs":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Sector Rs","description":"Range filter on sector_rs_60d (percent units)."},"has_news":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Has News"},"macro_state":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Macro State","examples":[["bullish","neutral"]]},"relative_volume":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Relative Volume"},"realized_vol":{"anyOf":[{"additionalProperties":{"type":"number"},"type":"object"},{"type":"null"}],"title":"Realized Vol","description":"Range filter on realized_vol_20d (annualized percent)."}},"type":"object","title":"CohortAnalyzeFilters","description":"Layer 2 metadata constraints — all optional. Only candidates matching\nevery supplied filter are kept in the cohort."},"CohortAnalyzeOptions":{"properties":{"include_cohort_anchors":{"type":"boolean","title":"Include Cohort Anchors","default":false},"include_feature_importance":{"type":"boolean","title":"Include Feature Importance","default":true},"include_regime_stratification":{"type":"boolean","title":"Include Regime Stratification","default":true},"include_risk_profile":{"type":"boolean","title":"Include Risk Profile","default":true},"feature_importance_method":{"type":"string","title":"Feature Importance Method","default":"logistic_regression"},"regime_strat_dim":{"type":"string","title":"Regime Strat Dim","default":"vol_regime"},"exclude_same_symbol_days":{"type":"integer","title":"Exclude Same Symbol Days","description":"Drop same-symbol analogs within N calendar days of anchor. 0 = exact-anchor-only exclusion.","default":10},"include_anchor_metadata":{"type":"boolean","title":"Include Anchor Metadata","description":"Return the anchor's own bar_anchor_metadata + market_state + bar_news_features rows alongside the cohort analysis. Useful for UI surfaces; agents typically don't need it.","default":false},"rerank":{"type":"string","title":"Rerank","description":"Optional re-ranker layer over V5 retrieval. 'none' (default) preserves V5 distance ordering. 'trajectory' re-ranks the candidate pool by how closely each candidate's forward bars match the anchor's forward bars (search-quality, not prediction).","default":"none"},"trajectory_window":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Trajectory Window","description":"Forward window length in bars for trajectory rerank. Defaults per scale: 5m=12, 15m=8, 30m=8, 1h=8, 1d=5."},"rerank_w_v5":{"type":"number","title":"Rerank W V5","description":"Composite weight on V5 distance (rerank='trajectory').","default":0.5},"rerank_w_traj":{"type":"number","title":"Rerank W Traj","description":"Composite weight on trajectory distance (rerank='trajectory').","default":0.5},"rerank_retrieval_multiplier":{"type":"integer","maximum":10.0,"minimum":1.0,"title":"Rerank Retrieval Multiplier","description":"When rerank is on, oversample V5 retrieval by this factor so the rerank has a deeper candidate pool. 2x is the default.","default":2},"include_modes":{"type":"boolean","title":"Include Modes","description":"When True, cluster the cohort's forward-bar trajectories into K outcome modes ('steady up', 'chop', 'reversal', ...) and return them on the response under `modes`. Each mode reports count + return stats + centroid trajectory + algorithmic label. This is the playbook surface — historical distribution split by trajectory shape, not by a single median.","default":false},"n_modes":{"type":"integer","maximum":8.0,"minimum":2.0,"title":"N Modes","description":"Number of modes for clustering. Default 4.","default":4},"include_first_passage":{"type":"boolean","title":"Include First Passage","description":"When True, return `first_passage`: per-horizon triple-barrier profiles over the cohort's forward PATHS: how often +upper was tagged BEFORE -lower (p_upper), the reverse (p_lower), or neither (p_none), plus median days-to-hit, an ambiguous_rate for same-day double-touches, and a censored count for too-short windows. This is the path-ordering answer that terminal MAE/MFE can't give. Opt-in: fetches daily H/L/C paths for every cohort member, so latency scales with cohort_size and spikes on a cold cache or under DB load. Bounded by a server-side wall-clock budget that degrades to first_passage=null (with a warning) instead of hanging when it can't finish.","default":false},"first_passage_upper":{"type":"number","maximum":1.0,"exclusiveMinimum":0.0,"title":"First Passage Upper","description":"Upper target as a positive fraction of the anchor close (0.05 = +5%).","default":0.05},"first_passage_lower":{"type":"number","maximum":1.0,"exclusiveMinimum":0.0,"title":"First Passage Lower","description":"Lower stop as a positive fraction of the anchor close (0.05 = -5%).","default":0.05}},"type":"object","title":"CohortAnalyzeOptions"},"CohortAnalyzeRequest":{"properties":{"anchor":{"$ref":"#/components/schemas/CohortAnalyzeAnchor"},"cohort_size":{"type":"integer","maximum":2000.0,"minimum":30.0,"title":"Cohort Size","default":500},"horizons":{"items":{"type":"integer"},"type":"array","title":"Horizons","description":"Forward horizons in trading days. 1 / 5 / 10 are served from a pre-computed cache (fast). Any other positive horizon up to 3000 is computed on demand from daily_bars (slower but tolerable for long-horizon agent flows). Common long-horizon values: 21 (~1 month), 63 (~1 quarter), 252 (~1 year), 1260 (~5 years), 2520 (~10 years). Use long horizons for position-trading and investment-research agents; short horizons for day-trading flows.","default":[1,5,10]},"filters":{"anyOf":[{"$ref":"#/components/schemas/CohortAnalyzeFilters"},{"type":"null"}]},"options":{"anyOf":[{"$ref":"#/components/schemas/CohortAnalyzeOptions"},{"type":"null"}]},"fields":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Fields","description":"Optional allowlist of top-level response keys to return. When omitted, the full payload is returned (back-compat). Valid values: outcome_distribution, feature_importance, regime_stratification, risk_profile, cohort_tightness_score, cohort_score, combined_conviction, pulse_boost, narrative_pulse, cohort_anchors, anchor_metadata. The keys anchor, cohort_size_actual, elapsed_ms, and warnings are always returned. Use this to slim the response when you only need a subset — e.g. fields=[\"outcome_distribution\"] drops ~70%+ of the payload for distribution-only callers."},"embedding":{"type":"string","title":"Embedding","description":"Embedding model to retrieve from. Today only 'v5' is valid. Future values ('v5_outcome_aware', 'news_v1', 'options_flow_v1') will land as Track B platform work ships. Forward-compat: pass 'v5' explicitly to lock in behavior across model rollouts.","default":"v5"},"time_period_start":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Time Period Start","description":"Restrict cohort candidates to anchors whose own date is >= this value (YYYY-MM-DD). Use 'show only post-COVID analogs' or 'only post-2024 setups' framing. Combine with time_period_end for a window."},"time_period_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Time Period End","description":"Restrict cohort candidates to anchors whose own date is <= this value (YYYY-MM-DD)."},"universe_sector_etf":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Universe Sector Etf","description":"Restrict cohort candidates to symbols whose sector ETF is in this list (e.g. ['XLK', 'XLC'] for tech + comms). Use when the agent wants 'similar pattern, restricted to this sector.'"},"universe_min_dollar_volume":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Universe Min Dollar Volume","description":"Restrict cohort candidates to symbols with 20-day average dollar volume >= this floor. Use 25e6 (~$25M ADV) for mid-cap+ liquidity, 100e6 for mega-cap only."},"additional_timeframes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Additional Timeframes","description":"Build cohort by aggregating similarity results across MULTIPLE V5 scales. anchor.timeframe is the primary; this list adds more (e.g. ['1d'] when anchor.timeframe='1h'). The result is narrower than a single-scale cohort: every member's pattern is similar at all requested scales simultaneously. Use for 'pattern matches at BOTH 1h and 1d' style queries where scale-robust signal matters."},"timeframe_aggregate":{"type":"string","title":"Timeframe Aggregate","description":"How to combine multi-timeframe candidate sets. 'intersect' (default) — keep only members appearing in EVERY scale's top-K; tightest cohort, smaller sample. 'union' — keep any member appearing in ANY scale; broader cohort, more noise.","default":"intersect"}},"type":"object","required":["anchor"],"title":"CohortAnalyzeRequest"},"CohortAnchor":{"properties":{"symbol":{"type":"string","title":"Symbol","description":"Ticker symbol","examples":["NVDA"]},"date":{"type":"string","title":"Date","description":"ISO date (YYYY-MM-DD)","examples":["2026-04-10"]},"timeframe":{"type":"string","title":"Timeframe","description":"Session timeframe. Daily: rth / premarket / rth_3d / rth_5d / rth_10d. Intraday (requires embedding_version='v5'): 5m / 15m / 30m / 1h.","default":"rth","examples":["rth"]}},"type":"object","required":["symbol","date"],"title":"CohortAnchor","description":"Anchor point for a cohort query. v1 supports (symbol, date) anchors."},"CohortEventFilter":{"properties":{"no_earnings_within_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"No Earnings Within Days","description":"Exclude matches within N days of earnings"}},"type":"object","title":"CohortEventFilter"},"CohortExplainResponse":{"properties":{"cohort_id":{"type":"string","title":"Cohort Id"},"horizon":{"type":"integer","title":"Horizon"},"baseline":{"additionalProperties":true,"type":"object","title":"Baseline"},"rankings":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Rankings","description":"Candidate filters ranked by absolute shift in above_entry hit rate vs the baseline cohort."},"elapsed_ms":{"type":"integer","title":"Elapsed Ms"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["cohort_id","horizon","baseline","rankings","elapsed_ms"],"title":"CohortExplainResponse"},"CohortFilters":{"properties":{"regime":{"anyOf":[{"$ref":"#/components/schemas/CohortRegimeFilter"},{"type":"null"}]},"liquidity":{"anyOf":[{"$ref":"#/components/schemas/CohortLiquidityFilter"},{"type":"null"}]},"sector":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Sector","description":"\"same_as_anchor\" or an explicit list of GICS sectors","examples":["same_as_anchor"]},"event":{"anyOf":[{"$ref":"#/components/schemas/CohortEventFilter"},{"type":"null"}]},"date_range":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Date Range","description":"Two-element [start_iso, end_iso] — restrict cohort to matches in this date range","examples":[["2018-01-01","2024-12-31"]]}},"type":"object","title":"CohortFilters"},"CohortLiquidityFilter":{"properties":{"same_cap_bucket":{"type":"boolean","title":"Same Cap Bucket","description":"Only keep matches in the same market-cap bucket as the anchor","default":false}},"type":"object","title":"CohortLiquidityFilter"},"CohortModesFeedbackRequest":{"properties":{"sentiment":{"type":"string","title":"Sentiment","description":"'up' or 'down'"},"symbol":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Symbol","description":"Ticker the cohort was anchored on"},"scale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scale","description":"Bar scale, e.g. '1h'"},"anchor_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Anchor Date","description":"Anchor date ISO, if known"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source","description":"UI surface: 'live', 'cohort', etc"}},"type":"object","required":["sentiment"],"title":"CohortModesFeedbackRequest"},"CohortRefineRequest":{"properties":{"extra_filters":{"$ref":"#/components/schemas/CohortFilters"},"horizons":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Horizons","description":"Override horizons from the parent cohort."},"include_path_stats":{"type":"boolean","title":"Include Path Stats","default":false}},"type":"object","required":["extra_filters"],"title":"CohortRefineRequest","description":"Narrow a stored cohort with additional filters. Uses in-memory match\nlist under the given cohort_id, so there is NO kNN re-run. Refinement\nis typically sub-second for cached horizons."},"CohortRegimeFilter":{"properties":{"same_vix_bucket":{"type":"boolean","title":"Same Vix Bucket","description":"Only keep matches in the same VIX regime as the anchor","default":false},"same_trend":{"type":"boolean","title":"Same Trend","description":"Only keep matches where SPY trend sign matches the anchor","default":false}},"type":"object","title":"CohortRegimeFilter"},"CohortRequest":{"properties":{"anchor":{"$ref":"#/components/schemas/CohortAnchor"},"filters":{"anyOf":[{"$ref":"#/components/schemas/CohortFilters"},{"type":"null"}]},"horizons":{"items":{"type":"integer"},"type":"array","title":"Horizons","description":"Forward horizons in trading days (max 252). Keep to [1,5,10] for the fast cached path; any other value triggers full-bar fallback.","default":[1,5,10],"examples":[[1,5,10],[1,3,5,10,20]]},"top_k":{"type":"integer","maximum":2000.0,"minimum":10.0,"title":"Top K","description":"Cohort size used for distribution stats. Larger = tighter CIs, slower.","default":500},"include_path_stats":{"type":"boolean","title":"Include Path Stats","description":"If true, compute MAE/MFE/path-based hit rates from full daily bars. Adds accuracy but costs 10-40s/500 matches. Default false.","default":false},"embedding_version":{"type":"string","title":"Embedding Version","description":"Which embedding space to search. 'v2' (default) is the production pattern-embedding coverage. 'v5' is the new scale-invariant embedding with subset coverage; requires timeframe in {5m, 15m, 30m, 1h} and does not currently apply regime/sector filters.","default":"v2"},"cross_timeframe":{"type":"boolean","title":"Cross Timeframe","description":"Only meaningful with embedding_version='v5'. When true, matches may come from any timeframe, not just the anchor's. Each match in top_matches will include a 'scale' field.","default":false},"exclude_same_symbol_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Exclude Same Symbol Days","description":"Drop matches on the same symbol within this many calendar days of the anchor (autocorrelation control). None -> default (0 for v2, 10 for v5). Pass 0 to keep the legacy exact-match-only behavior."},"as_of":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"As Of","description":"Deterministic-retrieval gate for backtests. ISO date (YYYY-MM-DD). When set, anchor.date must be <= as_of, and matches are restricted to those whose full forward-return window fit before as_of. Use for reproducible backtests where you need the cohort an analyst at as_of could have seen. None (default) = real-time, no restriction.","examples":["2024-06-01",null]}},"type":"object","required":["anchor"],"title":"CohortRequest","description":"Build a conditional distribution for a chart pattern.\n\nReturns a cohort of historical matches filtered by the given conditions\nand reports the distribution of forward outcomes (return / MAE / MFE)\nper horizon with sample size + survivorship flag.\n\nThis is the Chart Library primitive for AI agents: one call, one\ndistribution, every context filter agents actually need.\n\n**Performance note:** default horizons (1, 5, 10) use a precomputed\nforward-return cache — response <1s. Other horizons (3, 20, 60, ...)\nor `include_path_stats=true` fall back to full daily-bar scans, which\ncan take 10-40s for 500 matches but add MAE/MFE/path-based hit rates."},"CohortResponse":{"properties":{"cohort_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cohort Id","description":"Session handle (6-hour TTL) to use with /cohort/{id}/filter and /cohort/{id}/explain. None on error."},"anchor":{"additionalProperties":true,"type":"object","title":"Anchor"},"horizons":{"items":{"type":"integer"},"type":"array","title":"Horizons"},"n_raw":{"type":"integer","title":"N Raw","description":"Total matches returned by kNN + filters"},"n_effective":{"type":"integer","title":"N Effective","description":"Matches with complete forward data for the longest horizon"},"survivorship":{"additionalProperties":true,"type":"object","title":"Survivorship","description":"{included_delisted, total_matches}"},"distributions":{"additionalProperties":true,"type":"object","title":"Distributions","description":"Per-horizon stats: {h: {n, return_pct: {p10..p90}, mae_pct: {...}, mfe_pct: {...}, hit_rate: {above_entry, mfe_above_1pct, mae_below_minus_1pct}}}. mae_pct/mfe_pct are empty unless include_path_stats=true or a non-cached horizon was requested."},"top_matches":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Top Matches","description":"Preview of the 10 nearest matches"},"filters_applied":{"additionalProperties":true,"type":"object","title":"Filters Applied"},"stat_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stat Mode","description":"\"cached_endpoints\" (fast) or \"full_path\" (slow, with MAE/MFE)"},"elapsed_ms":{"type":"integer","title":"Elapsed Ms","default":0},"derived_from":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Derived From","description":"Set on refined cohorts: the parent cohort_id this one was narrowed from."},"embedding_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Embedding Version","description":"Which embedding space was used (v2 or v5)."},"cross_timeframe":{"type":"boolean","title":"Cross Timeframe","description":"v5 cross-timeframe search mode (matches may span scales).","default":false},"compliance":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Compliance","description":"Compliance envelope: disclaimer, data_as_of, api_version, methodology_url, track_record_url. Consumed by RIA-tier agents."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["anchor","horizons","n_raw","n_effective","survivorship","distributions","top_matches","filters_applied"],"title":"CohortResponse"},"CohortSummaryRequest":{"properties":{"anchor":{"$ref":"#/components/schemas/CohortAnalyzeAnchor"},"cohort_size":{"type":"integer","maximum":2000.0,"minimum":30.0,"title":"Cohort Size","default":300},"filters":{"anyOf":[{"$ref":"#/components/schemas/CohortAnalyzeFilters"},{"type":"null"}]}},"type":"object","required":["anchor"],"title":"CohortSummaryRequest"},"CreateApiKeyRequest":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name","description":"A label for this API key","examples":["My Trading Bot"]},"tier":{"type":"string","title":"Tier","description":"API tier: free, pro, or business","default":"free","examples":["free"]}},"type":"object","required":["name"],"title":"CreateApiKeyRequest","description":"Create a new API key for programmatic access."},"CsvExportRequest":{"properties":{"results":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Results","description":"Search results with follow-through data"}},"type":"object","required":["results"],"title":"CsvExportRequest"},"DailyBlogPost":{"properties":{"post_date":{"type":"string","title":"Post Date"},"slug":{"type":"string","title":"Slug"},"title":{"type":"string","title":"Title"},"body_md":{"type":"string","title":"Body Md"},"hero_symbol":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hero Symbol"},"hero_pred_1d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Hero Pred 1D"},"hero_actual_1d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Hero Actual 1D"},"n_picks":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N Picks"},"win_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Win Rate"},"avg_actual_1d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Actual 1D"}},"type":"object","required":["post_date","slug","title","body_md"],"title":"DailyBlogPost"},"DailyBlogPostList":{"properties":{"posts":{"items":{"$ref":"#/components/schemas/DailyBlogPost"},"type":"array","title":"Posts"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["posts","count"],"title":"DailyBlogPostList"},"DailyPick":{"properties":{"rank":{"type":"integer","title":"Rank"},"symbol":{"type":"string","title":"Symbol"},"date":{"type":"string","title":"Date"},"direction":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Direction","description":"Cohort majority direction over the 5-day forward horizon (bullish/bearish/neutral). Based on `up_count_5d`: ≥6 of 10 matches positive → bullish, ≤4 → bearish, else neutral. NOT the sign of `wpred_1d` — these can disagree when the 5d cohort majority went up but the 1d weighted-mean is negative. Use `wpred_1d / wpred_5d / wpred_10d` for horizon-specific weighted predictions."},"interest_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Interest Score"},"wpred_1d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Wpred 1D","description":"Weighted predicted 1d return computed from the top-K nightly cohort (default K=10)."},"wpred_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Wpred 5D"},"wpred_10d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Wpred 10D"},"n_matches":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N Matches","description":"Top-K sample size used for the nightly weighted prediction (typically 10). NOT the full cohort. For full-cohort statistics (default n=300) call POST /api/v1/cohort_analyze with this anchor, or use GET /api/v1/agent/setups for picks pre-enriched with full-cohort data."},"avg_distance":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Distance"},"summary_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary Text"},"sector":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sector"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Industry"},"cap_tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cap Tier"},"up_count_5d":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Up Count 5D"},"median_ret_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Median Ret 5D"},"ret_range_low":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ret Range Low"},"ret_range_high":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ret Range High"},"share_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Share Url"},"cohort_compatible":{"type":"boolean","title":"Cohort Compatible","description":"True when the (symbol, date) anchor exists in V5 embeddings, meaning POST /api/v1/cohort_analyze will return full results for this pick. After 2026-05-04, /api/v1/discover/picks filters to only return cohort_compatible picks, so this is always true.","default":true},"cohort":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Cohort","description":"Full-cohort outcome distribution (n=300) for this anchor. Populated when the endpoint is called with ?include_full_cohort=true. Shape matches AgentSetupCohort: n, win_rate/mean/median per 1d/5d/10d horizon, cohort_score, cohort_tightness_score. These are the calibrated stats the product is built around — the K=10 fields above (wpred_*, up_count_5d) are nearest-neighbor noise and should be considered secondary."}},"type":"object","required":["rank","symbol","date"],"title":"DailyPick"},"DailyPicksResponse":{"properties":{"date":{"type":"string","title":"Date"},"picks":{"items":{"$ref":"#/components/schemas/DailyPick"},"type":"array","title":"Picks"},"count":{"type":"integer","title":"Count"},"total_scanned":{"type":"integer","title":"Total Scanned","default":0}},"type":"object","required":["date","picks","count"],"title":"DailyPicksResponse"},"DecisionBriefAnchor":{"properties":{"symbol":{"type":"string","title":"Symbol"},"date":{"type":"string","title":"Date"},"timeframe":{"type":"string","title":"Timeframe","default":"1h"}},"type":"object","required":["symbol","date"],"title":"DecisionBriefAnchor"},"DecisionBriefOptions":{"properties":{"cohort_size":{"type":"integer","maximum":2000.0,"minimum":30.0,"title":"Cohort Size","default":300},"horizon_days":{"type":"integer","maximum":30.0,"minimum":1.0,"title":"Horizon Days","default":5},"include_memory":{"type":"boolean","title":"Include Memory","default":true},"include_narrative":{"type":"boolean","title":"Include Narrative","default":true}},"type":"object","title":"DecisionBriefOptions"},"DecisionBriefRequest":{"properties":{"anchor":{"$ref":"#/components/schemas/DecisionBriefAnchor"},"options":{"$ref":"#/components/schemas/DecisionBriefOptions"}},"type":"object","required":["anchor"],"title":"DecisionBriefRequest"},"EmailSettingsRequest":{"properties":{"briefing_enabled":{"type":"boolean","title":"Briefing Enabled"},"weekly_digest_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Weekly Digest Enabled"}},"type":"object","required":["briefing_enabled"],"title":"EmailSettingsRequest"},"EmbeddingResponse":{"properties":{"symbol":{"type":"string","title":"Symbol"},"date":{"type":"string","title":"Date"},"timeframe":{"type":"string","title":"Timeframe"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"embedding":{"items":{"type":"number"},"type":"array","title":"Embedding"}},"type":"object","required":["symbol","date","timeframe","embedding"],"title":"EmbeddingResponse"},"EventBadge":{"properties":{"label":{"type":"string","title":"Label","description":"Event label","examples":["FOMC Day"]},"color":{"type":"string","title":"Color","description":"Badge color","examples":["yellow"]},"icon":{"type":"string","title":"Icon","description":"Badge icon identifier","examples":["calendar"]}},"type":"object","required":["label","color","icon"],"title":"EventBadge","description":"An event context badge (FOMC meeting, earnings gap, etc)."},"FeedbackRequest":{"properties":{"message":{"type":"string","maxLength":2000,"title":"Message","description":"What happened? Error, unexpected result, or suggestion."},"endpoint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Endpoint","description":"Which endpoint (e.g., /api/v1/intelligence/NVDA)"},"symbol":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Symbol","description":"Ticker symbol if relevant"},"severity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Severity","description":"low, medium, high"},"agent_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Name","description":"Name of the agent or tool reporting this"}},"type":"object","required":["message"],"title":"FeedbackRequest"},"FollowThroughRequest":{"properties":{"results":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Results","description":"Search results from /search/text — each must have symbol, date, timeframe","examples":[[{"date":"2024-08-05","symbol":"MSFT","timeframe":"rth"}]]}},"type":"object","required":["results"],"title":"FollowThroughRequest","description":"Compute forward returns for a set of search results."},"FollowThroughResponse":{"properties":{"horizon_returns":{"additionalProperties":{"items":{"type":"number"},"type":"array"},"type":"object","title":"Horizon Returns","description":"Forward returns (%) at each horizon {1: [...], 3: [...], 5: [...], 10: [...]}","x-agent-hint":"Keys are days ahead (1, 3, 5, 10). Values are % returns from each match."},"all_paths":{"items":{"items":{"type":"number"},"type":"array"},"type":"array","title":"All Paths","description":"Cumulative % change paths from anchor price for each match"},"all_forward_bars":{"items":{"items":{"additionalProperties":true,"type":"object"},"type":"array"},"type":"array","title":"All Forward Bars","description":"Daily OHLC bars for the forward period of each match (days 1-10)","default":[]},"path_labels":{"items":{"type":"string"},"type":"array","title":"Path Labels","description":"Labels for each path (e.g. 'AAPL 2024-06-14')"},"is_premarket":{"type":"boolean","title":"Is Premarket","description":"Whether these results are from pre-market session"},"n_failed":{"type":"integer","title":"N Failed","description":"Number of matches where forward data was unavailable"},"distances":{"items":{"type":"number"},"type":"array","title":"Distances","description":"L2 distances for each match (aligned with all_paths)","default":[]},"weights":{"items":{"type":"number"},"type":"array","title":"Weights","description":"Normalized distance-based weights (aligned with all_paths, sum to 1)","default":[]},"weighted_stats":{"anyOf":[{"additionalProperties":{"additionalProperties":true,"type":"object"},"type":"object"},{"type":"null"}],"title":"Weighted Stats","description":"Distance-weighted stats per horizon (mean, median, win_rate weighted by similarity)"},"outcome_distribution":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Outcome Distribution","description":"Outcome distribution for 5-day forward returns: up_count, down_count, median_return, range_low, range_high, returns"}},"type":"object","required":["horizon_returns","all_paths","path_labels","is_premarket","n_failed"],"title":"FollowThroughResponse"},"ForgotPasswordRequest":{"properties":{"email":{"type":"string","title":"Email"}},"type":"object","required":["email"],"title":"ForgotPasswordRequest"},"GoogleAuthRequest":{"properties":{"credential":{"type":"string","title":"Credential"}},"type":"object","required":["credential"],"title":"GoogleAuthRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"IntelligenceResponse":{"properties":{"symbol":{"type":"string","title":"Symbol"},"date":{"type":"string","title":"Date"},"matches":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Matches"},"match_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Match Count"},"follow_through":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Follow Through"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"regime":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Regime"},"warnings":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Warnings"},"source":{"type":"string","title":"Source","default":"chartlibrary.io"}},"type":"object","required":["symbol","date"],"title":"IntelligenceResponse","description":"Single-call response with everything an AI agent needs about a symbol."},"LiveBar":{"properties":{"open":{"type":"number","title":"Open"},"high":{"type":"number","title":"High"},"low":{"type":"number","title":"Low"},"close":{"type":"number","title":"Close"},"volume":{"type":"number","title":"Volume"},"vwap":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Vwap"}},"type":"object","required":["open","high","low","close","volume"],"title":"LiveBar","description":"One OHLCV bar for /cohort/live. timestamp ignored — ordering\nwithin the array determines sequence."},"LoginRequest":{"properties":{"email":{"type":"string","title":"Email"},"password":{"type":"string","title":"Password"}},"type":"object","required":["email","password"],"title":"LoginRequest"},"MonthlySummaryResponse":{"properties":{"api_key_id":{"type":"integer","title":"Api Key Id"},"period_start":{"type":"string","title":"Period Start"},"period_end":{"type":"string","title":"Period End"},"query_count":{"type":"integer","title":"Query Count"},"first_request":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Request"},"last_request":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Request"}},"type":"object","required":["api_key_id","period_start","period_end","query_count","first_request","last_request"],"title":"MonthlySummaryResponse"},"PatternListRequest":{"properties":{"pattern_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pattern Type"},"symbol":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Symbol"},"start_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Date"},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End Date"},"min_confidence":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Min Confidence","default":0.0},"sort_by":{"type":"string","pattern":"^(date|confidence|fwd_return_5d)$","title":"Sort By","default":"date"},"sort_order":{"type":"string","pattern":"^(asc|desc)$","title":"Sort Order","default":"desc"},"limit":{"type":"integer","maximum":100.0,"minimum":1.0,"title":"Limit","default":24},"offset":{"type":"integer","minimum":0.0,"title":"Offset","default":0}},"type":"object","title":"PatternListRequest"},"PatternListResponse":{"properties":{"patterns":{"items":{"$ref":"#/components/schemas/PatternSummary"},"type":"array","title":"Patterns"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["patterns","total","limit","offset"],"title":"PatternListResponse"},"PatternSummary":{"properties":{"id":{"type":"integer","title":"Id"},"pattern_type":{"type":"string","title":"Pattern Type"},"symbol":{"type":"string","title":"Symbol"},"date":{"type":"string","title":"Date"},"timeframe":{"type":"string","title":"Timeframe"},"confidence":{"type":"number","title":"Confidence"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"},"fwd_return_1d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Fwd Return 1D"},"fwd_return_3d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Fwd Return 3D"},"fwd_return_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Fwd Return 5D"},"fwd_return_10d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Fwd Return 10D"},"embedding_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Embedding Id"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"}},"type":"object","required":["id","pattern_type","symbol","date","timeframe","confidence","metadata"],"title":"PatternSummary"},"PatternTypeStatsItem":{"properties":{"pattern_type":{"type":"string","title":"Pattern Type"},"count":{"type":"integer","title":"Count"},"avg_confidence":{"type":"number","title":"Avg Confidence"},"avg_return_1d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Return 1D"},"avg_return_3d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Return 3D"},"avg_return_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Return 5D"},"avg_return_10d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Return 10D"},"win_rate_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Win Rate 5D"},"recent_count_30d":{"type":"integer","title":"Recent Count 30D","default":0}},"type":"object","required":["pattern_type","count","avg_confidence"],"title":"PatternTypeStatsItem"},"PeerComparisonResponse":{"properties":{"symbol":{"type":"string","title":"Symbol"},"date":{"type":"string","title":"Date"},"sector":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sector","description":"GICS sector resolved for the query symbol"},"market_wide":{"additionalProperties":true,"type":"object","title":"Market Wide","description":"Stats when searching all 25M patterns"},"peers_only":{"additionalProperties":true,"type":"object","title":"Peers Only","description":"Stats when searching only same-sector matches"},"divergence":{"additionalProperties":true,"type":"object","title":"Divergence","description":"How the sector's reaction differs from market-wide"}},"type":"object","required":["symbol","date","market_wide","peers_only","divergence"],"title":"PeerComparisonResponse","description":"Side-by-side analysis: sector peers vs. market-wide for the same pattern."},"PortfolioAnalysisRequest":{"properties":{"symbols":{"items":{"type":"string"},"type":"array","maxItems":20,"minItems":1,"title":"Symbols","description":"List of ticker symbols"},"weights":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Weights","description":"Optional position weights (same order as symbols). If omitted, equal-weighted."},"date":{"type":"string","title":"Date","description":"Date (YYYY-MM-DD, defaults to most recent)","default":""},"include_correlation":{"type":"boolean","title":"Include Correlation","description":"Include pairwise correlation matrix + portfolio beta","default":true},"include_stress":{"type":"boolean","title":"Include Stress","description":"Include stress scenarios (SPY -3%, -5%, VIX spike)","default":true}},"type":"object","required":["symbols"],"title":"PortfolioAnalysisRequest","description":"Batch portfolio analysis request."},"PortfolioCohortRequest":{"properties":{"holdings":{"items":{"$ref":"#/components/schemas/PortfolioHolding"},"type":"array","maxItems":100,"minItems":1,"title":"Holdings"},"horizons":{"items":{"type":"integer"},"type":"array","title":"Horizons","default":[5,10]},"top_k_per_holding":{"type":"integer","maximum":1000.0,"minimum":50.0,"title":"Top K Per Holding","default":300},"include_path_stats":{"type":"boolean","title":"Include Path Stats","default":false}},"type":"object","required":["holdings"],"title":"PortfolioCohortRequest"},"PortfolioHolding":{"properties":{"symbol":{"type":"string","title":"Symbol","examples":["NVDA"]},"weight":{"type":"number","exclusiveMinimum":0.0,"title":"Weight","description":"Position weight (weights normalized to 1 internally)"},"date":{"type":"string","title":"Date","description":"Anchor date for this position's pattern","examples":["2026-04-10"]},"timeframe":{"type":"string","title":"Timeframe","default":"rth"}},"type":"object","required":["symbol","weight","date"],"title":"PortfolioHolding"},"RecentRecapPick":{"properties":{"symbol":{"type":"string","title":"Symbol"},"predicted":{"type":"number","title":"Predicted"},"actual":{"type":"number","title":"Actual"}},"type":"object","required":["symbol","predicted","actual"],"title":"RecentRecapPick"},"RecentRecapResponse":{"properties":{"test_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Test Date"},"n_picks":{"type":"integer","title":"N Picks","default":0},"avg_actual_1d":{"type":"number","title":"Avg Actual 1D","default":0.0},"win_rate":{"type":"number","title":"Win Rate","default":0.0},"best_pick":{"anyOf":[{"$ref":"#/components/schemas/RecentRecapPick"},{"type":"null"}]},"worst_pick":{"anyOf":[{"$ref":"#/components/schemas/RecentRecapPick"},{"type":"null"}]}},"type":"object","title":"RecentRecapResponse"},"RefreshRequest":{"properties":{"refresh_token":{"type":"string","title":"Refresh Token"}},"type":"object","required":["refresh_token"],"title":"RefreshRequest"},"RegimeMatch":{"properties":{"rank":{"type":"integer","title":"Rank"},"match_start":{"type":"string","title":"Match Start"},"match_end":{"type":"string","title":"Match End"},"distance":{"type":"number","title":"Distance"},"match_change_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Match Change Pct"},"next_10d_return":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Next 10D Return"},"next_20d_return":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Next 20D Return"},"next_30d_return":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Next 30D Return"},"max_drawdown":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max Drawdown"},"match_pct_series":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Match Pct Series"},"follow_through_series":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Follow Through Series"}},"type":"object","required":["rank","match_start","match_end","distance"],"title":"RegimeMatch"},"RegimeTrackerResponse":{"properties":{"symbol":{"type":"string","title":"Symbol"},"run_date":{"type":"string","title":"Run Date"},"query_start":{"type":"string","title":"Query Start"},"query_end":{"type":"string","title":"Query End"},"query_change_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Query Change Pct"},"query_pct_series":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Query Pct Series"},"matches":{"items":{"$ref":"#/components/schemas/RegimeMatch"},"type":"array","title":"Matches"},"n_matches":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N Matches"},"avg_10d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg 10D"},"avg_20d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg 20D"},"avg_30d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg 30D"},"median_10d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Median 10D"},"median_20d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Median 20D"},"median_30d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Median 30D"},"pos_count_10d":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Pos Count 10D"},"pos_count_20d":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Pos Count 20D"},"pos_count_30d":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Pos Count 30D"},"min_10d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min 10D"},"max_10d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max 10D"},"baseline_10d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Baseline 10D"},"baseline_20d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Baseline 20D"},"baseline_30d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Baseline 30D"},"year_distribution":{"anyOf":[{"additionalProperties":{"type":"integer"},"type":"object"},{"type":"null"}],"title":"Year Distribution"},"month_distribution":{"anyOf":[{"additionalProperties":{"type":"integer"},"type":"object"},{"type":"null"}],"title":"Month Distribution"},"total_windows":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total Windows"},"summary_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary Text"}},"type":"object","required":["symbol","run_date","query_start","query_end","matches"],"title":"RegimeTrackerResponse"},"ResendVerificationRequest":{"properties":{"email":{"type":"string","title":"Email"}},"type":"object","required":["email"],"title":"ResendVerificationRequest"},"ResetPasswordRequest":{"properties":{"token":{"type":"string","title":"Token"},"new_password":{"type":"string","title":"New Password"}},"type":"object","required":["token","new_password"],"title":"ResetPasswordRequest"},"SavePatternRequest":{"properties":{"query_label":{"type":"string","title":"Query Label","description":"Display label for the saved pattern","examples":["AAPL 2024-06-15"]},"symbol":{"type":"string","title":"Symbol","description":"Ticker symbol","examples":["AAPL"]},"date":{"type":"string","title":"Date","description":"Date of the pattern (YYYY-MM-DD)","examples":["2024-06-15"]},"timeframe":{"type":"string","title":"Timeframe","description":"Timeframe","default":"rth","examples":["rth"]},"notes":{"type":"string","title":"Notes","description":"Optional notes","default":""},"embedding":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Embedding","description":"384-dim embedding vector (from query_embedding in search response)"},"results":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Results","description":"Search results to save with the pattern"},"summary_text":{"type":"string","title":"Summary Text","description":"AI summary text","default":""}},"type":"object","required":["query_label","symbol","date"],"title":"SavePatternRequest","description":"Save a chart pattern search for later reference."},"ScenarioRequest":{"properties":{"symbol":{"type":"string","title":"Symbol","description":"Ticker symbol to analyze"},"market_move_pct":{"type":"number","title":"Market Move Pct","description":"SPY move to simulate, e.g. -3.0"},"horizon_days":{"type":"integer","maximum":20.0,"minimum":1.0,"title":"Horizon Days","description":"Forward horizon in trading days","default":5}},"type":"object","required":["symbol","market_move_pct"],"title":"ScenarioRequest"},"SearchResponse":{"properties":{"query":{"additionalProperties":true,"type":"object","title":"Query","description":"Echo of the original query parameters"},"results":{"items":{"$ref":"#/components/schemas/SimilarDay"},"type":"array","title":"Results","description":"Top matching historical patterns, sorted by similarity"},"count":{"type":"integer","title":"Count","description":"Number of results returned"},"timeframe":{"type":"string","title":"Timeframe","description":"Timeframe used for the search"},"extraction_info":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Extraction Info","description":"Reserved; legacy field, always null on text-only search."},"query_embedding":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Query Embedding","description":"384-dim query embedding (for creating alerts)"},"share_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Share Url","description":"Shareable link to reproduce this search on chartlibrary.io"}},"type":"object","required":["query","results","count","timeframe"],"title":"SearchResponse"},"ShareCardRequest":{"properties":{"query_label":{"type":"string","title":"Query Label"},"horizon_returns":{"additionalProperties":{"items":{"type":"number"},"type":"array"},"type":"object","title":"Horizon Returns"},"all_paths":{"items":{"items":{"type":"number"},"type":"array"},"type":"array","title":"All Paths"},"path_labels":{"items":{"type":"string"},"type":"array","title":"Path Labels"},"summary_text":{"type":"string","title":"Summary Text","default":""}},"type":"object","required":["query_label","horizon_returns","all_paths","path_labels"],"title":"ShareCardRequest"},"SignupRequest":{"properties":{"email":{"type":"string","title":"Email","description":"Email address","examples":["trader@example.com"]},"password":{"type":"string","title":"Password","description":"Password (min 8 chars, must include uppercase, lowercase, and a number)"},"referral_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Referral Code","description":"Optional referral code from another user"}},"type":"object","required":["email","password"],"title":"SignupRequest","description":"Create a new user account."},"SimilarDay":{"properties":{"symbol":{"type":"string","title":"Symbol","description":"Ticker symbol (e.g. AAPL)","examples":["MSFT"]},"date":{"type":"string","title":"Date","description":"Date of the matching pattern (YYYY-MM-DD)","examples":["2024-08-05"]},"timeframe":{"type":"string","title":"Timeframe","description":"Session: rth, premarket, rth_3d, rth_5d, rth_10d","examples":["rth"]},"similarity":{"type":"number","title":"Similarity","description":"L2 distance (lower = more similar). < 10 excellent, 10-25 good, > 50 weak","examples":[4.23],"x-agent-hint":"Lower is better. < 10 = excellent match."},"match_score":{"type":"number","title":"Match Score","description":"0-100 score (higher = better match). Derived from L2 distance.","default":0.0,"examples":[92.1],"x-agent-hint":"Higher is better. > 90 = excellent."},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata","description":"Additional metadata (end_date for multi-day windows, sector, cap_tier)"},"share_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Share Url","description":"Shareable link to view this pattern on chartlibrary.io"}},"type":"object","required":["symbol","date","timeframe","similarity"],"title":"SimilarDay","description":"A single matching historical chart pattern."},"SimulateRequest":{"properties":{"all_paths":{"items":{"items":{"type":"number"},"type":"array"},"type":"array","title":"All Paths","description":"Cumulative % change paths from follow-through endpoint"},"stop_loss_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Stop Loss Pct","description":"Stop loss as a positive percentage (e.g. 5.0 = -5%)","examples":[5.0]},"profit_target_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Profit Target Pct","description":"Profit target as a percentage (e.g. 10.0 = +10%)","examples":[10.0]},"hold_days":{"type":"integer","title":"Hold Days","description":"Maximum hold period in trading days","default":10,"examples":[10]}},"type":"object","required":["all_paths"],"title":"SimulateRequest","description":"Run a trade simulation with stop loss, profit target, and hold period."},"StatsRequest":{"properties":{"horizon_returns":{"additionalProperties":{"items":{"type":"number"},"type":"array"},"type":"object","title":"Horizon Returns"}},"type":"object","required":["horizon_returns"],"title":"StatsRequest"},"StatusResponse":{"properties":{"total_embeddings":{"type":"integer","title":"Total Embeddings"},"minute_pairs_done":{"type":"integer","title":"Minute Pairs Done"},"embeddings_per_pair":{"type":"number","title":"Embeddings Per Pair"},"date_range":{"items":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":"array","title":"Date Range"},"distinct_symbols":{"type":"integer","title":"Distinct Symbols"}},"type":"object","required":["total_embeddings","minute_pairs_done","embeddings_per_pair","date_range","distinct_symbols"],"title":"StatusResponse"},"StrategyBacktestRequest":{"properties":{"horizon":{"type":"integer","title":"Horizon","description":"1, 5, or 10","default":5},"conditions":{"items":{"$ref":"#/components/schemas/BacktestCondition"},"type":"array","title":"Conditions"},"start_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Date"},"end_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End Date"}},"type":"object","title":"StrategyBacktestRequest"},"SubscribeRequest":{"properties":{"email":{"type":"string","title":"Email"}},"type":"object","required":["email"],"title":"SubscribeRequest"},"SummaryRequest":{"properties":{"query_label":{"type":"string","title":"Query Label","description":"Label for the query (e.g. 'AAPL 2024-06-15')","examples":["AAPL 2024-06-15"]},"n_matches":{"type":"integer","title":"N Matches","description":"Number of matches found","examples":[10]},"horizon_returns":{"additionalProperties":{"items":{"type":"number"},"type":"array"},"type":"object","title":"Horizon Returns","description":"Forward returns per horizon from follow-through endpoint"},"weighted_stats":{"anyOf":[{"additionalProperties":{"additionalProperties":true,"type":"object"},"type":"object"},{"type":"null"}],"title":"Weighted Stats","description":"Distance-weighted stats from follow-through endpoint"}},"type":"object","required":["query_label","n_matches","horizon_returns"],"title":"SummaryRequest","description":"Request an AI-generated plain English summary of pattern analysis results."},"SummaryResponse":{"properties":{"summary":{"type":"string","title":"Summary","description":"Claude Haiku generated 2-3 sentence summary of the pattern and what it suggests"}},"type":"object","required":["summary"],"title":"SummaryResponse","description":"AI-generated plain English pattern summary."},"TextSearchRequest":{"properties":{"query":{"type":"string","title":"Query","description":"Symbol + date query string","examples":["AAPL 2024-06-15","TSLA 6/15/24 3d"]},"timeframe":{"type":"string","title":"Timeframe","description":"rth, premarket, rth_3d, rth_5d, rth_10d, or auto","default":"auto","examples":["rth"]},"top_n":{"type":"integer","maximum":50.0,"minimum":1.0,"title":"Top N","description":"Number of similar patterns to return","default":10,"examples":[10]},"context_weight":{"type":"number","maximum":1.0,"minimum":0.0,"title":"Context Weight","description":"Context re-ranking weight: 0 = shape only, 0.05 = recommended","default":0.0},"sector":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sector","description":"Filter results by sector (e.g. 'Manufacturing', 'Services')","examples":["Manufacturing"]},"min_market_cap":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Min Market Cap","description":"Minimum market cap in dollars (e.g. 1e9 for >$1B)","examples":[1000000000.0]},"max_market_cap":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max Market Cap","description":"Maximum market cap in dollars","examples":[200000000000.0]},"exclude_etps":{"type":"boolean","title":"Exclude Etps","description":"Exclude ETFs and ETNs from results","default":false}},"type":"object","required":["query"],"title":"TextSearchRequest","description":"Search for similar chart patterns by symbol + date text query."},"TickerPatternResponse":{"properties":{"symbol":{"type":"string","title":"Symbol"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"sector":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sector"},"cap_tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cap Tier"},"market_cap":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Market Cap"},"sic_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sic Description"},"latest_pattern_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Latest Pattern Date"},"latest_embedding_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Latest Embedding Date"},"summary_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary Text"},"direction":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Direction"},"interest_score":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Interest Score"},"wpred_1d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Wpred 1D"},"wpred_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Wpred 5D"},"wpred_10d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Wpred 10D"},"n_matches":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N Matches"},"up_count_5d":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Up Count 5D"},"median_ret_5d":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Median Ret 5D"},"ret_range_low":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ret Range Low"},"ret_range_high":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Ret Range High"},"found":{"type":"boolean","title":"Found","default":true}},"type":"object","required":["symbol"],"title":"TickerPatternResponse"},"UsageStatsResponse":{"properties":{"period_days":{"type":"integer","title":"Period Days"},"total_requests":{"type":"integer","title":"Total Requests"},"avg_latency_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Latency Ms"},"error_count":{"type":"integer","title":"Error Count"},"error_rate":{"type":"number","title":"Error Rate"},"daily_breakdown":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Daily Breakdown"},"top_endpoints":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Top Endpoints"}},"type":"object","required":["period_days","total_requests","avg_latency_ms","error_count","error_rate","daily_breakdown","top_endpoints"],"title":"UsageStatsResponse"},"UserIntentRequest":{"properties":{"role":{"type":"string","title":"Role"},"use_case":{"type":"string","title":"Use Case"}},"type":"object","required":["role","use_case"],"title":"UserIntentRequest"},"V2AnalyzeRequest":{"properties":{"cohort_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cohort Id"},"symbol":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Symbol"},"date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date"},"metric":{"type":"string","title":"Metric","description":"One of: \"anomaly\", \"volume_profile\", \"crowding\", \"correlation_shift\", \"earnings_reaction\", \"pattern_degradation\"","examples":["anomaly","earnings_reaction"]},"extra_args":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Extra Args"}},"type":"object","required":["metric"],"title":"V2AnalyzeRequest","description":"v2 primitive #3 — analytic metrics on a cohort or (symbol, date)."},"V2CohortRequest":{"properties":{"cohort_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cohort Id"},"query":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Query"},"filters":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Filters"},"horizons":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Horizons"},"top_k":{"type":"integer","maximum":2000.0,"minimum":10.0,"title":"Top K","default":500},"include_path_stats":{"type":"boolean","title":"Include Path Stats","default":true}},"type":"object","title":"V2CohortRequest","description":"v2 primitive #2 — conditional distribution for a cohort. Supply\nEITHER a cohort_id (refine stored) OR a query (build fresh)."},"V2ContextRequest":{"properties":{"target":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"}],"title":"Target","description":"Ticker 'NVDA' | 'market' | 'system' | {symbol,date}","examples":["NVDA","market","system",{"date":"2024-06-18","symbol":"NVDA"}]}},"type":"object","required":["target"],"title":"V2ContextRequest","description":"v2 primitive #4 — situational data about a target."},"V2ExplainRequest":{"properties":{"cohort_id":{"type":"string","title":"Cohort Id"},"style":{"type":"string","title":"Style","description":"'filter_ranking' ranks candidate filters by distribution shift; 'prose' returns an AI-generated plain-English summary.","default":"filter_ranking","examples":["filter_ranking","prose"]},"horizon":{"type":"integer","title":"Horizon","default":5}},"type":"object","required":["cohort_id"],"title":"V2ExplainRequest","description":"v2 primitive #5 — narrative + filter-importance for a stored cohort."},"V2PortfolioHolding":{"properties":{"symbol":{"type":"string","title":"Symbol"},"weight":{"type":"number","exclusiveMinimum":0.0,"title":"Weight"},"date":{"type":"string","title":"Date"}},"type":"object","required":["symbol","weight","date"],"title":"V2PortfolioHolding"},"V2PortfolioRequest":{"properties":{"holdings":{"items":{"$ref":"#/components/schemas/V2PortfolioHolding"},"type":"array","maxItems":100,"minItems":1,"title":"Holdings"},"horizons":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Horizons"},"top_k_per_holding":{"type":"integer","title":"Top K Per Holding","default":300},"include_path_stats":{"type":"boolean","title":"Include Path Stats","default":false}},"type":"object","required":["holdings"],"title":"V2PortfolioRequest","description":"v2 primitive #6 — portfolio-level conditional distribution."},"V2SearchRequest":{"properties":{"query":{"anyOf":[{"type":"string"},{"additionalProperties":true,"type":"object"}],"title":"Query","description":"'SYMBOL YYYY-MM-DD [timeframe]' string OR {symbol, date, timeframe} dict","examples":["NVDA 2024-06-18"]},"top_k":{"type":"integer","maximum":2000.0,"minimum":10.0,"title":"Top K","default":500}},"type":"object","required":["query"],"title":"V2SearchRequest","description":"v2 primitive #1 — entry point. Returns cohort_id + n_matches."},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VectorQuery":{"properties":{"vector":{"items":{"type":"number"},"type":"array","title":"Vector"},"top_n":{"type":"integer","title":"Top N","default":10}},"type":"object","required":["vector"],"title":"VectorQuery"},"api__CohortLiveRequest__1":{"properties":{"symbol":{"type":"string","title":"Symbol","description":"Stock ticker, e.g. NVDA. Case-insensitive."},"scale":{"type":"string","title":"Scale","description":"Bar resolution. One of '5m', '15m', '30m', '1h', '1d'. Lower scales react faster intraday; higher scales smooth.","default":"5m"},"cohort_size":{"type":"integer","maximum":1000.0,"minimum":30.0,"title":"Cohort Size","default":300},"horizons":{"items":{"type":"integer"},"type":"array","title":"Horizons","default":[1,5,10]},"include_cohort_anchors":{"type":"boolean","title":"Include Cohort Anchors","description":"Return up to 50 nearest historical analogs (symbol, date, similarity, forward returns) alongside the distribution.","default":true},"include_modes":{"type":"boolean","title":"Include Modes","description":"Cluster the cohort's forward-bar trajectories into N outcome modes ('steady up', 'chop', 'reversal', ...). Returns per-mode count + return stats + algorithmic label under `modes`. The playbook surface.","default":false},"n_modes":{"type":"integer","maximum":8.0,"minimum":2.0,"title":"N Modes","default":4}},"type":"object","required":["symbol"],"title":"CohortLiveRequest"},"api__CohortLiveRequest__2":{"properties":{"bars":{"items":{"$ref":"#/components/schemas/LiveBar"},"type":"array","title":"Bars","description":"OHLCV bars forming the query window. Minimum 405 bars required (384 for the V5 window + ~21 for z-score warmup). Volume and vwap required. Order must be chronological."},"scale":{"type":"string","title":"Scale","description":"Target V5 scale: 5m / 15m / 30m / 1h","default":"1h","examples":["1h"]},"top_k":{"type":"integer","maximum":500.0,"minimum":1.0,"title":"Top K","description":"Number of nearest historical matches to return.","default":50},"cross_timeframe":{"type":"boolean","title":"Cross Timeframe","description":"If true, matches may span any V5 scale, not just the query's.","default":false}},"type":"object","required":["bars"],"title":"CohortLiveRequest"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}},"tags":[{"name":"Search","description":"Find similar historical chart patterns by text query (symbol + date) or natural-language anchor."},{"name":"Follow-Through","description":"Compute forward returns and statistics for search results. Call after every search to see what happened next."},{"name":"Discover","description":"Daily picks — top chart patterns ranked by interest score with AI summaries."},{"name":"Portfolio","description":"Track holdings with nightly pattern analysis and daily email briefings."},{"name":"Alerts","description":"Save pattern embeddings and get notified when similar patterns appear in the market."},{"name":"API Keys","description":"Create, list, and revoke API keys for programmatic access. Manage usage and billing."},{"name":"Billing","description":"Stripe integration — subscriptions, credit packs, and customer portal."},{"name":"Auth","description":"User authentication — signup, login, Google OAuth, and token refresh."},{"name":"Status","description":"System health, embedding pipeline stats, and data freshness checks."},{"name":"Pattern Library","description":"Browse detected chart patterns (breakout, bull flag, ascending wedge) with confidence scoring and forward returns."},{"name":"Market Data","description":"Raw intraday minute bar data for charting and analysis."},{"name":"Regime","description":"Market regime classification — VIX, yield curve, and sector rotation context."},{"name":"Track Record","description":"Strategy performance, accuracy metrics, and historical outcome records."},{"name":"Saved Patterns","description":"Save and manage pattern searches for later reference."},{"name":"Competition","description":"AI agent competition — compare strategy performance across automated agents."}]}