-
Downloading daily stock and ETF data crawling from http://data.krx.co.kr/.
-
Save data to among or all of
- PostgreSQL Database
- ElasticSearch
- Firestore
- LocalStorage
- Install requirements
- If youl'd like to use Postgres, MAKE SURE to create database and tables using
V000*.sql
in root directory - Just to crawl or To save
import Crawler
import datetime
once_upon_a_time = Crawler.download_stock(datetime.date(1995, 5, 2))
cap = [stock.market_cap for stock in once_upon_a_time]
print("Korean Stock Market Cap on 1995-May-2 is {}".format(sum(cap)))
> python3 main.py --local
> python3 main.py --firestore
> python3 main.py --postgres
> python3 main.py --elasticsearch
> python3 main.py --all
> python3 main.py --all target_date=2021-11-11
or range
> python3 main.py --all from_date=2021-11-01 to_date=2021-11-11
firebase config
is should be located in project root as named firebase_config.json
file
firebase_config
infomation can be found on Firebase Doc
The other configuration dat must be written in config.ini
In config.ini
file,
[ElasticSearch]
host=localhost
[PostgreSQL]
host=localhost
port=5432
db=finance
user=admin
password=1234
[LocalDownload]
parent_dir=krx
LocalDownload.parent_dir
is the parent folder for downloading location
** This program is ONLY for educational purpose. Repository contiributors are not responsible for any both legal and illegal issues from misuses. **