Get time series data from k-db.com in Python

** Although it is k-db, the service will end on December 31, 2017. ** **

Introduction

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

Change log

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.

how to use

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

Futures class

Property

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

Method

Acquisition of time series data of designated stocks

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')

Acquisition of time series data for all stocks

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

Indices class

Property

python


#Returns a list of stock codes
Indices.symbols

# {Stock code:Brand name}Returns a dictionary of
Indices.names

Method

Acquisition of time series data of designated stocks

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')

Acquisition of time series data for all stocks

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

Stocks class

Property

python


#Returns a list of stock codes
Stocks.symbols

# {Stock code:Brand name}Returns a dictionary of
Stocks.names

Method

Acquisition of time series data of designated stocks

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')

Acquisition of time series data for all stocks

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

Statistics class

Property

python


#Returns a list of stock codes
Statistics.symbols

# {Stock code:Brand name}Returns a dictionary of
Statistics.names

Method

Acquisition of time series data of designated stocks

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')

Acquisition of time series data for all stocks

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

Get time series data from k-db.com in Python
Get data from Quandl in Python
[Python] Plot time series data
Get data from GPS module at 10Hz in Python
Get Leap Motion data in Python.
Python: Time Series Analysis: Preprocessing Time Series Data
How to generate exponential pulse time series data in python
Hit REST in Python to get data from New Relic
Graph time series data in Python using pandas and matplotlib
"Getting stock price time series data from k-db.com with Python" Program environment creation memo
Predict from various data in Python using Facebook Prophet, a time series prediction tool
Get additional data in LDAP with python
Get exchange rates from open exchange rates in Python
[Note] Get data from PostgreSQL with Python
Get Google Fit API data in Python
Get Youtube data in Python using Youtube Data API
Get battery level from SwitchBot in Python
Get Precipitation Probability from XML in Python
Get metric history from MLflow in Python
Python: Time Series Analysis
Python time series question
Get date in Python
Plot CSV of time series data with unixtime value in Python (matplotlib)
How to read time series data in PyTorch
Get only articles from web pages in Python
python get current time
Features that can be extracted from time series data
Convert date timezone (time difference) in Python (from string)
Receive dictionary data from a Python program in AppleScript
Output the time from the time the program was started in python
Get LEAD data using Marketo's REST API in Python
Get standard output in real time with Python subprocess
Get data from database via ODBC with Python (Access)
Generate Word Cloud from case law data in python3
Get YouTube Comments in Python
Get structural data from CHEMBLID
Handle Ambient data in Python
Get last month in python
Display UTM-30LX data in Python
Get Youtube data with python
OCR from PDF in Python
Get Terminal size in Python
Explicitly get EOF in python
Get Evernote notes in Python
Get Japanese synonyms in Python
Get your heart rate from the fitbit API in Python!
[Understand in the shortest time] Python basics for data analysis
Get the value while specifying the default value from dict in Python
Library tsfresh that automatically extracts features from time series data
Get the current date and time in Python, considering the time difference
Get macro constants from C (++) header file (.h) in Python
Get data from analytics API with Google API Client for python
A Python program that aggregates time usage from icalendar data
Get message from first offset with kafka consumer in python
[Question] How to get data of textarea data in real time using Python web framework bottle
Python: Exclude tags from html data
Read Protocol Buffers data in Python3
Hit treasure data from Python Pandas
Get the desktop path in Python
Division of timedelta in Python 2.7 series
Handle NetCDF format data in Python