{
 "openapi": "3.1.0",
 "info": {
  "title": "HowMuchCouldIEarn public data API",
  "version": "1.0.0",
  "description": "Read-only historical answers for monthly investing (DCA) in Bitcoin, Ethereum, the S&P 500, Nasdaq 100, gold and the Magnificent 7. Month-end closes from Yahoo Finance, refreshed monthly; price returns in US dollars, no dividends, fees or taxes. Free to use with attribution and a link. Not investment advice.",
  "contact": {
   "url": "https://www.howmuchcouldiearn.com/en/contact"
  },
  "license": {
   "name": "CC BY 4.0",
   "url": "https://creativecommons.org/licenses/by/4.0/"
  }
 },
 "servers": [
  {
   "url": "https://www.howmuchcouldiearn.com"
  }
 ],
 "paths": {
  "/api/v1/assets": {
   "get": {
    "operationId": "listAssets",
    "summary": "The twelve assets and their first month of data",
    "responses": {
     "200": {
      "description": "Assets"
     }
    }
   }
  },
  "/api/v1/dca": {
   "get": {
    "operationId": "dcaPlan",
    "summary": "What a fixed monthly amount became",
    "parameters": [
     {
      "name": "asset",
      "in": "query",
      "required": true,
      "description": "Asset id, symbol or ticker",
      "schema": {
       "type": "string",
       "enum": [
        "bitcoin",
        "ethereum",
        "sp500",
        "nasdaq-100",
        "gold",
        "apple",
        "microsoft",
        "nvidia",
        "amazon",
        "alphabet",
        "meta",
        "tesla"
       ]
      }
     },
     {
      "name": "amount",
      "in": "query",
      "required": false,
      "description": "US dollars invested every month (default 100)",
      "schema": {
       "type": "number",
       "minimum": 1,
       "maximum": 1000000
      }
     },
     {
      "name": "start",
      "in": "query",
      "required": false,
      "description": "First purchase month, YYYY-MM (default 2020-01)",
      "schema": {
       "type": "string",
       "pattern": "^\\d{4}-\\d{2}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Invested, value now, multiple, money-weighted annual return and the same plan in the S&P 500"
     },
     "400": {
      "description": "Bad input"
     },
     "404": {
      "description": "Unknown asset"
     }
    }
   }
  },
  "/api/v1/rankings": {
   "get": {
    "operationId": "rankAssets",
    "summary": "All twelve assets ranked for the same monthly plan",
    "parameters": [
     {
      "name": "amount",
      "in": "query",
      "required": false,
      "description": "US dollars invested every month (default 100)",
      "schema": {
       "type": "number",
       "minimum": 1,
       "maximum": 1000000
      }
     },
     {
      "name": "start",
      "in": "query",
      "required": false,
      "description": "First purchase month, YYYY-MM (default 2020-01)",
      "schema": {
       "type": "string",
       "pattern": "^\\d{4}-\\d{2}$"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Ranking, best first"
     }
    }
   }
  },
  "/api/v1/returns": {
   "get": {
    "operationId": "yearlyReturns",
    "summary": "Calendar-year price returns of one asset since 2015",
    "parameters": [
     {
      "name": "asset",
      "in": "query",
      "required": true,
      "description": "Asset id, symbol or ticker",
      "schema": {
       "type": "string",
       "enum": [
        "bitcoin",
        "ethereum",
        "sp500",
        "nasdaq-100",
        "gold",
        "apple",
        "microsoft",
        "nvidia",
        "amazon",
        "alphabet",
        "meta",
        "tesla"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Year and return in percent"
     }
    }
   }
  },
  "/api/mcp": {
   "post": {
    "operationId": "mcp",
    "summary": "Model Context Protocol server (JSON-RPC 2.0 over HTTP): tools dca_plan, rank_assets, yearly_returns, list_assets",
    "responses": {
     "200": {
      "description": "JSON-RPC response"
     }
    }
   }
  }
 }
}