{"openapi":"3.1.0","info":{"title":"Quant Data API","version":"3.1.0","description":"Public, read-only v1 API for normalized daily raw OHLCV data. Messages can be localized; field names and error codes remain stable. Data may be delayed or incomplete. Not investment advice.","contact":{"name":"Quant Data","url":"https://github.com/McGeeLee/Quant-Data"}},"servers":[{"url":"https://quant-data.mcgeelee.workers.dev","description":"Production"}],"externalDocs":{"description":"English API and MCP documentation","url":"https://quant-data.mcgeelee.workers.dev/docs/en"},"security":[],"tags":[{"name":"Service","description":"Health and API discovery"},{"name":"Market data","description":"Read-only normalized market data"}],"components":{"schemas":{},"parameters":{}},"paths":{"/healthz":{"get":{"operationId":"getHealth","tags":["Service"],"summary":"Get service and deployment health","description":"Returns process-level health without probing upstream providers or revealing secret configuration.","responses":{"200":{"description":"Service is accepting requests","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"service":{"type":"string","enum":["quant-data"]},"version":{"type":"string"},"deployment":{"type":"object","properties":{"id":{"type":"string"},"tag":{"type":"string"},"timestamp":{"type":"string","format":"date-time"}},"required":["id","tag","timestamp"]}},"required":["status","service","version","deployment"]}}}}}}},"/api/v1":{"get":{"operationId":"discoverApi","tags":["Service"],"summary":"Discover the public API","description":"Stable entry point for clients to discover contracts, documentation, MCP transport, and v1 constraints.","parameters":[{"schema":{"type":"string","enum":["en","zh-CN"]},"required":false,"name":"lang","in":"query"}],"responses":{"200":{"description":"API discovery document","content":{"application/json":{"schema":{"type":"object","properties":{"service":{"type":"string","enum":["quant-data"]},"apiVersion":{"type":"string","enum":["v1"]},"authentication":{"type":"string","enum":["none"]},"links":{"type":"object","properties":{"openapi":{"type":"string","format":"uri"},"documentation":{"type":"object","properties":{"en":{"type":"string","format":"uri"},"zh-CN":{"type":"string","format":"uri"}},"required":["en","zh-CN"]},"mcp":{"type":"string","format":"uri"}},"required":["openapi","documentation","mcp"]},"endpoints":{"type":"array","items":{"type":"object","properties":{"method":{"type":"string","enum":["GET"]},"path":{"type":"string"},"operationId":{"type":"string"}},"required":["method","path","operationId"]}},"constraints":{"type":"object","properties":{"interval":{"type":"string","enum":["1d"]},"adjustment":{"type":"string","enum":["raw"]},"maximumYears":{"type":"number","enum":[5]},"maximumBars":{"type":"number","enum":[2000]}},"required":["interval","adjustment","maximumYears","maximumBars"]},"disclaimer":{"type":"string"}},"required":["service","apiVersion","authentication","links","endpoints","constraints","disclaimer"]}}}}}}},"/api/v1/sources":{"get":{"operationId":"listDataSources","tags":["Market data"],"summary":"List market data sources and configuration status","description":"Reports source availability without exposing credentials. Includes provider-native symbol examples, stability warnings, and attribution.","parameters":[{"schema":{"type":"string","enum":["en","zh-CN"]},"required":false,"name":"lang","in":"query"}],"responses":{"200":{"description":"Source status","content":{"application/json":{"schema":{"type":"object","properties":{"sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["yahoo","tushare","tiingo"]},"name":{"type":"string"},"configured":{"type":"boolean"},"official":{"type":"boolean"},"markets":{"type":"array","items":{"type":"string"}},"symbolExamples":{"type":"array","items":{"type":"string"}},"attribution":{"type":"string"},"warnings":{"type":"array","items":{"type":"string"}}},"required":["id","name","configured","official","markets","symbolExamples","warnings"]}},"disclaimer":{"type":"string"}},"required":["sources","disclaimer"]}}}}}}},"/api/v1/market-data":{"get":{"operationId":"getMarketData","tags":["Market data"],"summary":"Get normalized, daily, unadjusted OHLCV bars","description":"Returns provider-native, unadjusted daily bars in ascending date order. Start and end dates are inclusive. Defaults to the most recent year; ranges are limited to five years and 2,000 bars.","parameters":[{"schema":{"type":"string","enum":["yahoo","tushare","tiingo"],"example":"yahoo"},"required":true,"name":"source","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":40,"example":"AAPL"},"required":true,"name":"symbol","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2025-01-01"},"required":false,"name":"start","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2025-12-31"},"required":false,"name":"end","in":"query"},{"schema":{"type":"string","enum":["en","zh-CN"],"example":"en"},"required":false,"name":"lang","in":"query"}],"responses":{"200":{"description":"Market data","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"type":"object","properties":{"source":{"type":"string","enum":["yahoo","tushare","tiingo"]},"symbol":{"type":"string"},"interval":{"type":"string","enum":["1d"]},"adjustment":{"type":"string","enum":["raw"]},"volumeUnit":{"type":"string"},"count":{"type":"integer","minimum":0},"fetchedAt":{"type":"string","format":"date-time"},"truncated":{"type":"boolean"},"attribution":{"type":"string"},"warnings":{"type":"array","items":{"type":"string"}}},"required":["source","symbol","interval","adjustment","volumeUnit","count","fetchedAt","truncated","warnings"]},"bars":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"open":{"type":"number"},"high":{"type":"number"},"low":{"type":"number"},"close":{"type":"number"},"volume":{"type":["number","null"],"minimum":0}},"required":["date","open","high","low","close","volume"]}}},"required":["meta","bars"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"No data found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}},"405":{"description":"Method not allowed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}},"502":{"description":"Upstream failure","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}},"503":{"description":"Source unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}},"504":{"description":"Upstream timeout","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/api/v1/snapshot":{"get":{"operationId":"getMarketSnapshot","tags":["Market data"],"summary":"Get the latest bar and previous-close change metrics","description":"Returns the last available daily close and its change from the preceding returned trading day. A null previousClose means only one bar was available.","parameters":[{"schema":{"type":"string","enum":["yahoo","tushare","tiingo"],"example":"yahoo"},"required":true,"name":"source","in":"query"},{"schema":{"type":"string","minLength":1,"maxLength":40,"example":"AAPL"},"required":true,"name":"symbol","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2025-01-01"},"required":false,"name":"start","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","example":"2025-12-31"},"required":false,"name":"end","in":"query"},{"schema":{"type":"string","enum":["en","zh-CN"],"example":"en"},"required":false,"name":"lang","in":"query"}],"responses":{"200":{"description":"Market snapshot","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"type":"object","properties":{"source":{"type":"string","enum":["yahoo","tushare","tiingo"]},"symbol":{"type":"string"},"interval":{"type":"string","enum":["1d"]},"adjustment":{"type":"string","enum":["raw"]},"volumeUnit":{"type":"string"},"count":{"type":"integer","minimum":0},"fetchedAt":{"type":"string","format":"date-time"},"truncated":{"type":"boolean"},"attribution":{"type":"string"},"warnings":{"type":"array","items":{"type":"string"}}},"required":["source","symbol","interval","adjustment","volumeUnit","count","fetchedAt","truncated","warnings"]},"snapshot":{"type":"object","properties":{"date":{"type":"string"},"close":{"type":"number"},"previousClose":{"type":["number","null"]},"change":{"type":["number","null"]},"changePercent":{"type":["number","null"]},"volume":{"type":["number","null"]}},"required":["date","close","previousClose","change","changePercent","volume"]}},"required":["meta","snapshot"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"No data found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}},"405":{"description":"Method not allowed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}},"502":{"description":"Upstream failure","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}},"503":{"description":"Source unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}},"504":{"description":"Upstream timeout","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{},"requestId":{"type":"string"}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}}},"webhooks":{}}