{
  "openapi": "3.0.0",
  "info": {
    "contact": {
      "x-twitter": "polygon_io"
    },
    "description": "The future of fintech.",
    "title": "Polygon",
    "version": "1.0.0",
    "x-apisguru-categories": ["financial"],
    "x-logo": {
      "url": "https://twitter.com/polygon_io/profile_image?size=original"
    },
    "x-origin": [
      {
        "format": "swagger",
        "url": "https://polygon.io/docs/swagger.json",
        "version": "2.0"
      }
    ],
    "x-providerName": "polygon.io"
  },
  "security": [
    {
      "apiKey": []
    }
  ],
  "paths": {
    "/v1/companies": {
      "get": {
        "description": "Get a list of the traded companies that polygon.io streams. Company includes some details about the company which we hope to add more to soon.\n",
        "parameters": [
          {
            "description": "Which field to sort by. For desc place a `-` in front of the field name. eg `?sort=-marketcap`",
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "How many items to be on each page during pagination",
            "in": "query",
            "name": "perpage",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "description": "Which page of results to return",
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "type": "number",
              "default": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "An array of companies",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/Company"
                  },
                  "type": "array"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Available Companies",
        "tags": ["Stocks"],
        "x-s2o-consumes": [],
        "x-s2o-produces": []
      }
    },
    "/v1/currencies": {
      "get": {
        "description": "Get a list of the currencies that polygon.io streams.\n",
        "responses": {
          "200": {
            "description": "An array of currencies",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Available Currencies",
        "tags": ["Currencies"],
        "x-s2o-consumes": [],
        "x-s2o-produces": []
      }
    },
    "/v1/historic/agg/{size}/{symbol}/{date}": {
      "get": {
        "description": "Get historic aggregations for a symbol.\n",
        "parameters": [
          {
            "description": "Size of the aggregation. `second` or `minute`",
            "in": "path",
            "name": "size",
            "required": true,
            "schema": {
              "type": "string",
              "enum": ["second", "minute"]
            }
          },
          {
            "description": "Symbol of the company to retrieve",
            "in": "path",
            "name": "symbol",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Date/Day of the historic ticks to retreive",
            "in": "path",
            "name": "date",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "description": "Timestamp offset, used for pagination",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Limit the size of response, max: 10000",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "An array of aggregates",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "day": {
                      "description": "Date that was evaluated from the request",
                      "format": "date",
                      "type": "string"
                    },
                    "msLatency": {
                      "description": "Milliseconds of latency for the query results",
                      "type": "integer"
                    },
                    "status": {
                      "description": "Status of this requests response",
                      "type": "string"
                    },
                    "symbol": {
                      "description": "Symbol that was evaluated from the request",
                      "type": "string"
                    },
                    "ticks": {
                      "items": {
                        "$ref": "#/components/schemas/Aggregate"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Historic Aggregates",
        "tags": ["Stocks"],
        "x-s2o-consumes": [],
        "x-s2o-produces": []
      }
    },
    "/v1/historic/forex/{from}/{to}/{date}": {
      "get": {
        "description": "Get historic ticks for a currency pair. Example for **USD/JPY** the from would be **USD** and to would be **JPY**. The date formatted like **2017-6-22**\n",
        "parameters": [
          {
            "description": "From Symbol of the currency pair",
            "in": "path",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "To Symbol of the currency pair",
            "in": "path",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Date/Day of the historic ticks to retreive",
            "in": "path",
            "name": "date",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "description": "Timestamp offset, used for pagination",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Limit the size of response, max: 10000",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "An array of forex ticks",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "day": {
                      "description": "Date that was evaluated from the request",
                      "format": "date",
                      "type": "string"
                    },
                    "msLatency": {
                      "description": "Milliseconds of latency for the query results",
                      "type": "integer"
                    },
                    "status": {
                      "description": "Status of this requests response",
                      "type": "string"
                    },
                    "symbol": {
                      "description": "Symbol that was evaluated from the request",
                      "type": "string"
                    },
                    "ticks": {
                      "items": {
                        "$ref": "#/components/schemas/Forex"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Historic Forex Ticks",
        "tags": ["Currencies"],
        "x-s2o-consumes": [],
        "x-s2o-produces": []
      }
    },
    "/v1/historic/quotes/{symbol}/{date}": {
      "get": {
        "description": "Get historic quotes for a symbol.\n",
        "parameters": [
          {
            "description": "Symbol of the company to retrieve",
            "in": "path",
            "name": "symbol",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Date/Day of the historic ticks to retreive",
            "in": "path",
            "name": "date",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "description": "Timestamp offset, used for pagination",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Limit the size of response, max: 10000",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "An array of quotes",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "day": {
                      "description": "Date that was evaluated from the request",
                      "format": "date",
                      "type": "string"
                    },
                    "msLatency": {
                      "description": "Milliseconds of latency for the query results",
                      "type": "integer"
                    },
                    "status": {
                      "description": "Status of this requests response",
                      "type": "string"
                    },
                    "symbol": {
                      "description": "Symbol that was evaluated from the request",
                      "type": "string"
                    },
                    "ticks": {
                      "items": {
                        "$ref": "#/components/schemas/Quote"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Historic Quotes",
        "tags": ["Stocks"],
        "x-s2o-consumes": [],
        "x-s2o-produces": []
      }
    },
    "/v1/historic/trades/{symbol}/{date}": {
      "get": {
        "description": "Get historic trades for a symbol.\n",
        "parameters": [
          {
            "description": "Symbol of the company to retrieve",
            "in": "path",
            "name": "symbol",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Date/Day of the historic ticks to retreive",
            "in": "path",
            "name": "date",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "description": "Timestamp offset, used for pagination",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Limit the size of response, max: 10000",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "An array of trades",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "day": {
                      "description": "Date that was evaluated from the request",
                      "format": "date",
                      "type": "string"
                    },
                    "msLatency": {
                      "description": "Milliseconds of latency for the query results",
                      "type": "integer"
                    },
                    "status": {
                      "description": "Status of this requests response",
                      "type": "string"
                    },
                    "symbol": {
                      "description": "Symbol that was evaluated from the request",
                      "type": "string"
                    },
                    "ticks": {
                      "items": {
                        "$ref": "#/components/schemas/Trade"
                      },
                      "type": "array"
                    }
                  },
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Historic Trades",
        "tags": ["Stocks"],
        "x-s2o-consumes": [],
        "x-s2o-produces": []
      }
    },
    "/v1/last/currencies/{from}/{to}": {
      "get": {
        "description": "Get Last Trade Tick for a Currency Pair.\n",
        "parameters": [
          {
            "description": "From Symbol of the pair",
            "in": "path",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "To Symbol of the pair",
            "in": "path",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Last tick for this currency pair",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "last": {
                      "$ref": "#/components/schemas/LastForexTrade"
                    },
                    "status": {
                      "description": "Status of this requests response",
                      "type": "string"
                    },
                    "symbol": {
                      "description": "Symbol Pair that was evaluated from the request",
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Last Trade for a Currency Pair",
        "tags": ["Currencies"],
        "x-s2o-consumes": [],
        "x-s2o-produces": []
      }
    },
    "/v1/last/stocks/{symbol}": {
      "get": {
        "description": "Get the last trade for a given stock.\n",
        "parameters": [
          {
            "description": "Symbol of the stock to get",
            "in": "path",
            "name": "symbol",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Last trade for this stock",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "last": {
                      "$ref": "#/components/schemas/LastTrade"
                    },
                    "status": {
                      "description": "Status of this requests response",
                      "type": "string"
                    },
                    "symbol": {
                      "description": "Symbol that was evaluated from the request",
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Last Trade for a Symbol",
        "tags": ["Stocks"],
        "x-s2o-consumes": [],
        "x-s2o-produces": []
      }
    },
    "/v1/last_quote/currencies/{from}/{to}": {
      "get": {
        "description": "Get Last Quote Tick for a Currency Pair.\n",
        "parameters": [
          {
            "description": "From Symbol of the pair",
            "in": "path",
            "name": "from",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "To Symbol of the pair",
            "in": "path",
            "name": "to",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Last quote tick for this currency pair",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "last": {
                      "$ref": "#/components/schemas/LastForexQuote"
                    },
                    "status": {
                      "description": "Status of this requests response",
                      "type": "string"
                    },
                    "symbol": {
                      "description": "Symbol Pair that was evaluated from the request",
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Last Quote for a Currency Pair",
        "tags": ["Currencies"],
        "x-s2o-consumes": [],
        "x-s2o-produces": []
      }
    },
    "/v1/last_quote/stocks/{symbol}": {
      "get": {
        "description": "Get the last quote tick for a given stock.\n",
        "parameters": [
          {
            "description": "Symbol of the stock to get",
            "in": "path",
            "name": "symbol",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Last quote tick for this stock",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "last": {
                      "$ref": "#/components/schemas/LastQuote"
                    },
                    "status": {
                      "description": "Status of this requests response",
                      "type": "string"
                    },
                    "symbol": {
                      "description": "Symbol that was evaluated from the request",
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "summary": "Last Quote for a Symbol",
        "tags": ["Stocks"],
        "x-s2o-consumes": [],
        "x-s2o-produces": []
      }
    }
  },
  "servers": [
    {
      "url": "https://api.polygon.io"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "in": "query",
        "name": "apiKey",
        "type": "apiKey"
      }
    },
    "schemas": {
      "Aggregate": {
        "properties": {
          "c": {
            "description": "Close price",
            "type": "integer"
          },
          "h": {
            "description": "High price",
            "type": "integer"
          },
          "k": {
            "description": "Transactions ( 1 transaction contains X shares exchanged )",
            "type": "integer"
          },
          "l": {
            "description": "Low price",
            "type": "integer"
          },
          "o": {
            "description": "Open price",
            "type": "integer"
          },
          "t": {
            "description": "Timestamp of this aggregation",
            "type": "integer"
          },
          "v": {
            "description": "Total Volume of all trades ( total shares exchanged )",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "Company": {
        "properties": {
          "country": {
            "description": "Country in which this country is based.",
            "type": "string"
          },
          "exchange": {
            "description": "Exchange this company is traded on.",
            "type": "string"
          },
          "industry": {
            "description": "Industry this country operated/produces in.",
            "type": "string"
          },
          "marketcap": {
            "description": "Market cap as of the last updated timestamp.",
            "format": "double",
            "type": "number"
          },
          "name": {
            "description": "Name of the company.",
            "type": "string"
          },
          "sector": {
            "description": "Sector that this company is traded in.",
            "type": "string"
          },
          "symbol": {
            "description": "The actual exchange symbol this company is traded under.",
            "type": "string"
          },
          "updated": {
            "description": "Last time this company record was updated.",
            "format": "date-time",
            "type": "string"
          }
        },
        "type": "object"
      },
      "Error": {
        "properties": {
          "code": {
            "format": "int32",
            "type": "integer"
          },
          "fields": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Forex": {
        "properties": {
          "a": {
            "description": "Ask price",
            "type": "integer"
          },
          "b": {
            "description": "Bid price",
            "type": "integer"
          },
          "t": {
            "description": "Timestamp of this trade",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "LastForexQuote": {
        "properties": {
          "askprice": {
            "description": "Ask Price",
            "format": "double",
            "type": "number"
          },
          "bidprice": {
            "description": "Bid Price",
            "format": "double",
            "type": "number"
          },
          "timestamp": {
            "description": "Timestamp of this trade",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "LastForexTrade": {
        "properties": {
          "exchange": {
            "description": "Exchange this trade happened on",
            "type": "integer"
          },
          "price": {
            "description": "Price of the trade",
            "format": "double",
            "type": "number"
          },
          "timestamp": {
            "description": "Timestamp of this trade",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "LastQuote": {
        "properties": {
          "askexchange": {
            "description": "Exchange the ask happened on",
            "type": "integer"
          },
          "askprice": {
            "description": "Ask Price",
            "format": "double",
            "type": "number"
          },
          "asksize": {
            "description": "Ask Size",
            "type": "integer"
          },
          "bidexchange": {
            "description": "Exchange the bid happened on",
            "type": "integer"
          },
          "bidprice": {
            "description": "Bid Price",
            "format": "double",
            "type": "number"
          },
          "bidsize": {
            "description": "Bid Size",
            "type": "integer"
          },
          "cond": {
            "description": "Condition of the quote",
            "type": "integer"
          },
          "timestamp": {
            "description": "Timestamp of this trade",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "LastTrade": {
        "properties": {
          "cond1": {
            "description": "Condition 1 of the trade",
            "type": "integer"
          },
          "cond2": {
            "description": "Condition 2 of the trade",
            "type": "integer"
          },
          "cond3": {
            "description": "Condition 3 of the trade",
            "type": "integer"
          },
          "cond4": {
            "description": "Condition 4 of the trade",
            "type": "integer"
          },
          "exchange": {
            "description": "Exchange this trade happened on",
            "type": "integer"
          },
          "price": {
            "description": "Price of the trade",
            "format": "double",
            "type": "number"
          },
          "size": {
            "description": "Size of this trade",
            "type": "integer"
          },
          "timestamp": {
            "description": "Timestamp of this trade",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "Quote": {
        "properties": {
          "aE": {
            "description": "Ask Exchange",
            "type": "string"
          },
          "aP": {
            "description": "Ask Price",
            "format": "double",
            "type": "number"
          },
          "aS": {
            "description": "Ask Size",
            "type": "integer"
          },
          "bE": {
            "description": "Bid Exchange",
            "type": "string"
          },
          "bP": {
            "description": "Bid Price",
            "format": "double",
            "type": "number"
          },
          "bS": {
            "description": "Bid Size",
            "type": "integer"
          },
          "c": {
            "description": "Condition of this quote",
            "type": "integer"
          },
          "t": {
            "description": "Timestamp of this trade",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "Trade": {
        "properties": {
          "c1": {
            "description": "Condition 1 of this trade",
            "type": "integer"
          },
          "c2": {
            "description": "Condition 2 of this trade",
            "type": "integer"
          },
          "c3": {
            "description": "Condition 3 of this trade",
            "type": "integer"
          },
          "c4": {
            "description": "Condition 4 of this trade",
            "type": "integer"
          },
          "e": {
            "description": "The exchange this trade happened on",
            "type": "string"
          },
          "p": {
            "description": "Price of this trade",
            "format": "double",
            "type": "number"
          },
          "s": {
            "description": "Size of the trade",
            "type": "integer"
          },
          "t": {
            "description": "Timestamp of this trade",
            "type": "integer"
          }
        },
        "type": "object"
      }
    }
  },
  "x-s2o-consumes": [],
  "x-s2o-produces": ["application/json"]
}
