Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
packtpublishing
GitHub Repository: packtpublishing/machine-learning-for-algorithmic-trading-second-edition
Path: blob/master/data/create_stooq_data.ipynb
2908 views
Kernel: Python [conda env:ml4t]

Download and store STOOQ data

This notebook contains information on downloading the STOOQ stock and ETF price data that we use in Chapter 09 for a pairs trading strategy based on cointegration and Chapter 11 for a long-short strategy using Random Forest return predictions.

Imports & Settings

import warnings warnings.filterwarnings('ignore')
from pathlib import Path import requests from io import BytesIO from zipfile import ZipFile, BadZipFile import numpy as np import pandas as pd import pandas_datareader.data as web from sklearn.datasets import fetch_openml pd.set_option('display.expand_frame_repr', False)

Set Data Store path

Modify the path to the DATA_STORE if you would like to store the data elsewhere and change the notebooks accordingly

DATA_STORE = Path('assets.h5')

Stooq Historical Market Data

Note that the below downloading details may change at any time as Stooq updates their website; if you encounter errors, please inspect their website and raise a GitHub issue to let us know so we can update the information.

Update 12/2020: please note that STOOQ will disable automatic downloads and require CAPTCHA starting Dec 10, 2020 so that the code that downloads and unpacks the zip files will no longer work; please navigate to their website here for manual download.

Download price data

  1. Download price data for the selected combination of asset class, market and frequency from the Stooq website

  2. Store the result under stooq using the preferred folder structure outlined on the website. It has the structure: /data/freq/market/asset_class, such as /data/daily/us/nasdaq etfs.

stooq_path = Path('stooq') if not stooq_path.exists(): stooq_path.mkdir()

Use the symbol for the market you want to download price data for. In this book we'll be useing us and jp.

STOOQ_URL = 'https://static.stooq.com/db/h/'
def download_price_data(market='us'): data_url = f'd_{market}_txt.zip' response = requests.get(STOOQ_URL + data_url).content with ZipFile(BytesIO(response)) as zip_file: for i, file in enumerate(zip_file.namelist()): if not file.endswith('.txt'): continue local_file = stooq_path / file local_file.parent.mkdir(parents=True, exist_ok=True) with local_file.open('wb') as output: for line in zip_file.open(file).readlines(): output.write(line)
for market in ['us', 'jp']: download_price_data(market=market)

Add symbols

Add the corresponding symbols, i.e., tickers and names by following the directory tree on the same site. You can also adapt the following code snippet using the appropriate asset code that you find by inspecting the url; this example works for NASDAQ ETFs that have code g=69:

df = pd.read_csv('https://stooq.com/db/l/?g=69', sep=' ').apply(lambda x: x.str.strip()) df.columns = ['ticker', 'name'] df.drop_duplicates('ticker').to_csv('stooq/data/tickers/us/nasdaq etfs.csv', index=False)
metadata_dict = { ('jp', 'tse etfs'): 34, ('jp', 'tse stocks'): 32, ('us', 'nasdaq etfs'): 69, ('us', 'nasdaq stocks'): 27, ('us', 'nyse etfs'): 70, ('us', 'nyse stocks'): 28, ('us', 'nysemkt stocks'): 26 }
for (market, asset_class), code in metadata_dict.items(): df = pd.read_csv(f'https://stooq.com/db/l/?g={code}', sep=' ').apply(lambda x: x.str.strip()) df.columns = ['ticker', 'name'] df = df.drop_duplicates('ticker').dropna() print(market, asset_class, f'# tickers: {df.shape[0]:,.0f}') path = stooq_path / 'tickers' / market if not path.exists(): path.mkdir(parents=True) df.to_csv(path / f'{asset_class}.csv', index=False)
jp tse etfs # tickers: 321 jp tse stocks # tickers: 3,732 us nasdaq etfs # tickers: 171 us nasdaq stocks # tickers: 3,570 us nyse etfs # tickers: 1,023 us nyse stocks # tickers: 3,969 us nysemkt stocks # tickers: 298

Store price data in HDF5 format

To speed up loading, we store the price data in HDF format. The function get_stooq_prices_and_symbols loads data assuming the directory structure described above and takes the following arguments:

  • frequency (see Stooq website for options as these may change; default is daily

  • market (default: us), and

  • asset class (default: nasdaq etfs.

It removes files that do not have data or do not appear in the corresponding list of symbols.

def get_stooq_prices_and_tickers(frequency='daily', market='us', asset_class='nasdaq etfs'): prices = [] tickers = (pd.read_csv(stooq_path / 'tickers' / market / f'{asset_class}.csv')) if frequency in ['5 min', 'hourly']: parse_dates = [['date', 'time']] date_label = 'date_time' else: parse_dates = ['date'] date_label = 'date' names = ['ticker', 'freq', 'date', 'time', 'open', 'high', 'low', 'close','volume', 'openint'] usecols = ['ticker', 'open', 'high', 'low', 'close', 'volume'] + parse_dates path = stooq_path / 'data' / frequency / market / asset_class print(path.as_posix()) files = path.glob('**/*.txt') for i, file in enumerate(files, 1): if i % 500 == 0: print(i) if file.stem not in set(tickers.ticker.str.lower()): print(file.stem, 'not available') file.unlink() else: try: df = (pd.read_csv( file, names=names, usecols=usecols, header=0, parse_dates=parse_dates)) prices.append(df) except pd.errors.EmptyDataError: print('\tdata missing', file.stem) file.unlink() prices = (pd.concat(prices, ignore_index=True) .rename(columns=str.lower) .set_index(['ticker', date_label]) .apply(lambda x: pd.to_numeric(x, errors='coerce'))) return prices, tickers

We'll be using US equities and ETFs in Chapter 9 and and Japanese equities in Chapter 11. The following code collects the price data for the period 2000-2019 and stores it with the corresponding symbols in the global assets.h5 store:

# load some Japanese and all US assets for 2000-2019 markets = {'jp': ['tse stocks'], 'us': ['nasdaq etfs', 'nasdaq stocks', 'nyse etfs', 'nyse stocks', 'nysemkt stocks'] } frequency = 'daily' idx = pd.IndexSlice for market, asset_classes in markets.items(): for asset_class in asset_classes: print(f'\n{asset_class}') prices, tickers = get_stooq_prices_and_tickers(frequency=frequency, market=market, asset_class=asset_class) prices = prices.sort_index().loc[idx[:, '2000': '2019'], :] names = prices.index.names prices = (prices .reset_index() .drop_duplicates() .set_index(names) .sort_index()) print('\nNo. of observations per asset') print(prices.groupby('ticker').size().describe()) key = f'stooq/{market}/{asset_class.replace(" ", "/")}/' print(prices.info(null_counts=True)) prices.to_hdf(DATA_STORE, key + 'prices', format='t') print(tickers.info()) tickers.to_hdf(DATA_STORE, key + 'tickers', format='t')
tse stocks stooq/data/daily/jp/tse stocks 8729.jp not available 8044.jp not available 8885.jp not available 500 7873.jp not available 7891.jp not available 1000 6889.jp not available 8692.jp not available 7684.jp not available 1500 2000 2417.jp not available 2500 3756.jp not available 3606.jp not available 3171.jp not available 3000 3424.jp not available 6065.jp not available 3258.jp not available 3500 4217.jp not available No. of observations per asset count 3664.000000 mean 2806.534116 std 1177.053371 min 1.000000 25% 2150.000000 50% 3041.000000 75% 3621.000000 max 5716.000000 dtype: float64 <class 'pandas.core.frame.DataFrame'> MultiIndex: 10283141 entries, ('1301.JP', Timestamp('2005-03-22 00:00:00')) to ('9997.JP', Timestamp('2019-12-30 00:00:00')) Data columns (total 5 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 open 10283141 non-null float64 1 high 10283141 non-null float64 2 low 10283141 non-null float64 3 close 10283141 non-null float64 4 volume 10283141 non-null int64 dtypes: float64(4), int64(1) memory usage: 431.6+ MB None <class 'pandas.core.frame.DataFrame'> RangeIndex: 3732 entries, 0 to 3731 Data columns (total 2 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 ticker 3732 non-null object 1 name 3732 non-null object dtypes: object(2) memory usage: 58.4+ KB None nasdaq etfs stooq/data/daily/us/nasdaq etfs dslv.us not available uslv.us not available ziv.us not available hynd.us not available viix.us not available istb.us not available agnd.us not available gulf.us not available dvy.us not available tvix.us not available ugld.us not available bscn.us not available snln.us not available dgld.us not available bsjo.us not available emcg.us not available No. of observations per asset count 171.000000 mean 2104.748538 std 883.154960 min 74.000000 25% 1473.500000 50% 2079.000000 75% 2634.500000 max 5031.000000 dtype: float64 <class 'pandas.core.frame.DataFrame'> MultiIndex: 359912 entries, ('AAXJ.US', Timestamp('2008-08-15 00:00:00')) to ('YLCO.US', Timestamp('2019-12-31 00:00:00')) Data columns (total 5 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 open 359912 non-null float64 1 high 359912 non-null float64 2 low 359912 non-null float64 3 close 359912 non-null float64 4 volume 359912 non-null int64 dtypes: float64(4), int64(1) memory usage: 15.1+ MB None <class 'pandas.core.frame.DataFrame'> RangeIndex: 171 entries, 0 to 170 Data columns (total 2 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 ticker 171 non-null object 1 name 171 non-null object dtypes: object(2) memory usage: 2.8+ KB None nasdaq stocks stooq/data/daily/us/nasdaq stocks sva.us not available rose.us not available nebuu.us not available pgnx.us not available ocsll.us not available totau.us not available tgen.us not available msbf.us not available nurow.us not available rtix.us not available webk.us not available ntgn.us not available srva.us not available mlnx.us not available tecd.us not available stml.us not available tzacu.us not available wrlsr.us not available pbbi.us not available wrlsu.us not available xog.us not available tdacu.us not available 500 song.us not available ptla.us not available songw.us not available paacr.us not available torc.us not available slim.us not available vtiqu.us not available tivo.us not available roseu.us not available mnlo.us not available saex.us not available opgnw.us not available valx.us not available rarx.us not available pacq.us not available tacow.us not available osbcp.us not available palt.us not available 1000 shlo.us not available smrt.us not available opb.us not available paac.us not available sito.us not available nebu.us not available sphs.us not available rbzhf.us not available znwaa.us not available pope.us not available paacw.us not available trpx.us not available tlf.us not available rubi.us not available rosew.us not available tsg.us not available ubio.us not available nebuw.us not available pub.us not available sorl.us not available pegi.us not available tuesq.us not available srtsw.us not available paacu.us not available syne.us not available pacqw.us not available zbio.us not available sjoyw.us not available otg.us not available 1500 tcrd.us not available mudsu.us not available zionw.us not available org.us not available qbak.us not available twmc.us not available zn.us not available vvus.us not available ottw.us not available trnx.us not available pnrly.us not available pstvz.us not available lk.us not available bntcw.us not available csfl.us not available evstc.us not available evsi.us not available lsxmr.us not available fomx.us not available algr.us not available fdef.us not available dbcp.us not available algrr.us not available cats.us not available 2000 flrz.us not available emms.us not available kbwp.us not available loacu.us not available caro.us not available cyou.us not available hhhhr.us not available fllc.us not available corv.us not available ftrcq.us not available ibkco.us not available ahi.us not available ctrcq.us not available ent.us not available 2500 akrxq.us not available mfsf.us not available chngv.us not available mini.us not available bcom.us not available actt.us not available cvti.us not available evsiw.us not available habt.us not available ibkc.us not available bvsnq.us not available fllcw.us not available cyrxw.us not available ddmxu.us not available gpaq.us not available iots.us not available elgx.us not available imvtw.us not available kblmu.us not available fllcu.us not available fsbc.us not available ibkcp.us not available alacu.us not available ftsv.us not available 3000 asna.us not available eri.us not available deacu.us not available evlmc.us not available edtxw.us not available gbdcr.us not available acttw.us not available algrw.us not available gcvrz.us not available dnjr.us not available afh.us not available bvxvw.us not available aryau.us not available acttu.us not available gblk.us not available aryaw.us not available gpaqw.us not available aytup.us not available algru.us not available dkngw.us not available dmpi.us not available bwmxw.us not available hyxe.us not available 3500 imvtu.us not available innt.us not available ctacu.us not available drmt.us not available evgbc.us not available dfnsu.us not available cy.us not available hhhhu.us not available intl.us not available kmph.us not available club.us not available inapq.us not available ibkcn.us not available gpaqu.us not available No. of observations per asset count 3147.000000 mean 2038.690817 std 1556.230972 min 1.000000 25% 530.000000 50% 1646.000000 75% 3722.000000 max 10062.000000 dtype: float64 <class 'pandas.core.frame.DataFrame'> MultiIndex: 6415760 entries, ('AACG.US', Timestamp('2008-01-28 00:00:00')) to ('ZYXI.US', Timestamp('2019-12-31 00:00:00')) Data columns (total 5 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 open 6415760 non-null float64 1 high 6415760 non-null float64 2 low 6415760 non-null float64 3 close 6415760 non-null float64 4 volume 6415760 non-null int64 dtypes: float64(4), int64(1) memory usage: 269.3+ MB None <class 'pandas.core.frame.DataFrame'> RangeIndex: 3570 entries, 0 to 3569 Data columns (total 2 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 ticker 3570 non-null object 1 name 3570 non-null object dtypes: object(2) memory usage: 55.9+ KB None nyse etfs stooq/data/daily/us/nyse etfs flag.us not available ejul.us not available kbwr.us not available flat.us not available dvop.us not available jpge.us not available dtys.us not available ugaz.us not available dlbs.us not available axjl.us not available hspx.us not available gce.us not available 500 drr.us not available olem.us not available dgaz.us not available gsc.us not available dtul.us not available tur.us not available jjp.us not available dto.us not available pgj.us not available spyb.us not available bsjk.us not available 1000 stpp.us not available No. of observations per asset count 983.000000 mean 2477.645982 std 1002.603761 min 8.000000 25% 1708.000000 50% 2607.000000 75% 3341.000000 max 3738.000000 dtype: float64 <class 'pandas.core.frame.DataFrame'> MultiIndex: 2435526 entries, ('AADR.US', Timestamp('2010-07-21 00:00:00')) to ('ZSL.US', Timestamp('2019-12-31 00:00:00')) Data columns (total 5 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 open 2435526 non-null float64 1 high 2435526 non-null float64 2 low 2435526 non-null float64 3 close 2435526 non-null float64 4 volume 2435526 non-null int64 dtypes: float64(4), int64(1) memory usage: 102.2+ MB None <class 'pandas.core.frame.DataFrame'> RangeIndex: 1023 entries, 0 to 1022 Data columns (total 2 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 ticker 1023 non-null object 1 name 1023 non-null object dtypes: object(2) memory usage: 16.1+ KB None nyse stocks stooq/data/daily/us/nyse stocks vvnt-ws.us not available vrt-ws.us not available vst-ws-a.us not available wpf-ws.us not available zayo.us not available xrf.us not available xth.us not available yac-ws.us not available vygg-u.us not available sswa.us not available paca.us not available sitc_a.us not available schw_d.us not available ipoc-u.us not available treb-u.us not available jnmf.us not available pmvc-u.us not available tblu.us not available per.us not available trne-u.us not available obelf.us not available sbe-ws.us not available nycb_a.us not available rtn.us not available treb-ws.us not available tlra.us not available nref_a.us not available shll-ws.us not available kcac-u.us not available mitt_a.us not available iret_c.us not available voya_b.us not available 500 pcpl-u.us not available prif_b.us not available jjt.us not available piy.us not available prif_f.us not available vam.us not available lgvw-u.us not available srf.us not available rtl.us not available tap-a.us not available jphf.us not available pic-ws.us not available jjc.us not available loak-u.us not available nycb_u.us not available ryzz.us not available msus.us not available loak-ws.us not available oac-ws.us not available schw_c.us not available kcac-ws.us not available val.us not available jmf.us not available trtn_a.us not available rrts.us not available nsco-ws.us not available tdw-ws-a.us not available star_d.us not available rbs.us not available ne.us not available utx-w.us not available tdw-ws-b.us not available psth-ws.us not available pana-ws.us not available star_g.us not available sdrl.us not available rexr_a.us not available julz.us not available prif_e.us not available mitt_c.us not available rtw.us not available seah-u.us not available rbac-ws.us not available piai-u.us not available tcrw.us not available 1000 kdp.us not available rpla-ws.us not available ipob-u.us not available rexr_b.us not available trtn_c.us not available jcap_b.us not available ssinq.us not available lvhe.us not available ryce.us not available prif_d.us not available ltmaq.us not available jmlp.us not available spaq-ws.us not available mitt_b.us not available vceb.us not available royt.us not available pana-u.us not available oilx.us not available klr.us not available utz-ws.us not available vgac-u.us not available tbjl.us not available oxy-ws.us not available tcrz.us not available spn.us not available mstb.us not available vjet.us not available omn.us not available pgm.us not available oxy-ws-w.us not available mlti.us not available prpb-ws.us not available waas.us not available 1500 sdag.us not available mne.us not available snpr-u.us not available lgvw-ws.us not available pol.us not available wbc.us not available qhc.us not available splp_a.us not available rbac-u.us not available sftw-u.us not available swp.us not available pack-ws.us not available ipob-ws.us not available stpk-u.us not available scvx-ws.us not available stag_c.us not available oppr-w.us not available trne-ws.us not available shll-u.us not available twnd-u.us not available star_i.us not available nmfx.us not available jpls.us not available scpe-u.us not available jih-ws.us not available rmg-ws.us not available mfac-ws.us not available prpb-u.us not available sepz.us not available lvhb.us not available soac-u.us not available jpgb.us not available pyx.us not available sitc_k.us not available ipoc-ws.us not available ktp.us not available psa_v.us not available tfjl.us not available pdac-u.us not available jpeu.us not available 2000 mxde.us not available leap-u.us not available ngls_a.us not available spaq-u.us not available jmei.us not available untcq.us not available lmha.us not available vgfo.us not available vert-u.us not available jpmf.us not available rpla-u.us not available kem.us not available jws-ws.us not available lgc-ws.us not available s.us not available psv.us not available prif_c.us not available oacb-u.us not available soac-ws.us not available mfac-u.us not available prif_a.us not available lhc.us not available rexr_c.us not available tlrd.us not available nmfc.us not available scpe-ws.us not available trtn_b.us not available psth-u.us not available tsoc.us not available scvx-u.us not available wchn.us not available pcpl-ws.us not available trtn_d.us not available sftw-ws.us not available tge.us not available nfh-ws.us not available lmhb.us not available oibr-c.us not available jped.us not available sbna.us not available ipv-ws.us not available octz.us not available chx-w.us not available dvp.us not available aptv_a.us not available inf.us not available codi_b.us not available faii-u.us not available avx.us not available ctl.us not available fuse-u.us not available avan-u.us not available jcpnq.us not available fvac-ws.us not available dgnr-u.us not available codi_a.us not available 2500 djul.us not available clny_h.us not available gsah-ws.us not available ali_b.us not available ftai_a.us not available ccac-ws.us not available hmlp_a.us not available dyls.us not available bldg.us not available hyln-ws.us not available chap.us not available cbo.us not available gmre_a.us not available agn.us not available cmre_e.us not available inxn.us not available dboc.us not available chkr.us not available cmre_d.us not available dlng_b.us not available fg-ws.us not available fgna-u.us not available cvia.us not available fsep.us not available crhc-u.us not available cciv-u.us not available gtx.us not available cpsr-u.us not available cubi_c.us not available ccxx-u.us not available chmi_b.us not available enpc-u.us not available funl.us not available eqm.us not available cubi_d.us not available alin_a.us not available bufr.us not available 3000 alus-u.us not available fpac-ws.us not available deh-ws.us not available avtr_a.us not available dsep.us not available graf-u.us not available inst.us not available ally_a.us not available diet.us not available ctst.us not available aone-u.us not available bmrg-u.us not available hsbc_a.us not available bdxa.us not available cubi_e.us not available codi_c.us not available gnc.us not available dxb_.us not available insw_a.us not available dsoc.us not available ares_a.us not available ccac-u.us not available embd.us not available fvac-u.us not available bal.us not available banc_d.us not available fjul.us not available dlng_a.us not available celg-r.us not available dfns-u.us not available cch.us not available hewi.us not available aks.us not available hcr.us not available gleo-ws.us not available apsg-u.us not available bcrhf.us not available ccxx-ws.us not available clii-u.us not available argo_a.us not available hpx-ws.us not available atco_e.us not available crc.us not available gsah-u.us not available jbn.us not available 3500 hzac-u.us not available eumf.us not available chk_d.us not available eros.us not available haud.us not available aep.us not available gleo-u.us not available aspl-u.us not available dnr.us not available css.us not available impx-u.us not available axe.us not available hhs.us not available dms-ws.us not available bepc-w.us not available ftai_b.us not available clny_j.us not available atco_g.us not available atco_i.us not available cpsr-ws.us not available alus-ws.us not available jbr.us not available bsjn.us not available dmyd-u.us not available glog_a.us not available chmi_a.us not available iipr_a.us not available ect.us not available avh.us not available graf-ws.us not available acnd-u.us not available iaca-u.us not available azn.us not available asaq-u.us not available inteq.us not available glop_a.us not available bmrg-ws.us not available clny_i.us not available chk.us not available gik-ws.us not available glop_b.us not available cmre_c.us not available bbp.us not available ayr.us not available grx_a.us not available adfi.us not available alin_e.us not available fuse-ws.us not available goac-u.us not available corr_a.us not available aig-ws.us not available ftsi.us not available fpac-u.us not available atco_d.us not available 4000 alin_b.us not available clny_g.us not available altg-ws.us not available apha.us not available ccx-ws.us not available atco_h.us not available glby.us not available hfro_a.us not available banc_e.us not available dofsq.us not available dmyt-ws.us not available goac-ws.us not available dmyt-u.us not available easi.us not available faii-ws.us not available acnd-ws.us not available cch-ws.us not available cubi_f.us not available hjv.us not available feac-u.us not available bip-w.us not available ali_e.us not available cbx.us not available bgg.us not available augz.us not available fg.us not available cwen-a.us not available dgnr-ws.us not available ali_a.us not available cmre_b.us not available ambc-ws.us not available gix-ws.us not available dfns-ws.us not available glop_c.us not available feac-ws.us not available cciv-ws.us not available 4500 No. of observations per asset count 3672.000000 mean 2174.136438 std 1715.610457 min 1.000000 25% 591.000000 50% 1770.000000 75% 3737.000000 max 10062.000000 dtype: float64 <class 'pandas.core.frame.DataFrame'> MultiIndex: 7983429 entries, ('A.US', Timestamp('2000-01-03 00:00:00')) to ('ZYME.US', Timestamp('2019-12-31 00:00:00')) Data columns (total 5 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 open 7983429 non-null float64 1 high 7983429 non-null float64 2 low 7983429 non-null float64 3 close 7983429 non-null float64 4 volume 7983429 non-null int64 dtypes: float64(4), int64(1) memory usage: 335.1+ MB None <class 'pandas.core.frame.DataFrame'> RangeIndex: 3969 entries, 0 to 3968 Data columns (total 2 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 ticker 3969 non-null object 1 name 3969 non-null object dtypes: object(2) memory usage: 62.1+ KB None nysemkt stocks stooq/data/daily/us/nysemkt stocks phge-u.us not available micr.us not available chaq-ws.us not available sgb.us not available ltsl.us not available lts_a.us not available arnc_.us not available nspr-ws-b.us not available tdw-ws.us not available alo.us not available chaq-u.us not available phge-ws.us not available plym_a.us not available ptk-ws.us not available klr-ws.us not available nspr-ws.us not available ltsf.us not available ltsk.us not available sdi.us not available llex.us not available ycbd_a.us not available yumaq.us not available rif.us not available biox-ws.us not available brmk-ws.us not available lbyyq.us not available talo-ws.us not available ltsh.us not available cuo.us not available uuuu-ws.us not available No. of observations per asset count 283.000000 mean 2630.572438 std 1260.978958 min 4.000000 25% 1583.000000 50% 3312.000000 75% 3721.500000 max 5029.000000 dtype: float64 <class 'pandas.core.frame.DataFrame'> MultiIndex: 744452 entries, ('AAMC.US', Timestamp('2012-12-13 00:00:00')) to ('ZOM.US', Timestamp('2019-12-31 00:00:00')) Data columns (total 5 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 open 744452 non-null float64 1 high 744452 non-null float64 2 low 744452 non-null float64 3 close 744452 non-null float64 4 volume 744452 non-null int64 dtypes: float64(4), int64(1) memory usage: 31.3+ MB None <class 'pandas.core.frame.DataFrame'> RangeIndex: 298 entries, 0 to 297 Data columns (total 2 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 ticker 298 non-null object 1 name 298 non-null object dtypes: object(2) memory usage: 4.8+ KB None