Skip to content

Technical

In US stock data, we offer 2 datasets, as follows:

In addition, the following list summarizes the available datasets:

The usage of each dataset is explained one by one below. For the specific dataset schemas, please refer to finmindapi

US Stock List USStockInfo

  • This dataset primarily lists the names, codes, and industry categories of all US listed and OTC stocks.

Example

import requests
import pandas as pd

url = 'https://api.finmindtrade.com/api/v4/data'
token = "" # Refer to the login page to obtain your API key
headers = {"Authorization": f"Bearer {token}"}
parameter = {
    "dataset": "USStockInfo"
}
data = requests.get(url, headers=headers, params=parameter)
data = data.json()
data = pd.DataFrame(data['data'])
print(data.head())

Output

date stock_id Country IPOYear MarketCap Subsector stock_name
0 2019-01-10 A United States 1999 21610000000 Biotechnology:LaboratoryAnalyticalInstruments Agilent Technologies, Inc.
1 2019-01-10 AA n/a 2016 5270000000 Aluminum Alcoa Corporation
2 2019-01-10 AABA United States 0 36780000000 EDPServices Altaba Inc.
3 2019-01-10 AAC United States 2014 55360000 MedicalSpecialities AAC Holdings, Inc.
4 2019-01-10 AAL United States 0 14930000000 AirFreight/DeliveryServices American Airlines Group, Inc.
{
    date: str,
    stock_id: str,
    Country: str,
    IPOYear: str,
    MarketCap: str,
    Subsector: str,
    stock_name: str
}

US Stock Minute K Price Table USStockPriceMinute (available only to backer, sponsor members)

  • Data update time 08:00 daily. Actual update time is based on the API data.

Example

import requests
import pandas as pd

url = 'https://api.finmindtrade.com/api/v4/data'
token = "" # Refer to the login page to obtain your API key
headers = {"Authorization": f"Bearer {token}"}
parameter = {
    "dataset": "USStockPriceMinute",
    "data_id": "^DJI",
    "start_date": "2022-06-16",
}
data = requests.get(url, headers=headers, params=parameter)
data = data.json()
data = pd.DataFrame(data['data'])
print(data.head())

Output

date stock_id close high low open volume
0 2022-06-16 13:31:00 ^DJI 30082.5 30094.9 30076.6 30091.4 1686944
1 2022-06-16 13:32:00 ^DJI 30075.6 30087.9 30069.2 30081.7 1939377
2 2022-06-16 13:33:00 ^DJI 30039.5 30085.8 30036.4 30078.1 1589351
3 2022-06-16 13:34:00 ^DJI 30001.6 30036.5 29995.9 30036.5 2127155
4 2022-06-16 13:35:00 ^DJI 29996.7 30008 29984.3 30002.2 1917277
{
    date: str,
    stock_id: str,
    close: float64,
    high: float64,
    low: float64,
    open: float64,
    volume: int64
}

US Stock Price Table USStockPrice

  • Data update time 08:00 daily. Actual update time is based on the API data.

Example

import requests
import pandas as pd

url = 'https://api.finmindtrade.com/api/v4/data'
token = "" # Refer to the login page to obtain your API key
headers = {"Authorization": f"Bearer {token}"}
parameter = {
    "dataset": "USStockPrice",
    "data_id": "^DJI",
    "start_date": "2020-06-16",
    "end_date": "2021-06-16",
}
data = requests.get(url, headers=headers, params=parameter)
data = data.json()
data = pd.DataFrame(data['data'])
print(data.head())

Output

date stock_id Adj_Close Close High Low Open Volume
0 2020-06-16 ^DJI 26290 26290 26611 25811.7 26326.7 489500000
1 2020-06-17 ^DJI 26119.6 26119.6 26400.1 26068.4 26330.5 328830000
2 2020-06-18 ^DJI 26080.1 26080.1 26154.2 25848.5 26016.5 328390000
3 2020-06-19 ^DJI 25871.5 25871.5 26451.4 25759.7 26213.1 669390000
4 2020-06-22 ^DJI 26025 26025 26059.8 25667.7 25865.1 351780000
{
    date: str,
    stock_id: str,
    close: float64,
    high: float64,
    low: float64,
    open: float64,
    volume: int64
}