** Although it is k-db, the service will end on December 31, 2017. ** **
I wrote a class to get time series data of domestic futures, indexes, individual stocks and market statistics from k-db. With pandas_datareader, you can only get data on US stocks. sawadyrr5 / PyKDB: Data acquisition script from k-db
2016/5/12 Added support for updating the site configuration of k-db.com. Classified by futures, indexes, individual stocks and statistics. Organized internal processing.
First instantiate.
PyKDB
from PyKDB import Futures, Indices, Stocks, Statistics
myFutures = Futures() #For futures data acquisition
myIndices = Indices() #For exponential data acquisition
myStocks = Stocks() #For individual stock data acquisition
myStatistics = Statistics() #For statistical data acquisition
python
#Returns a list of stock codes
Futures.symbols
# {Stock code:Brand name}Returns a dictionary of
Futures.names
# {Stock code:Contract month}Returns a dictionary of
Futures.contracts
python
Futures.price(date_from, date_to, symbol, freq)
date_from, date_to Specify the period (datetime type) symbol Specify the brand code Specify freq frequency ('1d', '4h', '1h', '30m', '15m', '5m')
python
Futures.price_all(date_from, date_to, session)
date_from, date_to Specify the period (datetime type) session Specify session (None = all,'e' = night) If omitted, all
python
#Returns a list of stock codes
Indices.symbols
# {Stock code:Brand name}Returns a dictionary of
Indices.names
python
Indices.price(date_from, date_to, symbol, freq)
date_from, date_to Specify the period (datetime type) symbol Specify the brand code Specify freq frequency ('1d', '4h', '1h', '30m', '15m', '5m')
python
Indices.price_all(date_from, date_to, session)
date_from, date_to Specify the period (datetime type) session Specify session (None = all,'a' = front,'b' = back) If omitted, all
python
#Returns a list of stock codes
Stocks.symbols
# {Stock code:Brand name}Returns a dictionary of
Stocks.names
python
Stocks.price(date_from, date_to, symbol, freq)
date_from, date_to Specify period (datetime.datetime type) symbol Specify the brand code Specify freq frequency ('1d', '4h', '1h', '30m', '15m', '5m')
python
Stocks.price_all(date_from, date_to, session)
date_from, date_to Specify period (datetime.datetime type) session Specify session (None = all,'a' = front,'b' = back) If omitted, all
python
#Returns a list of stock codes
Statistics.symbols
# {Stock code:Brand name}Returns a dictionary of
Statistics.names
python
Statistics.price(date_from, date_to, symbol, freq)
date_from, date_to Specify period (datetime.datetime type) symbol Specify the brand code Specify freq frequency ('1d')
python
Statistics.price_all(date_from, date_to, session)
date_from, date_to Specify period (datetime.datetime type) session Specify session (None = all) If omitted, all
Recommended Posts