7
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

取引所サーバーから最新の日経225 オプション清算値データを取得、抽出するモジュールを作成しPyPIに登録

Last updated at Posted at 2019-01-29

取引所サーバーから最新の日経225 オプション清算値データを取得するモジュールを作成し、PyPIに登録してみました。

nk225op

nk225op はJPX(日本証券取引所)のサーバーから、最新の日経225オプション清算値を取得するモジュールです。 

ブラウザでお気軽に試す場合 ⇒  Jupyter Notebook example on Google Colab

Demo:  (2月限と3月限 権利価格 20500~20750 の清算値とIVデータ表示)

from nk225op import nk225op as nk
nk([201902,201903] , [20500,20750])

Output:

lb PRICE IV
02/C20500 340 18.3289
02/C20625 260 17.5826
02/C20750 195 17.2045
.......... ... (以下省略)

Install: (Google Colaboratory 上での利用方法 )

!pip install nk225op

ブラウザでお気軽に試す場合 ⇒  Jupyter Notebook example on Google Colab


※ローカル環境にInstallする場合 pip install nk225op

Requirement

  • Pandas
  • bs4

利用できる関数:


def nk225op(maturities=None, strike_range=None):
	"""Download latest Options DATA(NK255) from JPX
	:param maturities: List
		#eg1(monthly type): [201902]
		#eg2(weekly type): [20190125]
		#eg3: [201902 , 201903 , 20190125]
	:param strike_range: List
		#eg: [19000,20000]
	:return: DataFrame
		OptionsPriceList :
	Examples
	--------
	>>>  nk225op([201902],[20500, 21000])
	"""


def latest_csv_path():
    """JPXサーバ内にある最新の清算値CSVファイルへのPATHを返す"""

def csv_to_df(csv_path, max_maturity_day=90):
	"""
	清算値CSVファイルをDataFrameに変換
	Parameters
	----------
	csv_path : str
	max_maturity_day :  int , default 90
		最大、SQ期日が何日後までのデータを取得するか(規定値90日後)
	Returns
	-------
	DataFrame
	"""

PyPIへの登録:

PyPI: nk225op

7
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?