{
 "openapi": "3.1.0",
 "info": {
  "title": "SignalShopper Provider API",
  "version": "1.0.0",
  "summary": "The three calls a signal provider serves so that SignalShopper's top 10 lists and heat map can show its signal.",
  "description": "These calls are served by the provider, not by SignalShopper. A visitor's browser requests them directly, with a plain GET: no body, no cookies, no extra headers. Every answer needs Access-Control-Allow-Origin. The paths below are the recommended ones; a provider may use any addresses, because the provider description says where {side} and {symbol} go. Full guide: https://signalshopper.com/signals/docs/"
 },
 "servers": [
  {
   "url": "https://api.example.com/signalshopper/v1",
   "description": "Your own server. Replace with your base address."
  }
 ],
 "paths": {
  "/provider": {
   "get": {
    "operationId": "getProvider",
    "summary": "Provider description",
    "description": "Who the provider is, which symbols it covers, and the addresses of its two feeds.",
    "responses": {
     "200": {
      "description": "The provider description.",
      "headers": {
       "Access-Control-Allow-Origin": {
        "$ref": "#/components/headers/Cors"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "../schema/provider.schema.json"
        }
       }
      }
     },
     "default": {
      "description": "An error, with a message for the person looking at the page.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "headers": {
       "Access-Control-Allow-Origin": {
        "$ref": "#/components/headers/Cors"
       }
      }
     }
    }
   }
  },
  "/ranked": {
   "get": {
    "operationId": "getRanked",
    "summary": "Ranked list",
    "description": "The provider's signals for one side, already in order, strongest first. The page shows the first ten.",
    "parameters": [
     {
      "name": "side",
      "in": "query",
      "required": true,
      "schema": {
       "enum": [
        "buy",
        "sell"
       ]
      },
      "description": "Which list."
     }
    ],
    "responses": {
     "200": {
      "description": "The ranked list for that side.",
      "headers": {
       "Access-Control-Allow-Origin": {
        "$ref": "#/components/headers/Cors"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "../schema/ranked.schema.json"
        }
       }
      }
     },
     "400": {
      "description": "An error, with a message for the person looking at the page.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "headers": {
       "Access-Control-Allow-Origin": {
        "$ref": "#/components/headers/Cors"
       }
      }
     },
     "default": {
      "description": "An error, with a message for the person looking at the page.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "headers": {
       "Access-Control-Allow-Origin": {
        "$ref": "#/components/headers/Cors"
       }
      }
     }
    }
   }
  },
  "/grid": {
   "get": {
    "operationId": "getGrid",
    "summary": "Grid",
    "description": "One table of values for one symbol: rows by columns, in one or more panels. Fills the heat map.",
    "parameters": [
     {
      "name": "symbol",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "One of the symbols in the provider description, exactly as written there."
     }
    ],
    "responses": {
     "200": {
      "description": "The grid for that symbol.",
      "headers": {
       "Access-Control-Allow-Origin": {
        "$ref": "#/components/headers/Cors"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "../schema/grid.schema.json"
        }
       }
      }
     },
     "404": {
      "description": "An error, with a message for the person looking at the page.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "headers": {
       "Access-Control-Allow-Origin": {
        "$ref": "#/components/headers/Cors"
       }
      }
     },
     "default": {
      "description": "An error, with a message for the person looking at the page.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "headers": {
       "Access-Control-Allow-Origin": {
        "$ref": "#/components/headers/Cors"
       }
      }
     }
    }
   }
  },
  "/profile": {
   "get": {
    "operationId": "getProfile",
    "summary": "Profile",
    "description": "One value at each level of a price axis for one symbol, with marked levels such as the last price. Fills the profile chart.",
    "parameters": [
     {
      "name": "symbol",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      },
      "description": "One of the symbols in the provider description, exactly as written there."
     }
    ],
    "responses": {
     "200": {
      "description": "The profile for that symbol.",
      "headers": {
       "Access-Control-Allow-Origin": {
        "$ref": "#/components/headers/Cors"
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "../schema/profile.schema.json"
        }
       }
      }
     },
     "404": {
      "description": "An error, with a message for the person looking at the page.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "headers": {
       "Access-Control-Allow-Origin": {
        "$ref": "#/components/headers/Cors"
       }
      }
     },
     "default": {
      "description": "An error, with a message for the person looking at the page.",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Error"
        }
       }
      },
      "headers": {
       "Access-Control-Allow-Origin": {
        "$ref": "#/components/headers/Cors"
       }
      }
     }
    }
   }
  }
 },
 "components": {
  "headers": {
   "Cors": {
    "description": "Required on every answer, errors included. Use * unless you have a reason to name origins.",
    "required": true,
    "schema": {
     "type": "string",
     "examples": [
      "*"
     ]
    }
   }
  },
  "schemas": {
   "Error": {
    "type": "object",
    "required": [
     "error"
    ],
    "properties": {
     "error": {
      "type": "object",
      "required": [
       "message"
      ],
      "properties": {
       "code": {
        "type": "string",
        "description": "A short machine-readable name, such as unknown_symbol."
       },
       "message": {
        "type": "string",
        "description": "Shown to the person looking at the page. The first 200 characters are used."
       }
      }
     }
    }
   }
  }
 }
}
