FinanceData.KR Open Source Financial data reader
2018-2024 FinanceData.KR
The FinanceDataReader is financial data reader(crawler) for finance.
The main functions are as follows.
- KRX Stock listings (์์ฅ๋ณ ์์ฅ ์ข ๋ชฉ ๋ฆฌ์คํ ): 'KRX', 'KOSPI', 'KODAQ', 'KONEX'
- Global Stock Symbol listings(ํด์ธ ๊ฑฐ๋์ ์์ฅ ์ข ๋ชฉ ๋ฆฌ์คํ ): 'NASDAQ', 'NYSE', 'AMEX', 'S&P500', 'SSE'(์ํด), 'SZSE'(์ฌ์ฒ), 'HKEX'(ํ์ฝฉ), 'TSE'(๋์ฟ)
- KRX delistings: 'KRX-DELISTING'(์์ฅํ์ง์ข ๋ชฉ), 'KRX-ADMINISTRATIVE' (๊ด๋ฆฌ์ข ๋ชฉ), 'KRX-MARCAP'(์๊ฐ์ด์ก)
- ETF Symbol listings: 'ETF/KR'
- Stock price(๊ฐ๋ณ์ข ๋ชฉ ๊ฐ๊ฒฉ ๋ฐ์ดํฐ): '005930'(Samsung), '091990'(Celltrion Healthcare) ...
- Stock price(ํด์ธ ๊ฑฐ๋์ ๊ฐ๋ณ์ข ๋ชฉ ๊ฐ๊ฒฉ ๋ฐ์ดํฐ): 'AAPL', 'AMZN', 'GOOG' ... (you can specify exchange(market) and symbol)
- Indexes: 'KS11'(์ฝ์คํผ์ง์), 'KQ11'(์ฝ์ค๋ฅ์ง์), 'DJI'(๋ค์ฐ์กด์ค์ง์), 'IXIC'(๋์ค๋ฅ์ง์), 'US500'(S&P 500์ง์) ...
- Exchanges: 'USD/KRW', 'USD/EUR', 'CNY/KRW' ... (์กฐํฉ๊ฐ๋ฅํ ํํ๋ณ ํ์จ ๋ฐ์ดํฐ ์ผ์๋ณ ๋ฐ์ดํฐ)
- Cryptocurrency price data (์ํธํํ ๊ฐ๊ฒฉ ๋ฐ์ดํฐ): 'BTC/USD', 'ETH/KRW' ...
pip install finance-datareader
์ง์ํ๋ ๊ฑฐ๋์: KRX(ํ๊ตญ๊ฑฐ๋์), NYSE(๋ด์์ฆ๊ถ๊ฑฐ๋์), NASDAQ(๋์ค๋ฅ), AMEX(์๋ฉ์ค), SSE(์ํด), SZSE(์ฌ์ฒ), HKEX(ํ์ฝฉ), TSE(๋์ฟ)
import FinanceDataReader as fdr
# KOSPI Index ์ฝ์คํผ ์ง์ ๋ฐ์ดํฐ
df = fdr.DataReader('KS11', '2020') # 2020-01-01 ~ ํ์ฌ
df = fdr.DataReader('KS11', '2022-01-01', '2022-12-31') # 2022-01-01 ~ 2022-12-31
# KRX Indices ๊ตญ๋ด ์ง์ ๋ฐ์ดํฐ
df = fdr.DataReader('KS11') # KOSPI ์ง์ (KRX)
df = fdr.DataReader('KQ11') # KOSDAQ ์ง์ (KRX)
df = fdr.DataReader('KS200') # KOSPI 200 (KRX)
# US market Indices ๋ฏธ๊ตญ ์์ฅ ์ง์ ๋ฐ์ดํฐ
df = fdr.DataReader('DJI') # ๋ค์ฐ์กด์ค ์ง์ (DJI - Dow Jones Industrial Average)
df = fdr.DataReader('IXIC') # ๋์ค๋ฅ ์ข
ํฉ์ง์ (IXIC - NASDAQ Composite)
df = fdr.DataReader('S&P500') # S&P500 ์ง์ (NYSE)
df = fdr.DataReader('RUT') # ๋ฌ์
2000 ์ง์ (RUT - US Small Cap 2000)
df = fdr.DataReader('VIX') # VIX์ง์ (VIX - CBOE Volatility Index)
# Global Indices ๊ธ๋ก๋ฒ ์ง์ ๋ฐ์ดํฐ
df = fdr.DataReader('SSEC') # ์ํด ์ข
ํฉ์ง์ Shanghai (SSEC -Shanghai Composite)
df = fdr.DataReader('HSI') # ํญ์
์ง์ (HSI - Hang Seng)
df = fdr.DataReader('N225') # ์ผ๋ณธ ๋์ผ์ด์ง์ (N225 - Nikkei 225)
df = fdr.DataReader('FTSE') # ์๊ตญ FTSE100 (FTSE 100 - Financial Times Stock Exchange)
df = fdr.DataReader('FCHI') # ํ๋์ค FCHI ์ง์ (CAC 40 - CAC quarante)
df = fdr.DataReader('GDAXI') # ๋
์ผ ๋ฅ์ค์ง์ (DAX30 - germany-30)
# KRX stock price ๊ตญ๋ด ์์ฅ ๊ฐ๋ณ์ข
๋ชฉ
df = fdr.DataReader('005930') # ์ผ์ฑ์ ์ ์ ์ฒด (1999๋
~ ํ์ฌ)
df = fdr.DataReader('000660') # SKํ์ด๋์ค ์ ์ฒด (1999๋
~ ํ์ฌ)
df = fdr.DataReader('068270') # ์
ํธ๋ฆฌ์จ ์ ์ฒด (2004๋
์์ฅ ~ ํ์ฌ)
# ์ฌ๋ฌ ์ข
๋ชฉ ์ข
๊ฐ(Close) ํ๋ฒ์
# ์ผ์ฑ์ ์(005930), SKํ์ด๋์ค(000660), ๊ธฐ์(000270), ์นด์นด์ค(035720), KB๊ธ์ต(105560)
df = fdr.DataReader('005930,000660,000270,035720,105560', '2020') # 2020๋
~ ํ์ฌ
# US stock price ๋ฏธ๊ตญ ์์ฅ ๊ฐ๋ณ์ข
๋ชฉ
df = fdr.DataReader('AAPL', '2017') # Apple(AAPL), 2017-01-01 ~ ํ์ฌ
df = fdr.DataReader('AMZN', '2017', '2019-12-31') # AMAZON(AMZN), 2017~2019 (3๋
)
df = fdr.DataReader('F', '1980-01-01', '2023-10-01') # Ford ์๋์ฐจ(F) (40๋
๊ฐ)
# ์ฌ๋ฌ์ข
๋ชฉ ํ๋ฒ์ ์ข
๊ฐ(Close) ๋ฐ์ดํฐ
df = fdr.DataReader('AAPL, TSLA, AMZN', '2020') # ์ ํ, ํ
์ฌ๋ผ, ์๋ง์กด (2020๋
~ ํ์ฌ)
# ๋ฐ์ดํฐ ์์ค ์ง์ ํ๊ธฐ
df = fdr.DataReader('KRX:000150', '2020-01-01') # ๋์ฐ(000150) (ํ๊ตญ๊ฑฐ๋์)
df = fdr.DataReader('NAVER:000150', '2020-01-01') # ๋์ฐ(000150) (๋ค์ด๋ฒ ํ์ด๋ธ์ค)
df = fdr.DataReader('YAHOO:000150.KS', '2020-01-01') # ๋์ฐ(000150) (์ผํ ํ์ด๋ธ์ค)
# TSE (๋์ฟ์ฆ๊ถ๊ฑฐ๋์)
df = fdr.DataReader('TSE:7203', '2020-01-01') # Toyota Motor Corp ํ ์ํ ์๋์ฐจ(7203)
df = fdr.DataReader('TSE:9984', '2020-01-01') # SoftBank Group Corp ์ํํธ๋ฑ
ํฌ๊ทธ๋ฃน(9984)
# HOSE (ํธ์น๋ฏผ์ฆ๊ถ๊ฑฐ๋์)
df = fdr.DataReader('HOSE:VCB', '2020-01-01') # ๋ฒ ํธ๋จ ๋ฌด์ญ์ํ(VCB)
df = fdr.DataReader('HOSE:VIC') # Vingroup (JSC)
# ๊ธ๋ก๋ฒ ๋์ผํ ์ข
๋ชฉ์ฝ๋ ๊ฒฝ์ฐ ๊ฑฐ๋์๋ฅผ ์ง์
df = fdr.DataReader('000150', '2020-01-01') # ๋์ฐ:KRX ์ข
๋ชฉ (๊ธฐ๋ณธ:๋ค์ด๋ฒ ํ์ด๋ธ์ค)
df = fdr.DataReader('KRX:000150', '2020-01-01') # ๋์ฐ:KRX ์ข
๋ชฉ (ํ๊ตญ๊ฑฐ๋์ ๋ฐ์ดํฐ)
df = fdr.DataReader('SSE:000150', '2020-01-01') # SSE 380 Dividend Index (์ํ์ด ๊ฑฐ๋์)
# ์ํ ์ ๋ฌผ ๊ฐ๊ฒฉ ๋ฐ์ดํฐ
df = fdr.DataReader('CL=F') # WTI์ ์ ๋ฌผ Crude Oil (NYMEX)
df = fdr.DataReader('BZ=F') # ๋ธ๋ ํธ์ ์ ๋ฌผ Brent Oil (NYMEX)
df = fdr.DataReader('NG=F') # ์ฒ์ฐ๊ฐ์ค ์ ๋ฌผ (NYMEX)
df = fdr.DataReader('GC=F') # ๊ธ ์ ๋ฌผ (COMEX)
df = fdr.DataReader('SI=F') # ์ ์ ๋ฌผ (COMEX)
df = fdr.DataReader('HG=F') # ๊ตฌ๋ฆฌ ์ ๋ฌผ (COMEX)
# ํ์จ: ์ฌ๋ฌ ์กฐํฉ ๊ฐ๋ฅ(์ง์ ์ฌ๋ณผ: ['KRW', 'EUR', 'CNY', 'JPY', 'CHF'])
df = fdr.DataReader('USD/KRW') # ๋ฌ๋ฌ ์ํ
df = fdr.DataReader('USD/EUR') # ๋ฌ๋ฌ ์ ๋กํ
df = fdr.DataReader('USD/CNY') # ๋ฌ๋ฌ ์์ํ
df = fdr.DataReader('CNY/KRW') # ์์ํ ์ํ
df = fdr.DataReader('EUR/CNY') # ์ ๋กํ ์์ํ
# ์ํธํํ ๊ฐ๊ฒฉ ๋ฐ์ดํฐ (์ํ, ๋ฌ๋ฌ)
# (์ง์ ์ฌ๋ณผ: ['BTC', 'ETH', 'USDT', 'BNB', 'USDC', 'XRP', 'BUSD', 'ADA', 'SOL', 'DOGE'])
df = fdr.DataReader('BTC/KRW') # ๋นํธ์ฝ์ธ/์ํ
df = fdr.DataReader('ETH/KRW') # ์ด๋๋ฆฌ์/์ํ
df = fdr.DataReader('BTC/USD') # ๋นํธ์ฝ์ธ/๋ฌ๋ฌ
df = fdr.DataReader('ETH/USD') # ์ด๋๋ฆฌ์/๋ฌ๋ฌ
# KRX delisting stock data ์์ฅํ์ง ์ข
๋ชฉ ์ ์ฒด ๊ฐ๊ฒฉ ๋ฐ์ดํฐ
df = fdr.DataReader('KRX-DELISTING:036360') # 3SOFT(036360)
# ๋ฏธ๊ตญ ๊ตญ์ฑ ์ฑ๊ถ ์์ต๋ฅ
df = fdr.DataReader('US5YT') # 5๋
๋ง๊ธฐ ๋ฏธ๊ตญ๊ตญ์ฑ ์์ต๋ฅ
df = fdr.DataReader('US10YT') # 10๋
๋ง๊ธฐ ๋ฏธ๊ตญ๊ตญ์ฑ ์์ต๋ฅ
df = fdr.DataReader('US30YT') # 30๋
๋ง๊ธฐ ๋ฏธ๊ตญ๊ตญ์ฑ ์์ต๋ฅ
# ์ข
๋ชฉ ๋ฆฌ์คํ
(์ข
๋ชฉ์๋ 2022๋
10์ 25์ผ ๊ธฐ์ค, ์์ฅ ๊ท๋ชจ ๊ฐ๋ ์ฉ๋)
# KRX ์์ฅํ์ฌ(๋ฐํํ์ฌ)๋ชฉ๋ก (๊ฐ๊ฒฉ ์ค์ฌ, ์ฃผ์ ์ข
๋ชฉ) - ์๊ฐ์ด์ก์
stocks = fdr.StockListing('KRX') # KRX: 2,663 ์ข
๋ชฉ(=์ฝ์คํผ+์ฝ์ค๋ฅ+์ฝ๋ฅ์ค)
stocks = fdr.StockListing('KOSPI') # KOSPI: 940 ์ข
๋ชฉ
stocks = fdr.StockListing('KOSDAQ') # KOSDAQ: 1,597 ์ข
๋ชฉ
stocks = fdr.StockListing('KONEX') # KONEX: 126 ์ข
๋ชฉ
# KRX ์ ์ข
๋ชฉ ๋ชฉ๋ก (์ค๋ช
์ค์ฌ, ์ฃผ์+ํ๋๋ฑ ์ ์ข
๋ชฉ)
stocks = fdr.StockListing('KRX-DESC') # ํ๊ตญ๊ฑฐ๋์: 7,632 ์ข
๋ชฉ
stocks = fdr.StockListing('KOSPI-DESC') # KOSPI: 5,897 ์ข
๋ชฉ
stocks = fdr.StockListing('KOSDAQ-DESC') # KOSDAQ: 1,609 ์ข
๋ชฉ
stocks = fdr.StockListing('KONEX-DESC') # KONEX: 126 ์ข
๋ชฉ
# KRX ํน์ ์ข
๋ชฉ ๋ฆฌ์คํ
(์์ฅํ์ง ์ข
๋ชฉ, ๊ด๋ฆฌ์ข
๋ชฉ)
stocks = fdr.StockListing('KRX-DELISTING') # 3์ฒ+ ์ข
๋ชฉ - ์์ฅํ์ง ์ข
๋ชฉ ์ ์ฒด
stocks = fdr.StockListing('KRX-ADMIN') # 50+ ์ข
๋ชฉ - KRX ๊ด๋ฆฌ์ข
๋ชฉ
# US Market listings ๋ฏธ๊ตญ ์์ฅ ๊ฑฐ๋์๋ณ ์ ์ข
๋ชฉ ๋ฆฌ์คํ
stocks = fdr.StockListing('S&P500') # S&P500: 503 ์ข
๋ชฉ
stocks = fdr.StockListing('NASDAQ') # ๋์ค๋ฅ (NASDAQ): 4์ฒ+ ์ข
๋ชฉ
stocks = fdr.StockListing('NYSE') # ๋ด์์ฆ๊ถ๊ฑฐ๋์ (NYSE): 3์ฒ+ ์ข
๋ชฉ
# Global Market listings ๊ธ๋ก๋ฒ ์์ฅ ๊ฑฐ๋์๋ณ ์ ์ข
๋ชฉ ๋ฆฌ์คํ
stocks = fdr.StockListing('SSE') # ์ํ์ด ์ฆ๊ถ๊ฑฐ๋์ (Shanghai Stock Exchange: SSE): 1์ฒ+ ์ข
๋ชฉ
stocks = fdr.StockListing('SZSE') # ์ ์ ์ฆ๊ถ๊ฑฐ๋์(Shenzhen Stock Exchange: SZSE): 1์ฒ+ ์ข
๋ชฉ
stocks = fdr.StockListing('HKEX') # ํ์ฝฉ ์ฆ๊ถ๊ฑฐ๋์(Hong Kong Exchange: HKEX): 2์ฒ5๋ฐฑ+ ์ข
๋ชฉ
stocks = fdr.StockListing('TSE') # ๋์ฟ ์ฆ๊ถ๊ฑฐ๋์(Tokyo Stock Exchange: TSE): 3์ฒ9๋ฐฑ+ ์ข
๋ชฉ
stocks = fdr.StockListing('HOSE') # ํธ์ฐ๋ฏผ ์ฆ๊ถ๊ฑฐ๋์(Ho Chi Minh City Stock Exchange: HOSE): 4๋ฐฑ+ ์ข
๋ชฉ
# KRX ETFs
etfs = fdr.StockListing('ETF/KR') # ํ๊ตญ ETF ์ ์ข
๋ชฉ
# FRED ๋ฐ์ดํฐ
df = fdr.DataReader('FRED:M2') # M2 ํตํ๋
df = fdr.DataReader('FRED:NASDAQCOM') # NASDAQCOM ๋์ค๋ฅ์ข
ํฉ์ง์
df = fdr.DataReader('FRED:T10Y2Y') # ๋ฏธ๊ตญ ์ฅ๋จ๊ธฐ๊ธ๋ฆฌ์ฐจ (1980๋
~)
# ๋ฌ๋ฌ ์ธ๋ฑ์ค
df = fdr.DataReader('^NYICDX') # ICE U.S. Dollar Index (^NYICDX) ๋ฌ๋ฌ์ธ๋ฑ์ค (1980~ํ์ฌ)
# FRED ๋ฐ์ดํฐ ์ฌ๋ฌ ํญ๋ชฉ ํ๋ฒ์
df = fdr.DataReader('FRED:M2,HSN1F,NASDAQCOM') # M2 ํตํ๋, HSN1F ์ฃผํํ๋งค์ง์, NASDAQCOM ๋์ค๋ฅ์ข
ํฉ์ง์
# KRX์ง์๋ฐ ์ง์ ๊ตฌ ์ฑ์ข
๋ชฉ
df = fdr.SnapDataReader('KRX/INDEX/LIST') # KRX ์ ์ฒด ์ง์๋ชฉ๋ก
df = fdr.SnapDataReader('KRX/INDEX/STOCK/1001') # KOSPI ์ง์๊ตฌ์ฑ์ข
๋ชฉ
df = fdr.SnapDataReader('KRX/INDEX/STOCK/1028') # ์ฝ์คํผ 200
df = fdr.SnapDataReader('KRX/INDEX/STOCK/5106') # KRX ESG Leaders 150 ํ
๋ง ์ง์ ๊ตฌ์ฑ์ข
๋ชฉ
# ์ง์ ํ์ง ์์ ๊ฒฝ์ฐ (NAVER์์ ๊ฐ์ ธ์ค๋ฉฐ 2000๋
์ดํ ๋ฐ์ดํฐ)
fdr.DataReader('000100') # (๊ธฐ๊ฐ ์ง์ ํ์ง ์์ ๊ฒฝ์ฐ)
fdr.DataReader('000100', '2023') # 2023๋
~ ํ์ฌ๊น์ง ๊ฐ๊ฒฉ ๋ฐ์ดํฐ
fdr.DataReader('000100', '2023', '2024') # 2023๋
๋ฐ์ดํฐ
# KRX (2000๋
์ด์ ๋ฐ์ดํฐ ๊ฐ๋ฅ, ์์ธํ ์ถ๊ฐ ํ๋)
fdr.DataReader('KRX:000100') # 1995-05-02 ~ ํ์ฌ (2๋
๋จ์๋ก ๊ฐ์ ธ์ ํฉ์ณ์ ๋ฐํ)
fdr.DataReader('KRX:000100', '2020') # 2020๋
~ ํ์ฌ๊น์ง ๊ฐ๊ฒฉ ๋ฐ์ดํฐ
fdr.DataReader('KRX:000100', '1900') # ์ต๋ ๋ฐ์ดํฐ (1995-05-02 ~ ํ์ฌ๊น์ง)
fdr.DataReader('KRX:000100', '2023-09-23', '2024-12-31') # (๊ธฐ๊ฐ ์ง์ ) 2๋
๋จ์๋ก ๊ฐ์ ธ์ ๋ณํฉ
# NAVER (2000๋
์ดํ ๋ฐ์ดํฐ)
fdr.DataReader('NAVER:000100') # 2000๋
~ํ์ฌ ๋ฐ์ดํฐ
fdr.DataReader('NAVER:000100', '2023') # 2023๋
~ ํ์ฌ๊น์ง ๊ฐ๊ฒฉ ๋ฐ์ดํฐ
fdr.DataReader('NAVER:000100', '2023', '2024') # 2023๋
๋ฐ์ดํฐ
# YAHOO
fdr.DataReader('YAHOO:000100.KS') # 2000๋
์ดํ ๋ฐ์ดํฐ
fdr.DataReader('YAHOO:000100.KS', '2023') # 2023๋
~ ํ์ฌ๊น์ง ๊ฐ๊ฒฉ ๋ฐ์ดํฐ
fdr.DataReader('YAHOO:000100.KS', '2023', '2024') # 2023๋
๋ฐ์ดํฐ
2018-2024 FinanceData.KR