openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: API specification servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: btc description: BTC probability analysis paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check description: Returns server health status responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /btc/snapshot: get: operationId: getBtcSnapshot tags: [btc] summary: Get current BTC market snapshot description: Fetches live market data from Binance and computes all features responses: "200": description: Current market snapshot content: application/json: schema: $ref: "#/components/schemas/MarketSnapshot" "503": description: Binance API unavailable content: application/json: schema: $ref: "#/components/schemas/ApiError" /btc/analysis: get: operationId: getBtcAnalysis tags: [btc] summary: Get probability analysis for a price target parameters: - in: query name: priceToBeat required: true schema: type: number description: The target price to evaluate (e.g. from Polymarket) responses: "200": description: Probability analysis result content: application/json: schema: $ref: "#/components/schemas/AnalysisResult" "400": description: Invalid parameters content: application/json: schema: $ref: "#/components/schemas/ApiError" "503": description: Binance API unavailable content: application/json: schema: $ref: "#/components/schemas/ApiError" /btc/estimates: get: operationId: listEstimates tags: [btc] summary: List historical probability estimates parameters: - in: query name: limit schema: type: integer default: 50 - in: query name: offset schema: type: integer default: 0 responses: "200": description: List of estimates content: application/json: schema: $ref: "#/components/schemas/EstimateListResponse" post: operationId: saveEstimate tags: [btc] summary: Save a probability estimate to history requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/EstimateInput" responses: "201": description: Estimate saved content: application/json: schema: $ref: "#/components/schemas/EstimateSaveResult" /btc/accuracy: get: operationId: getAccuracyStats tags: [btc] summary: Get model accuracy statistics responses: "200": description: Accuracy stats content: application/json: schema: $ref: "#/components/schemas/AccuracyStats" components: schemas: HealthStatus: type: object properties: status: type: string required: - status ApiError: type: object properties: error: type: string required: - error Signal: type: object properties: name: type: string vote: type: number rationale: type: string weight: type: number available: type: boolean required: - name - vote - rationale - weight - available MarketFeatures: type: object properties: timestamp: type: number currentPrice: type: number nullable: true markPrice: type: number nullable: true indexPrice: type: number nullable: true basis: type: number nullable: true momentum1m: type: number nullable: true momentum3m: type: number nullable: true momentum5m: type: number nullable: true vwap: type: number nullable: true distanceFromVwap: type: number nullable: true volumeCurrent: type: number nullable: true relativeVolume: type: number nullable: true volume24h: type: number nullable: true priceChangePct24h: type: number nullable: true realizedVolatilityPerMin: type: number nullable: true expectedMove5m: type: number nullable: true atr: type: number nullable: true openInterest: type: number nullable: true openInterestChangePct: type: number nullable: true fundingRate: type: number nullable: true buyVolume: type: number nullable: true sellVolume: type: number nullable: true orderFlowImbalance: type: number nullable: true longLiquidationsUsd: type: number nullable: true shortLiquidationsUsd: type: number nullable: true liquidationImbalance: type: number nullable: true liquidationDataAvailable: type: boolean marketSession: type: string timeOfDay: type: string dataCompleteness: type: number required: - timestamp - liquidationDataAvailable - marketSession - timeOfDay - dataCompleteness MarketSnapshot: type: object properties: features: $ref: "#/components/schemas/MarketFeatures" fetchedAt: type: number required: - features - fetchedAt AnalysisResult: type: object properties: features: $ref: "#/components/schemas/MarketFeatures" currentPrice: type: number priceToBeat: type: number distance: type: number distancePct: type: number nullable: true baselineProbAbove: type: number evidenceAdjustment: type: number probAbove: type: number probBelow: type: number netEvidenceScore: type: number agreementRatio: type: number confidence: type: string bullishEvidence: type: array items: type: string bearishEvidence: type: array items: type: string neutralObservations: type: array items: type: string explanation: type: string signals: type: array items: $ref: "#/components/schemas/Signal" fetchedAt: type: number required: - features - currentPrice - priceToBeat - distance - baselineProbAbove - evidenceAdjustment - probAbove - probBelow - netEvidenceScore - agreementRatio - confidence - bullishEvidence - bearishEvidence - neutralObservations - explanation - signals - fetchedAt EstimateRecord: type: object properties: id: type: integer createdAt: type: number resolveAt: type: number priceToBeat: type: number currentPrice: type: number probAbove: type: number probBelow: type: number confidence: type: string netEvidenceScore: type: number nullable: true baselineProbAbove: type: number nullable: true explanation: type: string nullable: true outcomePrice: type: number nullable: true wasAbove: type: integer nullable: true outcomeRecordedAt: type: number nullable: true required: - id - createdAt - resolveAt - priceToBeat - currentPrice - probAbove - probBelow - confidence EstimateListResponse: type: object properties: estimates: type: array items: $ref: "#/components/schemas/EstimateRecord" total: type: integer required: - estimates - total EstimateInput: type: object properties: priceToBeat: type: number currentPrice: type: number probAbove: type: number probBelow: type: number confidence: type: string netEvidenceScore: type: number baselineProbAbove: type: number featuresJson: type: string description: JSON-serialized features object signalsJson: type: string description: JSON-serialized signals array explanation: type: string required: - priceToBeat - currentPrice - probAbove - probBelow - confidence EstimateSaveResult: type: object properties: id: type: integer required: - id AccuracyStats: type: object properties: n: type: integer brierScore: type: number nullable: true directionalAccuracy: type: number nullable: true required: - n