# Get Stock Historical Bars (single symbol)

Retrieves the recent N bars of data based on stock symbol, time granularity, and type. Supports historical bars of various granularities like M1, M5, etc. Currently, daily bars (D) and above only provide forward-adjusted bars; minute bars provide unadjusted bars.

# OpenAPI definition

```json
{
  "info": {
    "title": "Webull Open API Reference",
    "description": "application.yml\\ncom\\ni18n\\nMETA-INF\\nstatic\\n\\r\\n",
    "contact": {
      "name": "",
      "url": "",
      "email": ""
    },
    "version": "2.0",
    "x-logo": {
      "url": "static/png/logo.png"
    }
  },
  "servers": [
    {
      "url": "https://hk-co-branding-openapi.uat.webullbroker.com"
    }
  ],
  "path": "/market-data/stocks/bars/get",
  "method": "get",
  "tags": [
    "Market Data"
  ],
  "description": "Retrieves the recent N bars of data based on stock symbol, time granularity, and type. Supports historical bars of various granularities like M1, M5, etc. Currently, daily bars (D) and above only provide forward-adjusted bars; minute bars provide unadjusted bars.",
  "operationId": "barsUsingGET",
  "parameters": [
    {
      "name": "symbol",
      "in": "query",
      "description": "Security symbol.",
      "required": true,
      "schema": {
        "type": "string"
      },
      "example": "AAPL"
    },
    {
      "name": "category",
      "in": "query",
      "description": "Security type. Category values are as shown in the enum.",
      "required": true,
      "schema": {
        "type": "string",
        "enum": [
          "US_STOCK"
        ]
      },
      "example": "US_STOCK"
    },
    {
      "name": "interval",
      "in": "query",
      "description": "Bar time granularity:M1, M5, M15, M30, M60, M120, M240, D, W, M, Y",
      "required": true,
      "schema": {
        "type": "string",
        "enum": [
          "M1",
          "M5",
          "M15",
          "M30",
          "M60",
          "M120",
          "M240",
          "D",
          "W",
          "M",
          "Y"
        ]
      },
      "example": "D"
    },
    {
      "name": "last_time",
      "in": "query",
      "description": "Last time of pre page.",
      "required": false,
      "schema": {
        "type": "string",
        "description": "Empty represents querying the latest data. Example: 1763555670"
      }
    },
    {
      "name": "count",
      "in": "query",
      "description": "Number of bars, default 200, maximum limit 1200 (M1 supports up to 1650).",
      "required": false,
      "schema": {
        "type": "string",
        "description": "1-1200（M1：1-1650）",
        "default": "200"
      },
      "example": 500
    },
    {
      "name": "real_time_required",
      "in": "query",
      "description": "Return the latest trading data, default is true;\\n false: Pulls only the completed bars from the previous period at the nearest whole hour at the time of request.\\n true: The returned data includes the latest market data.",
      "required": false,
      "schema": {
        "type": "string",
        "default": "true"
      },
      "example": true
    },
    {
      "name": "trading_sessions",
      "in": "query",
      "description": "Specify trading hours. Multiple selections are allowed. Separate multiple items with \",\".",
      "required": false,
      "schema": {
        "type": "string",
        "enum": [
          "PRE",
          "RTH",
          "ATH",
          "OVN"
        ]
      },
      "example": "PRE,RTH,ATH,OVN"
    },
    {
      "name": "access_token",
      "in": "header",
      "description": "User's authenticated token.",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "name": "reqid",
      "in": "header",
      "description": "The unique ID for this request. Suggest using UUID.",
      "schema": {
        "type": "string"
      },
      "example": "2e46d5a4-bef9-4507-8cda-98f85d2f770c"
    }
  ],
  "responses": {
    "200": {
      "description": "OK",
      "content": {
        "application/json": {
          "schema": {
            "required": [
              "instrument_id",
              "result",
              "special_times",
              "times"
            ],
            "type": "object",
            "properties": {
              "symbol": {
                "type": "string",
                "description": "symbol",
                "example": "AAPL"
              },
              "result": {
                "type": "array",
                "description": "k-line data",
                "items": {
                  "required": [
                    "close",
                    "high",
                    "low",
                    "open",
                    "time",
                    "trading_sessions",
                    "volume"
                  ],
                  "type": "object",
                  "properties": {
                    "time": {
                      "type": "string",
                      "description": "Bar timestamp, Unix timestamp format.",
                      "example": "2021-12-28T09:00:09.945+0000"
                    },
                    "open": {
                      "type": "string",
                      "description": "Open price",
                      "example": "150.25"
                    },
                    "close": {
                      "type": "string",
                      "description": "Close price",
                      "example": "152.3"
                    },
                    "high": {
                      "type": "string",
                      "description": "High price",
                      "example": "153.15"
                    },
                    "low": {
                      "type": "string",
                      "description": "Low price",
                      "example": "149.8"
                    },
                    "volume": {
                      "type": "string",
                      "description": "Volume",
                      "example": "1250000"
                    },
                    "trading_sessions": {
                      "type": "string",
                      "description": "Trading session, e.g., RTH (Regular Trading Hours), PRE (Pre-market).",
                      "example": "RTH"
                    }
                  },
                  "description": "Single K-line price record",
                  "title": "PriceRecord"
                }
              },
              "times": {
                "type": "array",
                "description": "exchange trading hours",
                "items": {
                  "required": [
                    "end",
                    "start",
                    "trading_session"
                  ],
                  "type": "object",
                  "properties": {
                    "start": {
                      "type": "string",
                      "description": "exchange start time",
                      "example": "09:30:00"
                    },
                    "end": {
                      "type": "string",
                      "description": "exchange end time",
                      "example": "16:00:00"
                    },
                    "trading_session": {
                      "type": "string",
                      "description": "Trading session, e.g., RTH (Regular Trading Hours), PRE (Pre-market).",
                      "example": "RTH"
                    }
                  },
                  "description": "exchange trading hours",
                  "title": "ExchangeTimesVo"
                }
              },
              "instrument_id": {
                "type": "string",
                "description": "instrument_id",
                "example": "913256135"
              },
              "special_times": {
                "type": "array",
                "description": "Special Trading Hours at the Exchange",
                "items": {
                  "required": [
                    "end",
                    "start",
                    "trading_session"
                  ],
                  "type": "object",
                  "properties": {
                    "start": {
                      "type": "integer",
                      "description": "exchange start time",
                      "format": "int64"
                    },
                    "end": {
                      "type": "integer",
                      "description": "exchange end time",
                      "format": "int64"
                    },
                    "trading_session": {
                      "type": "string",
                      "description": "Trading session, e.g., RTH (Regular Trading Hours), PRE (Pre-market).",
                      "example": "RTH"
                    }
                  },
                  "description": "Special Trading Hours at the Exchange",
                  "title": "SpecialExchangeTimesVo"
                }
              }
            },
            "title": "StockChartsResponseVo"
          }
        }
      }
    }
  },
  "postman": {
    "name": "Get Stock Historical Bars (single symbol)",
    "description": {
      "content": "Retrieves the recent N bars of data based on stock symbol, time granularity, and type. Supports historical bars of various granularities like M1, M5, etc. Currently, daily bars (D) and above only provide forward-adjusted bars; minute bars provide unadjusted bars.",
      "type": "text/plain"
    },
    "url": {
      "path": [
        "market-data",
        "stocks",
        "bars",
        "get"
      ],
      "host": [
        "{{baseUrl}}"
      ],
      "query": [
        {
          "disabled": false,
          "description": {
            "content": "(Required) Security symbol.",
            "type": "text/plain"
          },
          "key": "symbol",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "(Required) Security type. Category values are as shown in the enum.",
            "type": "text/plain"
          },
          "key": "category",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "(Required) Bar time granularity:M1, M5, M15, M30, M60, M120, M240, D, W, M, Y",
            "type": "text/plain"
          },
          "key": "interval",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "Last time of pre page.",
            "type": "text/plain"
          },
          "key": "last_time",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "Number of bars, default 200, maximum limit 1200 (M1 supports up to 1650).",
            "type": "text/plain"
          },
          "key": "count",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "Return the latest trading data, default is true;\\n false: Pulls only the completed bars from the previous period at the nearest whole hour at the time of request.\\n true: The returned data includes the latest market data.",
            "type": "text/plain"
          },
          "key": "real_time_required",
          "value": ""
        },
        {
          "disabled": false,
          "description": {
            "content": "Specify trading hours. Multiple selections are allowed. Separate multiple items with \",\".",
            "type": "text/plain"
          },
          "key": "trading_sessions",
          "value": ""
        }
      ],
      "variable": []
    },
    "header": [
      {
        "disabled": false,
        "description": {
          "content": "(Required) User's authenticated token.",
          "type": "text/plain"
        },
        "key": "access_token",
        "value": ""
      },
      {
        "disabled": false,
        "description": {
          "content": "The unique ID for this request. Suggest using UUID.",
          "type": "text/plain"
        },
        "key": "reqid",
        "value": ""
      },
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "method": "GET"
  }
}
```
