Stooq.com feeds stock price to you via API

DAILY LIFE

この記事にはプロモーションが含まれています。

STUDY AT HOME  ~ investment analysis & its procedure as tech hobby ~ Part 4

Stooq.com is convenient if you are eager to get stock price data by API. It seems run in Poland and provides us with many kinds of stock price and index of world wide on a daily basis.

In order to analyze the price transition of S&P 500, I coded a Python script to get the price data by API supplied from Stooq.com.

Nothing is difficult. Here is a simple example.

from pandas_datareader import data

start = '2022-01-01'
end = '2022-02-01'
 
df = data.DataReader('^SPX', 'stooq', start, end)

Just import pandas_datareader module and its data function. Specify stock index, “stooq”, and initial date and end date of period. “^SPX” represents S&P 500.

With this API, you are able to analyze given stock historical data by Python as much as you want. I will explain the actual example script I created in another article.

Be Continue >>>

コメント