출처 : 금융 데이터 분석을 위한 파이썬 판다스
예제파일
https://github.com/financedata/financedatareader
https://financedata.github.io/
# 종목전체
df = fdr.DataReader(symbol="002290")
print(df)
Open High Low Close Volume Change
Date
1998-02-23 1190 1190 1190 1190 1 NaN
1998-02-24 1280 1280 1100 1100 2 -0.075630
1998-02-25 1100 1100 1100 1100 0 0.000000
1998-02-26 1020 1020 1020 1020 0 -0.072727
1998-02-27 940 940 940 940 0 -0.078431
... ... ... ... ... ... ...
2022-04-07 6530 6580 6180 6330 822661 -0.042360
2022-04-08 6320 6330 5910 6020 582046 -0.048973
2022-04-11 5790 5830 5400 5660 1227563 -0.059801
2022-04-12 5510 5650 5390 5500 562607 -0.028269
2022-04-13 5500 5530 5250 5300 685174 -0.036364
[6000 rows x 6 columns]
# 종목전체
df = fdr.DataReader(symbol="002290",start="2022")
print(df)
Open High Low Close Volume Change
Date
2022-01-03 4290 4435 4290 4410 263403 0.027972
2022-01-04 4420 4445 4340 4440 207412 0.006803
2022-01-05 4440 4695 4375 4610 611940 0.038288
2022-01-06 4490 4555 4315 4360 347520 -0.054230
2022-01-07 4335 4455 4300 4415 167876 0.012615
... ... ... ... ... ... ...
2022-04-07 6530 6580 6180 6330 822661 -0.042360
2022-04-08 6320 6330 5910 6020 582046 -0.048973
2022-04-11 5790 5830 5400 5660 1227563 -0.059801
2022-04-12 5510 5650 5390 5500 562607 -0.028269
2022-04-13 5500 5530 5250 5300 685174 -0.036364
[68 rows x 6 columns]
import FinanceDataReader as fdr
import matplotlib.pyplot as plt
import pandas as pd
# 종목전체
kospi = fdr.DataReader(symbol="KS11", start="2022") # kospi
kosdaq = fdr.DataReader(symbol="KQ11", start="2022") # kosdaq
print(kospi)
kospi.plot()
plt.show()
Close Open High Low Volume Change
Date
2022-01-03 2988.77 2998.32 3010.77 2979.42 435820000.0 0.0037
2022-01-04 2989.24 2991.97 2995.25 2973.08 621550000.0 0.0002
2022-01-05 2953.97 2984.05 2986.20 2936.73 787350000.0 -0.0118
2022-01-06 2920.53 2925.40 2952.54 2915.38 786040000.0 -0.0113
2022-01-07 2954.89 2933.78 2959.03 2933.10 546170000.0 0.0118
... ... ... ... ... ... ...
2022-04-07 2695.86 2714.70 2718.50 2693.36 999280000.0 -0.0143
2022-04-08 2700.39 2706.64 2712.00 2685.52 948360000.0 0.0017
2022-04-11 2693.10 2687.54 2711.02 2683.96 742600000.0 -0.0027
2022-04-12 2666.76 2674.17 2685.08 2658.40 870970000.0 -0.0098
2022-04-13 2716.49 2677.53 2717.63 2672.60 719400.0 0.0186
[68 rows x 6 columns]
댓글