0
1

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 3 years have passed since last update.

Pythonのpandasで米国株価を取得する

Posted at

以前、RapidAPIを使って米国株価を取得しました。
https://qiita.com/ShinPun/items/b035297e3fe36409f365

調べてみると以下のようにpandasで簡単に取得できることが分かりました。

import pandas_datareader.data as pdr
import datetime

end = datetime.date.today()
start = end - datetime.timedelta(days=10)

pd_data = pdr.DataReader('MSFT',"yahoo", start, end)

print(pd_data)

結果は以下の通りとなりました。

High         Low        Open       Close    Volume  \
Date                                                                   
2021-01-19  216.979996  212.630005  213.750000  216.440002  30480900   
2021-01-20  225.789993  217.289993  217.699997  224.339996  37777300   
2021-01-21  226.300003  222.419998  224.699997  224.970001  30749600   
2021-01-22  230.070007  225.800003  227.080002  225.949997  30124900   
2021-01-25  229.779999  224.220001  229.119995  229.529999  33152100   
2021-01-26  234.179993  230.080002  231.860001  232.330002  49169600   
2021-01-27  240.440002  230.139999  238.000000  232.899994  69757500   

             Adj Close  
Date                    
2021-01-19  216.440002  
2021-01-20  224.339996  
2021-01-21  224.970001  
2021-01-22  225.949997  
2021-01-25  229.529999  
2021-01-26  232.330002  
2021-01-27  232.899994  

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?