You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Usually {\ft urllib} is used to download data posted online. The challenge may be parsing the data (converting from the representation used to post it to a proper Python representation).
1748
1748
1749
-
In the following, we create a simple helper class that can download data from Yahoo! Finance and convert each stock's historical data into a list of dictionaries. Each list element corresponds to a trading day of history of the stock, and each dictionary stores the data relative to that trading day (date, open, close, volume, adjusted close, arithmetic\_return, log\_return, etc.):
1749
+
In the following, we create a simple helper class that can download data from Yahoo! Finance and Google Finance and convert each stock's historical data into a list of dictionaries. Each list element corresponds to a trading day of history of the stock, and each dictionary stores the data relative to that trading day (date, open, close, volume, adjusted close, arithmetic\_return, log\_return, etc.):
1750
1750
1751
1751
\index{class!YStock}
1752
1752
@@ -1763,9 +1763,12 @@ \section*{Acknowledgments}
1763
1763
>>> h = google.historical()
1764
1764
>>> last_adjusted_close = h[-1]['adjusted_close']
1765
1765
>>> last_log_return = h[-1]['log_return']
1766
+
previous version of this code user Yahoo for historical data
1767
+
but Yahoo changed API and blocked them, moving to Google finance.
0 commit comments