0
2

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でYahooファイナンスから為替レートを取得して可視化してみた

Last updated at Posted at 2021-07-17

タイトル通り。

環境

python 3.9.6
細かい環境は省略。

参考

コード

get_fx_rate.py
import pandas_datareader as pdr
import datetime
from matplotlib import pyplot as plt

# 為替レート取得
pair='USDJPY=X' #AUDJPY=X USDJPY=X EURJPY=X
data = pdr.DataReader(pair, 'yahoo', end='2021-07-10', start='2021-07-04')
tmp = data.head()

print(tmp)

# 可視化
fig = plt.figure(figsize=(12,8), tight_layout=True)
ax = fig.add_subplot(111, xlabel=data.index.name, ylabel='USDJPY')

ax.plot(data['High'])
ax.plot(data['Low'])

fig.savefig('test.png')

所感

可視化についてはもっと色々できるみたいなので別途勉強したほうがよさげ。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?