pip install pandas pandas-datareader matplotlib beautifulsoup4 scikit-learn
#pycharm file->settings->project->interpreter->install libraries
import datetime as dt
import matplotlib.pyplot as plt
from matplotlib import style
import pandas as pd
import pandas_datareader.data as web
style.use('ggplot')
start = dt.datetime(2011, 1, 1)
end = dt.datetime(2019, 10, 30)
df = web.DataReader('TSLA', 'yahoo', start, end)
print(df.tail(6))
-------------------------------
#log
High Low Open Close Volume Adj Close
Date
2019-10-23 256.140015 251.350006 254.500000 254.679993 5261100 254.679993
2019-10-24 304.929993 289.200012 298.369995 299.679993 29720900 299.679993
2019-10-25 330.000000 296.109985 297.720001 328.130005 29982400 328.130005
2019-10-28 340.839996 322.600006 327.540009 327.709991 18860900 327.709991
2019-10-29 324.299988 314.750000 319.989990 316.220001 12673300 316.220001
2019-10-30 318.790009 309.970001 313.000000 315.010010 9637000 315.010010
-------------------------------
#log print(df.head())
High Low Open Close Volume Adj Close
Date
2011-01-03 27.000000 25.900000 26.84 26.620001 1283000 26.620001
2011-01-04 26.950001 26.020000 26.66 26.670000 1187400 26.670000
2011-01-05 26.900000 26.190001 26.48 26.830000 1446700 26.830000
2011-01-06 28.000000 26.809999 26.83 27.879999 2061200 27.879999
2011-01-07 28.580000 27.900000 28.00 28.240000 2247900 28.240000
reference:
https://www.youtube.com/watch?v=2BrpKpWwT2A&list=PLQVvvaa0QuDcOdF96TBtRtuQksErCEBYZ&index=1
No comments:
Post a Comment