Skip to content

Instantly share code, notes, and snippets.

@sla-000
Created April 5, 2023 20:26
Show Gist options
  • Save sla-000/3c6a6079228c10d87d480e6c571a8718 to your computer and use it in GitHub Desktop.
Save sla-000/3c6a6079228c10d87d480e6c571a8718 to your computer and use it in GitHub Desktop.

Revisions

  1. sla-000 created this gist Apr 5, 2023.
    299 changes: 299 additions & 0 deletions stocks_archive_v1.0.1.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,299 @@
    {
    "openapi": "3.0.0",
    "info": {
    "title": "Stocks API",
    "description": "Stocks API",
    "contact": {
    "name": "Viacheslav Riabinin",
    "email": "[email protected]"
    },
    "version": "1.0.1"
    },
    "externalDocs": {
    "description": "Find out more about Swagger",
    "url": "http://swagger.io"
    },
    "servers": [
    {
    "url": "http://url"
    }
    ],
    "tags": [
    {
    "name": "ticker",
    "description": "Stocks methods"
    }
    ],
    "paths": {
    "/ping": {
    "get": {
    "tags": [
    "ping"
    ],
    "summary": "Get server time",
    "description": "Check that server is still alive",
    "operationId": "ping",
    "responses": {
    "200": {
    "description": "Successful operation",
    "content": {
    "application/json": {
    "schema": {
    "$ref": "#/components/schemas/Ping"
    }
    }
    }
    }
    }
    }
    },
    "/ticker/list": {
    "get": {
    "tags": [
    "ticker"
    ],
    "summary": "Get tickers list",
    "description": "Returns a list of available tickers",
    "operationId": "tickersList",
    "responses": {
    "200": {
    "description": "Successful operation",
    "content": {
    "application/json": {
    "schema": {
    "$ref": "#/components/schemas/Tickers"
    }
    }
    }
    }
    }
    }
    },
    "/ticker/archive/{tickerName}/{period}/{startDate}/{endDate}": {
    "get": {
    "tags": [
    "ticker"
    ],
    "summary": "Get ticker data",
    "description": "Returns a list of ticker records",
    "operationId": "tickerData",
    "parameters": [
    {
    "name": "tickerName",
    "in": "path",
    "description": "Ticker name",
    "required": true,
    "schema": {
    "type": "string",
    "example": "gold"
    }
    },
    {
    "name": "period",
    "in": "path",
    "description": "Ticker period",
    "required": true,
    "schema": {
    "type": "string",
    "example": "1h",
    "enum": [
    "5m",
    "10m",
    "15m",
    "30m",
    "1h",
    "1d",
    "1w",
    "1M"
    ]
    }
    },
    {
    "name": "startDate",
    "in": "path",
    "description": "Start date",
    "required": true,
    "schema": {
    "type": "string",
    "format": "date-time",
    "example": "2010-04-12T14:30"
    }
    },
    {
    "name": "endDate",
    "in": "path",
    "description": "End date",
    "required": true,
    "schema": {
    "type": "string",
    "format": "date-time",
    "example": "2010-04-20T12:30"
    }
    }
    ],
    "responses": {
    "200": {
    "description": "Successful operation",
    "content": {
    "application/json": {
    "schema": {
    "$ref": "#/components/schemas/Records"
    }
    }
    }
    },
    "400": {
    "description": "Invalid parameters",
    "content": {
    "application/json": {
    "schema": {
    "$ref": "#/components/schemas/Error"
    }
    }
    }
    },
    "404": {
    "description": "Data not found"
    }
    }
    }
    }
    },
    "components": {
    "schemas": {
    "Ping": {
    "required": [
    "datetime"
    ],
    "type": "object",
    "properties": {
    "datetime": {
    "description": "Server time",
    "type": "string",
    "format": "date-time",
    "example": "2006-04-12T11:30:00.000Z"
    },
    "version": {
    "description": "Server version",
    "type": "string",
    "example": "1.2.3-2345"
    },
    "uptime": {
    "description": "Server uptime in seconds",
    "type": "number",
    "format": "float",
    "example": "54323.543"
    }
    }
    },
    "Tickers": {
    "description": "List of available tickers",
    "type": "object",
    "properties": {
    "tickers": {
    "type": "array",
    "items": {
    "$ref": "#/components/schemas/Ticker"
    }
    }
    }
    },
    "Ticker": {
    "required": [
    "name",
    "description"
    ],
    "type": "object",
    "properties": {
    "name": {
    "description": "Short (machine) name",
    "type": "string",
    "example": "gazprom-cs"
    },
    "description": {
    "description": "Long (Human) name",
    "type": "string",
    "example": "Gazprom, common shares, MICEX"
    },
    "marketName": {
    "description": "Market name",
    "type": "string",
    "example": "BATS"
    }
    }
    },
    "Records": {
    "description": "List of ticker records",
    "type": "object",
    "properties": {
    "records": {
    "type": "array",
    "items": {
    "$ref": "#/components/schemas/Record"
    }
    }
    }
    },
    "Record": {
    "required": [
    "closeDateTime",
    "open",
    "close",
    "high",
    "low",
    "volume"
    ],
    "description": "One ticker record",
    "type": "object",
    "properties": {
    "closeDateTime": {
    "description": "Close date-time in local for stock-exchange format",
    "type": "string",
    "format": "date-time",
    "example": "2006-04-12T11:30:00.000Z"
    },
    "open": {
    "description": "Open price",
    "type": "number",
    "format": "float",
    "example": 105.5
    },
    "close": {
    "description": "Close price",
    "type": "number",
    "format": "float",
    "example": 109.3
    },
    "high": {
    "description": "Highest price",
    "type": "number",
    "format": "float",
    "example": 111.1
    },
    "low": {
    "description": "Lowest price",
    "type": "number",
    "format": "float",
    "example": 102.7
    },
    "volume": {
    "description": "Volume for period",
    "type": "integer",
    "format": "int32",
    "example": 12345
    }
    }
    },
    "Error": {
    "type": "object",
    "properties": {
    "error": {
    "description": "Error message",
    "type": "string",
    "example": "Wrong field value, period=4n"
    }
    }
    }
    }
    }
    }