LoginSignup
6
16

More than 5 years have passed since last update.

楽天RSSから日経平均採用225社の株価をPythonで取得しDataFrame化(約20秒)

Last updated at Posted at 2019-02-02

概要

  • 手順1: 事前準備:(225社分の株式コードを用意する)
  • 手順2:楽天RSSを利用し、225社の始値を取得 (約20秒)

手順1: 事前準備:

CSVファイルから日経225社のコードを取得しておく
参考


import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/zaq9/nk225_list/master/nk225_list.csv')

手順2:楽天RSSを利用し、225社の始値を取得 (約20秒)

モジュール「rakuten_rss」を利用する

参考

楽天RSSから株価情報取得するPythonモジュールのα版を作成しPyPIに登録してみた


from rakuten_rss import fetch_open
df['open'] = df.code.apply(lambda x: fetch_open(x))

以上。

6
16
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
6
16