{
 "openapi": "3.1.0",
 "info": {
  "title": "Be The Puck read API",
  "version": "1.0.0",
  "description": "Facts from 100 published trading plays and Be The Puck's signal (Buy, Hold or Sell) on 373 stocks, funds, indexes and coins, rebuilt after each U.S. close. Every answer carries the disclaimer: This analysis does not constitute trading advice. Please meet with an advisor or independently review sources before making any decision. Be The Puck is not a broker or an adviser and never places trades. An assistant can read the signal and draft an order, but nothing is placed until you approve it in your own broker, and paper trading comes first. Free sample without a key (30 calls a day: stock and search); members send a personal key as a Bearer token (2,000 calls a day, everything). How to get a key: https://bethepuck.com/developers/",
  "contact": {
   "name": "Be The Puck",
   "url": "https://bethepuck.com/developers/"
  }
 },
 "servers": [
  {
   "url": "https://bethepuck.com"
  }
 ],
 "security": [
  {},
  {
   "memberKey": []
  }
 ],
 "paths": {
  "/api/v1/stock/{ticker}": {
   "get": {
    "operationId": "getStockSignal",
    "summary": "Signal on one stock",
    "description": "Be The Puck's signal, score out of 100, plays in and plain-English read on one covered name. Members also get factor points, flip prices and custom weights. Free sample without a key.",
    "parameters": [
     {
      "name": "ticker",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "example": "MU",
      "description": "Ticker or name: MU, SHOP.TO, BTC-USD, SPY, Micron."
     },
     {
      "name": "w",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "example": "plays40.offhigh30.trend30",
      "description": "Members: factor weights as factor+weight joined by dots (plays, upside, rating, pe, fpe, peg, ps, pb, dy, eg, rg, pm, roe, de, offhigh, trend, mom, calm)."
     },
     {
      "name": "buy",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 50,
       "maximum": 95
      },
      "description": "Members: the Buy line (standard 60)."
     },
     {
      "name": "sell",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 5,
       "maximum": 90
      },
      "description": "Members: the Sell line (standard 40)."
     },
     {
      "name": "plays",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "example": "top1",
      "description": "Members: which plays count: all, top1, top3, half, or play slugs joined by dots."
     }
    ],
    "responses": {
     "200": {
      "description": "The answer, with `text` (plain English), `as_of` and `disclaimer`.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Stock"
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Error"
     },
     "401": {
      "$ref": "#/components/responses/Error"
     },
     "403": {
      "$ref": "#/components/responses/Error"
     },
     "404": {
      "$ref": "#/components/responses/Error"
     },
     "429": {
      "$ref": "#/components/responses/Error"
     }
    }
   }
  },
  "/api/v1/search": {
   "get": {
    "operationId": "searchStocks",
    "summary": "Find a covered name",
    "description": "Covered names by ticker or company name, with each one's signal and score. Free sample without a key.",
    "parameters": [
     {
      "name": "q",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "example": "shopify"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 25,
       "default": 10
      }
     }
    ],
    "responses": {
     "200": {
      "description": "The answer, with `text` (plain English), `as_of` and `disclaimer`.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Error"
     },
     "401": {
      "$ref": "#/components/responses/Error"
     },
     "403": {
      "$ref": "#/components/responses/Error"
     },
     "404": {
      "$ref": "#/components/responses/Error"
     },
     "429": {
      "$ref": "#/components/responses/Error"
     }
    }
   }
  },
  "/api/v1/screen": {
   "get": {
    "operationId": "screenStocks",
    "summary": "Screen every covered name",
    "description": "Filter and sort every public name by signal, market, group and share of plays in. Members only.",
    "parameters": [
     {
      "name": "signal",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "buy",
        "hold",
        "sell"
       ]
      }
     },
     {
      "name": "market",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "us",
        "ca",
        "crypto",
        "fund"
       ]
      }
     },
     {
      "name": "group",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "example": "Semiconductors"
     },
     {
      "name": "min_plays",
      "in": "query",
      "required": false,
      "schema": {
       "type": "number",
       "minimum": 0,
       "maximum": 100
      },
      "description": "Lowest share of plays in, in percent."
     },
     {
      "name": "sort",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "score",
        "plays",
        "earnings"
       ],
       "default": "score"
      },
      "description": "score, plays (share of plays in) or earnings (the next earnings report, soonest first)"
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 1,
       "maximum": 50,
       "default": 20
      }
     },
     {
      "name": "w",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "example": "plays40.offhigh30.trend30",
      "description": "Members: factor weights as factor+weight joined by dots (plays, upside, rating, pe, fpe, peg, ps, pb, dy, eg, rg, pm, roe, de, offhigh, trend, mom, calm)."
     },
     {
      "name": "buy",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 50,
       "maximum": 95
      },
      "description": "Members: the Buy line (standard 60)."
     },
     {
      "name": "sell",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "minimum": 5,
       "maximum": 90
      },
      "description": "Members: the Sell line (standard 40)."
     },
     {
      "name": "plays",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      },
      "example": "top1",
      "description": "Members: which plays count: all, top1, top3, half, or play slugs joined by dots."
     }
    ],
    "responses": {
     "200": {
      "description": "The answer, with `text` (plain English), `as_of` and `disclaimer`.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Error"
     },
     "401": {
      "$ref": "#/components/responses/Error"
     },
     "403": {
      "$ref": "#/components/responses/Error"
     },
     "404": {
      "$ref": "#/components/responses/Error"
     },
     "429": {
      "$ref": "#/components/responses/Error"
     }
    }
   }
  },
  "/api/v1/plays": {
   "get": {
    "operationId": "listPlays",
    "summary": "List the plays",
    "description": "Every play by family, with the people behind it and how often its calls have been right. Members only.",
    "parameters": [
     {
      "name": "family",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "enum": [
        "trend",
        "breakout",
        "momentum",
        "reversion",
        "volume",
        "pattern",
        "calendar"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "The answer, with `text` (plain English), `as_of` and `disclaimer`.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Error"
     },
     "401": {
      "$ref": "#/components/responses/Error"
     },
     "403": {
      "$ref": "#/components/responses/Error"
     },
     "404": {
      "$ref": "#/components/responses/Error"
     },
     "429": {
      "$ref": "#/components/responses/Error"
     }
    }
   }
  },
  "/api/v1/plays/{slug}": {
   "get": {
    "operationId": "explainPlay",
    "summary": "Explain one play",
    "description": "One play in full: rules, timeframe, source, assumptions and record. Members only.",
    "parameters": [
     {
      "name": "slug",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      },
      "example": "stage-analysis"
     }
    ],
    "responses": {
     "200": {
      "description": "The answer, with `text` (plain English), `as_of` and `disclaimer`.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Error"
     },
     "401": {
      "$ref": "#/components/responses/Error"
     },
     "403": {
      "$ref": "#/components/responses/Error"
     },
     "404": {
      "$ref": "#/components/responses/Error"
     },
     "429": {
      "$ref": "#/components/responses/Error"
     }
    }
   }
  },
  "/api/v1/market": {
   "get": {
    "operationId": "marketConditions",
    "summary": "Market conditions",
    "description": "The market guard on the S&P 500 and the TSX, the crash gauges' verdict, and how many covered names read Buy, Hold and Sell. Members only.",
    "parameters": [],
    "responses": {
     "200": {
      "description": "The answer, with `text` (plain English), `as_of` and `disclaimer`.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true
        }
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/Error"
     },
     "401": {
      "$ref": "#/components/responses/Error"
     },
     "403": {
      "$ref": "#/components/responses/Error"
     },
     "404": {
      "$ref": "#/components/responses/Error"
     },
     "429": {
      "$ref": "#/components/responses/Error"
     }
    }
   }
  }
 },
 "components": {
  "securitySchemes": {
   "memberKey": {
    "type": "http",
    "scheme": "bearer",
    "description": "A member's personal API key from https://bethepuck.com/me/#apikey (btp_...)."
   }
  },
  "responses": {
   "Error": {
    "description": "An error, with `error`, `text` and `disclaimer` (403: needs a membership key; 429: the day's calls are used).",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   }
  },
  "schemas": {
   "Error": {
    "type": "object",
    "properties": {
     "error": {
      "type": "string"
     },
     "code": {
      "type": "string"
     },
     "text": {
      "type": "string"
     },
     "disclaimer": {
      "type": "string"
     },
     "membership": {
      "type": "string"
     }
    }
   },
   "Stock": {
    "type": "object",
    "properties": {
     "ticker": {
      "type": "string"
     },
     "symbol": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "group": {
      "type": "string"
     },
     "market": {
      "type": "string",
      "enum": [
       "us",
       "ca",
       "crypto",
       "fund"
      ]
     },
     "currency": {
      "type": "string"
     },
     "close": {
      "type": "number"
     },
     "close_date": {
      "type": "string",
      "format": "date"
     },
     "signal": {
      "type": "string",
      "enum": [
       "Buy",
       "Hold",
       "Sell",
       "No score"
      ]
     },
     "score": {
      "type": [
       "integer",
       "null"
      ]
     },
     "held": {
      "type": "boolean"
     },
     "guard": {
      "type": "boolean"
     },
     "plays_in": {
      "type": "object",
      "properties": {
       "k": {
        "type": "integer"
       },
       "of": {
        "type": "integer"
       },
       "words": {
        "type": "string"
       }
      }
     },
     "read": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "factors": {
      "type": "array",
      "items": {
       "type": "object"
      },
      "description": "Members: each factor's points, shown value and weight."
     },
     "flip": {
      "type": [
       "string",
       "null"
      ],
      "description": "Members: the closes at which the standard signal would change."
     },
     "url": {
      "type": "string"
     },
     "as_of": {
      "type": "string",
      "format": "date"
     },
     "tier": {
      "type": "string"
     },
     "text": {
      "type": "string"
     },
     "disclaimer": {
      "type": "string"
     },
     "membership": {
      "type": "string"
     }
    }
   }
  }
 }
}