July 2019
Beginner to intermediate
740 pages
16h 52m
English
The StockReader class provides the get_bitcoin_data() method for the extraction of bitcoin data. This method uses the read_html() function from pandas to pull out any data in HTML table elements from a given web page. The page on the CoinMarketCap site where the data is coming from only contains a single table with the data we want, so we select the first element in the list of dataframes returned by pd.read_html():
@label_sanitizerdef get_bitcoin_data(self): """ Get bitcoin historical OHLC data from coinmarketcap.com for given date range. Returns: A pandas dataframe with the bitcoin data. """ return pd.read_html( 'https://coinmarketcap.com/' 'currencies/bitcoin/historical-data/?' 'start={}&end={}'.format(self.start, ...Read now
Unlock full access