From d0410c5f4d5fc97b6e64181cfca3f8b28d993526 Mon Sep 17 00:00:00 2001 From: Zach Coriarty Date: Wed, 5 Jan 2022 12:58:57 -0500 Subject: [PATCH] Alphavantage documentation --- JupyterNotebooks/Alphavantage.ipynb | 1615 ++++++++++++++++++++++++++- Source/Alphavantage.rst | 395 ++++--- 2 files changed, 1799 insertions(+), 211 deletions(-) diff --git a/JupyterNotebooks/Alphavantage.ipynb b/JupyterNotebooks/Alphavantage.ipynb index 4cbcae3..7abd8aa 100644 --- a/JupyterNotebooks/Alphavantage.ipynb +++ b/JupyterNotebooks/Alphavantage.ipynb @@ -52,7 +52,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 1, "metadata": {}, "outputs": [], "source": [ @@ -687,6 +687,1090 @@ "earnings_calendar_api(api_key,horizon[0])" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Dividends" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Symbol': 'IBM',\n", + " 'AssetType': 'Common Stock',\n", + " 'Name': 'International Business Machines Corporation',\n", + " 'Description': 'International Business Machines Corporation (IBM) is an American multinational technology company headquartered in Armonk, New York, with operations in over 170 countries. The company began in 1911, founded in Endicott, New York, as the Computing-Tabulating-Recording Company (CTR) and was renamed International Business Machines in 1924. IBM is incorporated in New York. IBM produces and sells computer hardware, middleware and software, and provides hosting and consulting services in areas ranging from mainframe computers to nanotechnology. IBM is also a major research organization, holding the record for most annual U.S. patents generated by a business (as of 2020) for 28 consecutive years. Inventions by IBM include the automated teller machine (ATM), the floppy disk, the hard disk drive, the magnetic stripe card, the relational database, the SQL programming language, the UPC barcode, and dynamic random-access memory (DRAM). The IBM mainframe, exemplified by the System/360, was the dominant computing platform during the 1960s and 1970s.',\n", + " 'CIK': '51143',\n", + " 'Exchange': 'NYSE',\n", + " 'Currency': 'USD',\n", + " 'Country': 'USA',\n", + " 'Sector': 'TECHNOLOGY',\n", + " 'Industry': 'COMPUTER & OFFICE EQUIPMENT',\n", + " 'Address': '1 NEW ORCHARD ROAD, ARMONK, NY, US',\n", + " 'FiscalYearEnd': 'December',\n", + " 'LatestQuarter': '2021-09-30',\n", + " 'MarketCapitalization': '123710087000',\n", + " 'EBITDA': '15659000000',\n", + " 'PERatio': '26.13',\n", + " 'PEGRatio': '2.154',\n", + " 'BookValue': '24.79',\n", + " 'DividendPerShare': '6.54',\n", + " 'DividendYield': '0.0482',\n", + " 'EPS': '5.28',\n", + " 'RevenuePerShareTTM': '83.23',\n", + " 'ProfitMargin': '0.064',\n", + " 'OperatingMarginTTM': '0.12',\n", + " 'ReturnOnAssetsTTM': '0.0374',\n", + " 'ReturnOnEquityTTM': '0.214',\n", + " 'RevenueTTM': '74461004000',\n", + " 'GrossProfitTTM': '35575000000',\n", + " 'DilutedEPSTTM': '5.28',\n", + " 'QuarterlyEarningsGrowthYOY': '-0.338',\n", + " 'QuarterlyRevenueGrowthYOY': '0.003',\n", + " 'AnalystTargetPrice': '145.17',\n", + " 'TrailingPE': '26.13',\n", + " 'ForwardPE': '10.86',\n", + " 'PriceToSalesRatioTTM': '1.661',\n", + " 'PriceToBookRatio': '5.01',\n", + " 'EVToRevenue': '2.178',\n", + " 'EVToEBITDA': '12.51',\n", + " 'Beta': '1.104',\n", + " '52WeekHigh': '142.43',\n", + " '52WeekLow': '106.73',\n", + " '50DayMovingAverage': '122.65',\n", + " '200DayMovingAverage': '131.76',\n", + " 'SharesOutstanding': '896320000',\n", + " 'DividendDate': '2021-12-10',\n", + " 'ExDividendDate': '2021-11-09'}" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ticker = \"IBM\"\n", + "url = 'https://www.alphavantage.co/query?function=OVERVIEW&symbol='+ticker+'&apikey={key}'\n", + "r = requests.get(url)\n", + "data = r.json()\n", + "dividends = pd.DataFrame(data, index = ['Values'])\n", + "dividends = dividends[['DividendPerShare', 'DividendYield', 'DividendDate', 'ExDividendDate']].T\n", + "data\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Indices" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Global Quote': {}}" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "index = \"DJI\" # FCHI, IXIC, ...\n", + "url = 'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol='+index+'&outputsize=full&apikey={key}'\n", + "r = requests.get(url)\n", + "data = r.json()\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Currency Exchange" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Meta Data': {'1. Information': 'FX Intraday (5min) Time Series',\n", + " '2. From Symbol': 'EUR',\n", + " '3. To Symbol': 'USD',\n", + " '4. Last Refreshed': '2022-01-05 17:15:00',\n", + " '5. Interval': '5min',\n", + " '6. Output Size': 'Compact',\n", + " '7. Time Zone': 'UTC'},\n", + " 'Time Series FX (5min)': {'2022-01-05 17:15:00': {'1. open': '1.13372',\n", + " '2. high': '1.13378',\n", + " '3. low': '1.13350',\n", + " '4. close': '1.13350'},\n", + " '2022-01-05 17:10:00': {'1. open': '1.13368',\n", + " '2. high': '1.13392',\n", + " '3. low': '1.13340',\n", + " '4. close': '1.13375'},\n", + " '2022-01-05 17:05:00': {'1. open': '1.13341',\n", + " '2. high': '1.13375',\n", + " '3. low': '1.13310',\n", + " '4. close': '1.13350'},\n", + " '2022-01-05 17:00:00': {'1. open': '1.13300',\n", + " '2. high': '1.13347',\n", + " '3. low': '1.13280',\n", + " '4. close': '1.13342'},\n", + " '2022-01-05 16:55:00': {'1. open': '1.13327',\n", + " '2. high': '1.13334',\n", + " '3. low': '1.13280',\n", + " '4. close': '1.13298'},\n", + " '2022-01-05 16:50:00': {'1. open': '1.13317',\n", + " '2. high': '1.13327',\n", + " '3. low': '1.13270',\n", + " '4. close': '1.13325'},\n", + " '2022-01-05 16:45:00': {'1. open': '1.13270',\n", + " '2. high': '1.13324',\n", + " '3. low': '1.13270',\n", + " '4. close': '1.13319'},\n", + " '2022-01-05 16:40:00': {'1. open': '1.13276',\n", + " '2. high': '1.13323',\n", + " '3. low': '1.13260',\n", + " '4. close': '1.13294'},\n", + " '2022-01-05 16:35:00': {'1. open': '1.13266',\n", + " '2. high': '1.13282',\n", + " '3. low': '1.13230',\n", + " '4. close': '1.13279'},\n", + " '2022-01-05 16:30:00': {'1. open': '1.13264',\n", + " '2. high': '1.13270',\n", + " '3. low': '1.13210',\n", + " '4. close': '1.13263'},\n", + " '2022-01-05 16:25:00': {'1. open': '1.13332',\n", + " '2. high': '1.13337',\n", + " '3. low': '1.13240',\n", + " '4. close': '1.13264'},\n", + " '2022-01-05 16:20:00': {'1. open': '1.13382',\n", + " '2. high': '1.13388',\n", + " '3. low': '1.13320',\n", + " '4. close': '1.13332'},\n", + " '2022-01-05 16:15:00': {'1. open': '1.13387',\n", + " '2. high': '1.13396',\n", + " '3. low': '1.13360',\n", + " '4. close': '1.13381'},\n", + " '2022-01-05 16:10:00': {'1. open': '1.13364',\n", + " '2. high': '1.13392',\n", + " '3. low': '1.13350',\n", + " '4. close': '1.13387'},\n", + " '2022-01-05 16:05:00': {'1. open': '1.13369',\n", + " '2. high': '1.13373',\n", + " '3. low': '1.13320',\n", + " '4. close': '1.13364'},\n", + " '2022-01-05 16:00:00': {'1. open': '1.13367',\n", + " '2. high': '1.13382',\n", + " '3. low': '1.13320',\n", + " '4. close': '1.13369'},\n", + " '2022-01-05 15:55:00': {'1. open': '1.13354',\n", + " '2. high': '1.13381',\n", + " '3. low': '1.13300',\n", + " '4. close': '1.13369'},\n", + " '2022-01-05 15:50:00': {'1. open': '1.13360',\n", + " '2. high': '1.13394',\n", + " '3. low': '1.13330',\n", + " '4. close': '1.13355'},\n", + " '2022-01-05 15:45:00': {'1. open': '1.13330',\n", + " '2. high': '1.13378',\n", + " '3. low': '1.13310',\n", + " '4. close': '1.13360'},\n", + " '2022-01-05 15:40:00': {'1. open': '1.13342',\n", + " '2. high': '1.13357',\n", + " '3. low': '1.13310',\n", + " '4. close': '1.13328'},\n", + " '2022-01-05 15:35:00': {'1. open': '1.13367',\n", + " '2. high': '1.13383',\n", + " '3. low': '1.13320',\n", + " '4. close': '1.13340'},\n", + " '2022-01-05 15:30:00': {'1. open': '1.13421',\n", + " '2. high': '1.13425',\n", + " '3. low': '1.13340',\n", + " '4. close': '1.13373'},\n", + " '2022-01-05 15:25:00': {'1. open': '1.13439',\n", + " '2. high': '1.13439',\n", + " '3. low': '1.13390',\n", + " '4. close': '1.13410'},\n", + " '2022-01-05 15:20:00': {'1. open': '1.13432',\n", + " '2. high': '1.13441',\n", + " '3. low': '1.13390',\n", + " '4. close': '1.13430'},\n", + " '2022-01-05 15:15:00': {'1. open': '1.13390',\n", + " '2. high': '1.13440',\n", + " '3. low': '1.13370',\n", + " '4. close': '1.13431'},\n", + " '2022-01-05 15:10:00': {'1. open': '1.13437',\n", + " '2. high': '1.13440',\n", + " '3. low': '1.13380',\n", + " '4. close': '1.13403'},\n", + " '2022-01-05 15:05:00': {'1. open': '1.13357',\n", + " '2. high': '1.13437',\n", + " '3. low': '1.13340',\n", + " '4. close': '1.13430'},\n", + " '2022-01-05 15:00:00': {'1. open': '1.13376',\n", + " '2. high': '1.13378',\n", + " '3. low': '1.13310',\n", + " '4. close': '1.13357'},\n", + " '2022-01-05 14:55:00': {'1. open': '1.13376',\n", + " '2. high': '1.13387',\n", + " '3. low': '1.13340',\n", + " '4. close': '1.13377'},\n", + " '2022-01-05 14:50:00': {'1. open': '1.13321',\n", + " '2. high': '1.13381',\n", + " '3. low': '1.13300',\n", + " '4. close': '1.13375'},\n", + " '2022-01-05 14:45:00': {'1. open': '1.13329',\n", + " '2. high': '1.13343',\n", + " '3. low': '1.13300',\n", + " '4. close': '1.13321'},\n", + " '2022-01-05 14:40:00': {'1. open': '1.13331',\n", + " '2. high': '1.13348',\n", + " '3. low': '1.13290',\n", + " '4. close': '1.13330'},\n", + " '2022-01-05 14:35:00': {'1. open': '1.13354',\n", + " '2. high': '1.13378',\n", + " '3. low': '1.13310',\n", + " '4. close': '1.13335'},\n", + " '2022-01-05 14:30:00': {'1. open': '1.13347',\n", + " '2. high': '1.13367',\n", + " '3. low': '1.13320',\n", + " '4. close': '1.13353'},\n", + " '2022-01-05 14:25:00': {'1. open': '1.13298',\n", + " '2. high': '1.13360',\n", + " '3. low': '1.13280',\n", + " '4. close': '1.13340'},\n", + " '2022-01-05 14:20:00': {'1. open': '1.13259',\n", + " '2. high': '1.13301',\n", + " '3. low': '1.13230',\n", + " '4. close': '1.13298'},\n", + " '2022-01-05 14:15:00': {'1. open': '1.13268',\n", + " '2. high': '1.13289',\n", + " '3. low': '1.13240',\n", + " '4. close': '1.13260'},\n", + " '2022-01-05 14:10:00': {'1. open': '1.13300',\n", + " '2. high': '1.13303',\n", + " '3. low': '1.13250',\n", + " '4. close': '1.13267'},\n", + " '2022-01-05 14:05:00': {'1. open': '1.13238',\n", + " '2. high': '1.13303',\n", + " '3. low': '1.13190',\n", + " '4. close': '1.13290'},\n", + " '2022-01-05 14:00:00': {'1. open': '1.13245',\n", + " '2. high': '1.13247',\n", + " '3. low': '1.13190',\n", + " '4. close': '1.13220'},\n", + " '2022-01-05 13:55:00': {'1. open': '1.13281',\n", + " '2. high': '1.13286',\n", + " '3. low': '1.13230',\n", + " '4. close': '1.13244'},\n", + " '2022-01-05 13:50:00': {'1. open': '1.13223',\n", + " '2. high': '1.13288',\n", + " '3. low': '1.13190',\n", + " '4. close': '1.13260'},\n", + " '2022-01-05 13:45:00': {'1. open': '1.13161',\n", + " '2. high': '1.13227',\n", + " '3. low': '1.13120',\n", + " '4. close': '1.13220'},\n", + " '2022-01-05 13:40:00': {'1. open': '1.13095',\n", + " '2. high': '1.13167',\n", + " '3. low': '1.13080',\n", + " '4. close': '1.13157'},\n", + " '2022-01-05 13:35:00': {'1. open': '1.13082',\n", + " '2. high': '1.13143',\n", + " '3. low': '1.13050',\n", + " '4. close': '1.13099'},\n", + " '2022-01-05 13:30:00': {'1. open': '1.13090',\n", + " '2. high': '1.13108',\n", + " '3. low': '1.13030',\n", + " '4. close': '1.13082'},\n", + " '2022-01-05 13:25:00': {'1. open': '1.13089',\n", + " '2. high': '1.13099',\n", + " '3. low': '1.13020',\n", + " '4. close': '1.13070'},\n", + " '2022-01-05 13:20:00': {'1. open': '1.13180',\n", + " '2. high': '1.13183',\n", + " '3. low': '1.13010',\n", + " '4. close': '1.13092'},\n", + " '2022-01-05 13:15:00': {'1. open': '1.13102',\n", + " '2. high': '1.13184',\n", + " '3. low': '1.13080',\n", + " '4. close': '1.13175'},\n", + " '2022-01-05 13:10:00': {'1. open': '1.13115',\n", + " '2. high': '1.13122',\n", + " '3. low': '1.13040',\n", + " '4. close': '1.13101'},\n", + " '2022-01-05 13:05:00': {'1. open': '1.13075',\n", + " '2. high': '1.13134',\n", + " '3. low': '1.13050',\n", + " '4. close': '1.13116'},\n", + " '2022-01-05 13:00:00': {'1. open': '1.13076',\n", + " '2. high': '1.13078',\n", + " '3. low': '1.13030',\n", + " '4. close': '1.13078'},\n", + " '2022-01-05 12:55:00': {'1. open': '1.13065',\n", + " '2. high': '1.13094',\n", + " '3. low': '1.13050',\n", + " '4. close': '1.13074'},\n", + " '2022-01-05 12:50:00': {'1. open': '1.13090',\n", + " '2. high': '1.13109',\n", + " '3. low': '1.13050',\n", + " '4. close': '1.13069'},\n", + " '2022-01-05 12:45:00': {'1. open': '1.13080',\n", + " '2. high': '1.13126',\n", + " '3. low': '1.13060',\n", + " '4. close': '1.13100'},\n", + " '2022-01-05 12:40:00': {'1. open': '1.13130',\n", + " '2. high': '1.13141',\n", + " '3. low': '1.13060',\n", + " '4. close': '1.13060'},\n", + " '2022-01-05 12:35:00': {'1. open': '1.13161',\n", + " '2. high': '1.13176',\n", + " '3. low': '1.13110',\n", + " '4. close': '1.13132'},\n", + " '2022-01-05 12:30:00': {'1. open': '1.13173',\n", + " '2. high': '1.13174',\n", + " '3. low': '1.13140',\n", + " '4. close': '1.13157'},\n", + " '2022-01-05 12:25:00': {'1. open': '1.13186',\n", + " '2. high': '1.13238',\n", + " '3. low': '1.13150',\n", + " '4. close': '1.13171'},\n", + " '2022-01-05 12:20:00': {'1. open': '1.13162',\n", + " '2. high': '1.13261',\n", + " '3. low': '1.13100',\n", + " '4. close': '1.13186'},\n", + " '2022-01-05 12:15:00': {'1. open': '1.13155',\n", + " '2. high': '1.13202',\n", + " '3. low': '1.13140',\n", + " '4. close': '1.13140'},\n", + " '2022-01-05 12:10:00': {'1. open': '1.13172',\n", + " '2. high': '1.13185',\n", + " '3. low': '1.13130',\n", + " '4. close': '1.13153'},\n", + " '2022-01-05 12:05:00': {'1. open': '1.13189',\n", + " '2. high': '1.13204',\n", + " '3. low': '1.13150',\n", + " '4. close': '1.13175'},\n", + " '2022-01-05 12:00:00': {'1. open': '1.13191',\n", + " '2. high': '1.13200',\n", + " '3. low': '1.13150',\n", + " '4. close': '1.13180'},\n", + " '2022-01-05 11:55:00': {'1. open': '1.13205',\n", + " '2. high': '1.13220',\n", + " '3. low': '1.13170',\n", + " '4. close': '1.13180'},\n", + " '2022-01-05 11:50:00': {'1. open': '1.13186',\n", + " '2. high': '1.13221',\n", + " '3. low': '1.13150',\n", + " '4. close': '1.13190'},\n", + " '2022-01-05 11:45:00': {'1. open': '1.13204',\n", + " '2. high': '1.13230',\n", + " '3. low': '1.13170',\n", + " '4. close': '1.13190'},\n", + " '2022-01-05 11:40:00': {'1. open': '1.13195',\n", + " '2. high': '1.13240',\n", + " '3. low': '1.13160',\n", + " '4. close': '1.13190'},\n", + " '2022-01-05 11:35:00': {'1. open': '1.13175',\n", + " '2. high': '1.13209',\n", + " '3. low': '1.13150',\n", + " '4. close': '1.13193'},\n", + " '2022-01-05 11:30:00': {'1. open': '1.13164',\n", + " '2. high': '1.13189',\n", + " '3. low': '1.13150',\n", + " '4. close': '1.13170'},\n", + " '2022-01-05 11:25:00': {'1. open': '1.13152',\n", + " '2. high': '1.13181',\n", + " '3. low': '1.13140',\n", + " '4. close': '1.13162'},\n", + " '2022-01-05 11:20:00': {'1. open': '1.13145',\n", + " '2. high': '1.13185',\n", + " '3. low': '1.13130',\n", + " '4. close': '1.13150'},\n", + " '2022-01-05 11:15:00': {'1. open': '1.13125',\n", + " '2. high': '1.13169',\n", + " '3. low': '1.13110',\n", + " '4. close': '1.13140'},\n", + " '2022-01-05 11:10:00': {'1. open': '1.13079',\n", + " '2. high': '1.13141',\n", + " '3. low': '1.13060',\n", + " '4. close': '1.13110'},\n", + " '2022-01-05 11:05:00': {'1. open': '1.13081',\n", + " '2. high': '1.13085',\n", + " '3. low': '1.13050',\n", + " '4. close': '1.13080'},\n", + " '2022-01-05 11:00:00': {'1. open': '1.13080',\n", + " '2. high': '1.13090',\n", + " '3. low': '1.13030',\n", + " '4. close': '1.13079'},\n", + " '2022-01-05 10:55:00': {'1. open': '1.13115',\n", + " '2. high': '1.13115',\n", + " '3. low': '1.13050',\n", + " '4. close': '1.13087'},\n", + " '2022-01-05 10:50:00': {'1. open': '1.13110',\n", + " '2. high': '1.13140',\n", + " '3. low': '1.13080',\n", + " '4. close': '1.13113'},\n", + " '2022-01-05 10:45:00': {'1. open': '1.13086',\n", + " '2. high': '1.13116',\n", + " '3. low': '1.13050',\n", + " '4. close': '1.13090'},\n", + " '2022-01-05 10:40:00': {'1. open': '1.13120',\n", + " '2. high': '1.13126',\n", + " '3. low': '1.13070',\n", + " '4. close': '1.13070'},\n", + " '2022-01-05 10:35:00': {'1. open': '1.13130',\n", + " '2. high': '1.13141',\n", + " '3. low': '1.13090',\n", + " '4. close': '1.13110'},\n", + " '2022-01-05 10:30:00': {'1. open': '1.13087',\n", + " '2. high': '1.13132',\n", + " '3. low': '1.13080',\n", + " '4. close': '1.13131'},\n", + " '2022-01-05 10:25:00': {'1. open': '1.13134',\n", + " '2. high': '1.13140',\n", + " '3. low': '1.13070',\n", + " '4. close': '1.13086'},\n", + " '2022-01-05 10:20:00': {'1. open': '1.13094',\n", + " '2. high': '1.13138',\n", + " '3. low': '1.13070',\n", + " '4. close': '1.13134'},\n", + " '2022-01-05 10:15:00': {'1. open': '1.13119',\n", + " '2. high': '1.13123',\n", + " '3. low': '1.13080',\n", + " '4. close': '1.13094'},\n", + " '2022-01-05 10:10:00': {'1. open': '1.13070',\n", + " '2. high': '1.13138',\n", + " '3. low': '1.13060',\n", + " '4. close': '1.13117'},\n", + " '2022-01-05 10:05:00': {'1. open': '1.13061',\n", + " '2. high': '1.13085',\n", + " '3. low': '1.13020',\n", + " '4. close': '1.13084'},\n", + " '2022-01-05 10:00:00': {'1. open': '1.13047',\n", + " '2. high': '1.13068',\n", + " '3. low': '1.13020',\n", + " '4. close': '1.13059'},\n", + " '2022-01-05 09:55:00': {'1. open': '1.13051',\n", + " '2. high': '1.13088',\n", + " '3. low': '1.13020',\n", + " '4. close': '1.13030'},\n", + " '2022-01-05 09:50:00': {'1. open': '1.13003',\n", + " '2. high': '1.13052',\n", + " '3. low': '1.12990',\n", + " '4. close': '1.13048'},\n", + " '2022-01-05 09:45:00': {'1. open': '1.13035',\n", + " '2. high': '1.13046',\n", + " '3. low': '1.12980',\n", + " '4. close': '1.12990'},\n", + " '2022-01-05 09:40:00': {'1. open': '1.13041',\n", + " '2. high': '1.13055',\n", + " '3. low': '1.13000',\n", + " '4. close': '1.13035'},\n", + " '2022-01-05 09:35:00': {'1. open': '1.13015',\n", + " '2. high': '1.13054',\n", + " '3. low': '1.12990',\n", + " '4. close': '1.13041'},\n", + " '2022-01-05 09:30:00': {'1. open': '1.13048',\n", + " '2. high': '1.13050',\n", + " '3. low': '1.12990',\n", + " '4. close': '1.13000'},\n", + " '2022-01-05 09:25:00': {'1. open': '1.13029',\n", + " '2. high': '1.13051',\n", + " '3. low': '1.12990',\n", + " '4. close': '1.13047'},\n", + " '2022-01-05 09:20:00': {'1. open': '1.13036',\n", + " '2. high': '1.13058',\n", + " '3. low': '1.12990',\n", + " '4. close': '1.13031'},\n", + " '2022-01-05 09:15:00': {'1. open': '1.13048',\n", + " '2. high': '1.13055',\n", + " '3. low': '1.12990',\n", + " '4. close': '1.13035'},\n", + " '2022-01-05 09:10:00': {'1. open': '1.13030',\n", + " '2. high': '1.13071',\n", + " '3. low': '1.13000',\n", + " '4. close': '1.13050'},\n", + " '2022-01-05 09:05:00': {'1. open': '1.13029',\n", + " '2. high': '1.13045',\n", + " '3. low': '1.12990',\n", + " '4. close': '1.13038'},\n", + " '2022-01-05 09:00:00': {'1. open': '1.13027',\n", + " '2. high': '1.13057',\n", + " '3. low': '1.12990',\n", + " '4. close': '1.13028'}}}" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Currency list: https://www.alphavantage.co/physical_currency_list/\n", + "currency_a = 'EUR'\n", + "currency_b = 'USD'\n", + "interval = '5min' # 1min, 5min, 15min, 30min, 60min\n", + "url = 'https://www.alphavantage.co/query?function=FX_INTRADAY&from_symbol=EUR&to_symbol=USD&interval=5min&apikey=demo'\n", + "r = requests.get(url)\n", + "data = r.json()\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Mutual Funds" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'Meta Data': {'1. Information': 'Daily Prices (open, high, low, close) and Volumes',\n", + " '2. Symbol': 'OMOIX',\n", + " '3. Last Refreshed': '2022-01-03',\n", + " '4. Output Size': 'Compact',\n", + " '5. Time Zone': 'US/Eastern'},\n", + " 'Time Series (Daily)': {'2022-01-03': {'1. open': '26.2200',\n", + " '2. high': '26.2200',\n", + " '3. low': '26.2200',\n", + " '4. close': '26.2200',\n", + " '5. volume': '0'},\n", + " '2021-12-31': {'1. open': '26.1900',\n", + " '2. high': '26.1900',\n", + " '3. low': '26.1900',\n", + " '4. close': '26.1900',\n", + " '5. volume': '0'},\n", + " '2021-12-30': {'1. open': '26.1600',\n", + " '2. high': '26.1600',\n", + " '3. low': '26.1600',\n", + " '4. close': '26.1600',\n", + " '5. volume': '0'},\n", + " '2021-12-29': {'1. open': '26.1400',\n", + " '2. high': '26.1400',\n", + " '3. low': '26.1400',\n", + " '4. close': '26.1400',\n", + " '5. volume': '0'},\n", + " '2021-12-28': {'1. open': '26.4600',\n", + " '2. high': '26.4600',\n", + " '3. low': '26.4600',\n", + " '4. close': '26.4600',\n", + " '5. volume': '0'},\n", + " '2021-12-27': {'1. open': '26.4700',\n", + " '2. high': '26.4700',\n", + " '3. low': '26.4700',\n", + " '4. close': '26.4700',\n", + " '5. volume': '0'},\n", + " '2021-12-23': {'1. open': '26.4800',\n", + " '2. high': '26.4800',\n", + " '3. low': '26.4800',\n", + " '4. close': '26.4800',\n", + " '5. volume': '0'},\n", + " '2021-12-22': {'1. open': '26.4400',\n", + " '2. high': '26.4400',\n", + " '3. low': '26.4400',\n", + " '4. close': '26.4400',\n", + " '5. volume': '0'},\n", + " '2021-12-21': {'1. open': '26.4000',\n", + " '2. high': '26.4000',\n", + " '3. low': '26.4000',\n", + " '4. close': '26.4000',\n", + " '5. volume': '0'},\n", + " '2021-12-20': {'1. open': '26.3500',\n", + " '2. high': '26.3500',\n", + " '3. low': '26.3500',\n", + " '4. close': '26.3500',\n", + " '5. volume': '0'},\n", + " '2021-12-17': {'1. open': '26.3900',\n", + " '2. high': '26.3900',\n", + " '3. low': '26.3900',\n", + " '4. close': '26.3900',\n", + " '5. volume': '0'},\n", + " '2021-12-16': {'1. open': '26.3800',\n", + " '2. high': '26.3800',\n", + " '3. low': '26.3800',\n", + " '4. close': '26.3800',\n", + " '5. volume': '0'},\n", + " '2021-12-15': {'1. open': '26.3900',\n", + " '2. high': '26.3900',\n", + " '3. low': '26.3900',\n", + " '4. close': '26.3900',\n", + " '5. volume': '0'},\n", + " '2021-12-14': {'1. open': '26.3600',\n", + " '2. high': '26.3600',\n", + " '3. low': '26.3600',\n", + " '4. close': '26.3600',\n", + " '5. volume': '0'},\n", + " '2021-12-13': {'1. open': '26.3800',\n", + " '2. high': '26.3800',\n", + " '3. low': '26.3800',\n", + " '4. close': '26.3800',\n", + " '5. volume': '0'},\n", + " '2021-12-10': {'1. open': '26.4100',\n", + " '2. high': '26.4100',\n", + " '3. low': '26.4100',\n", + " '4. close': '26.4100',\n", + " '5. volume': '0'},\n", + " '2021-12-09': {'1. open': '26.4200',\n", + " '2. high': '26.4200',\n", + " '3. low': '26.4200',\n", + " '4. close': '26.4200',\n", + " '5. volume': '0'},\n", + " '2021-12-08': {'1. open': '26.4300',\n", + " '2. high': '26.4300',\n", + " '3. low': '26.4300',\n", + " '4. close': '26.4300',\n", + " '5. volume': '0'},\n", + " '2021-12-07': {'1. open': '26.4200',\n", + " '2. high': '26.4200',\n", + " '3. low': '26.4200',\n", + " '4. close': '26.4200',\n", + " '5. volume': '0'},\n", + " '2021-12-06': {'1. open': '26.3600',\n", + " '2. high': '26.3600',\n", + " '3. low': '26.3600',\n", + " '4. close': '26.3600',\n", + " '5. volume': '0'},\n", + " '2021-12-03': {'1. open': '26.3800',\n", + " '2. high': '26.3800',\n", + " '3. low': '26.3800',\n", + " '4. close': '26.3800',\n", + " '5. volume': '0'},\n", + " '2021-12-02': {'1. open': '26.4100',\n", + " '2. high': '26.4100',\n", + " '3. low': '26.4100',\n", + " '4. close': '26.4100',\n", + " '5. volume': '0'},\n", + " '2021-12-01': {'1. open': '26.4300',\n", + " '2. high': '26.4300',\n", + " '3. low': '26.4300',\n", + " '4. close': '26.4300',\n", + " '5. volume': '0'},\n", + " '2021-11-30': {'1. open': '26.4500',\n", + " '2. high': '26.4500',\n", + " '3. low': '26.4500',\n", + " '4. close': '26.4500',\n", + " '5. volume': '0'},\n", + " '2021-11-29': {'1. open': '26.5100',\n", + " '2. high': '26.5100',\n", + " '3. low': '26.5100',\n", + " '4. close': '26.5100',\n", + " '5. volume': '0'},\n", + " '2021-11-26': {'1. open': '26.4900',\n", + " '2. high': '26.4900',\n", + " '3. low': '26.4900',\n", + " '4. close': '26.4900',\n", + " '5. volume': '0'},\n", + " '2021-11-24': {'1. open': '26.5400',\n", + " '2. high': '26.5400',\n", + " '3. low': '26.5400',\n", + " '4. close': '26.5400',\n", + " '5. volume': '0'},\n", + " '2021-11-23': {'1. open': '26.5200',\n", + " '2. high': '26.5200',\n", + " '3. low': '26.5200',\n", + " '4. close': '26.5200',\n", + " '5. volume': '0'},\n", + " '2021-11-22': {'1. open': '26.5600',\n", + " '2. high': '26.5600',\n", + " '3. low': '26.5600',\n", + " '4. close': '26.5600',\n", + " '5. volume': '0'},\n", + " '2021-11-19': {'1. open': '26.5900',\n", + " '2. high': '26.5900',\n", + " '3. low': '26.5900',\n", + " '4. close': '26.5900',\n", + " '5. volume': '0'},\n", + " '2021-11-18': {'1. open': '26.6200',\n", + " '2. high': '26.6200',\n", + " '3. low': '26.6200',\n", + " '4. close': '26.6200',\n", + " '5. volume': '0'},\n", + " '2021-11-17': {'1. open': '26.6300',\n", + " '2. high': '26.6300',\n", + " '3. low': '26.6300',\n", + " '4. close': '26.6300',\n", + " '5. volume': '0'},\n", + " '2021-11-16': {'1. open': '26.6500',\n", + " '2. high': '26.6500',\n", + " '3. low': '26.6500',\n", + " '4. close': '26.6500',\n", + " '5. volume': '0'},\n", + " '2021-11-15': {'1. open': '26.6500',\n", + " '2. high': '26.6500',\n", + " '3. low': '26.6500',\n", + " '4. close': '26.6500',\n", + " '5. volume': '0'},\n", + " '2021-11-12': {'1. open': '26.6500',\n", + " '2. high': '26.6500',\n", + " '3. low': '26.6500',\n", + " '4. close': '26.6500',\n", + " '5. volume': '0'},\n", + " '2021-11-11': {'1. open': '26.6300',\n", + " '2. high': '26.6300',\n", + " '3. low': '26.6300',\n", + " '4. close': '26.6300',\n", + " '5. volume': '0'},\n", + " '2021-11-10': {'1. open': '26.6200',\n", + " '2. high': '26.6200',\n", + " '3. low': '26.6200',\n", + " '4. close': '26.6200',\n", + " '5. volume': '0'},\n", + " '2021-11-09': {'1. open': '26.6500',\n", + " '2. high': '26.6500',\n", + " '3. low': '26.6500',\n", + " '4. close': '26.6500',\n", + " '5. volume': '0'},\n", + " '2021-11-08': {'1. open': '26.6600',\n", + " '2. high': '26.6600',\n", + " '3. low': '26.6600',\n", + " '4. close': '26.6600',\n", + " '5. volume': '0'},\n", + " '2021-11-05': {'1. open': '26.6500',\n", + " '2. high': '26.6500',\n", + " '3. low': '26.6500',\n", + " '4. close': '26.6500',\n", + " '5. volume': '0'},\n", + " '2021-11-04': {'1. open': '26.6200',\n", + " '2. high': '26.6200',\n", + " '3. low': '26.6200',\n", + " '4. close': '26.6200',\n", + " '5. volume': '0'},\n", + " '2021-11-03': {'1. open': '26.6100',\n", + " '2. high': '26.6100',\n", + " '3. low': '26.6100',\n", + " '4. close': '26.6100',\n", + " '5. volume': '0'},\n", + " '2021-11-02': {'1. open': '26.6200',\n", + " '2. high': '26.6200',\n", + " '3. low': '26.6200',\n", + " '4. close': '26.6200',\n", + " '5. volume': '0'},\n", + " '2021-11-01': {'1. open': '26.6300',\n", + " '2. high': '26.6300',\n", + " '3. low': '26.6300',\n", + " '4. close': '26.6300',\n", + " '5. volume': '0'},\n", + " '2021-10-29': {'1. open': '26.6000',\n", + " '2. high': '26.6000',\n", + " '3. low': '26.6000',\n", + " '4. close': '26.6000',\n", + " '5. volume': '0'},\n", + " '2021-10-28': {'1. open': '26.6100',\n", + " '2. high': '26.6100',\n", + " '3. low': '26.6100',\n", + " '4. close': '26.6100',\n", + " '5. volume': '0'},\n", + " '2021-10-27': {'1. open': '26.6000',\n", + " '2. high': '26.6000',\n", + " '3. low': '26.6000',\n", + " '4. close': '26.6000',\n", + " '5. volume': '0'},\n", + " '2021-10-26': {'1. open': '26.6200',\n", + " '2. high': '26.6200',\n", + " '3. low': '26.6200',\n", + " '4. close': '26.6200',\n", + " '5. volume': '0'},\n", + " '2021-10-25': {'1. open': '26.6100',\n", + " '2. high': '26.6100',\n", + " '3. low': '26.6100',\n", + " '4. close': '26.6100',\n", + " '5. volume': '0'},\n", + " '2021-10-22': {'1. open': '26.5700',\n", + " '2. high': '26.5700',\n", + " '3. low': '26.5700',\n", + " '4. close': '26.5700',\n", + " '5. volume': '0'},\n", + " '2021-10-21': {'1. open': '26.5500',\n", + " '2. high': '26.5500',\n", + " '3. low': '26.5500',\n", + " '4. close': '26.5500',\n", + " '5. volume': '0'},\n", + " '2021-10-20': {'1. open': '26.5700',\n", + " '2. high': '26.5700',\n", + " '3. low': '26.5700',\n", + " '4. close': '26.5700',\n", + " '5. volume': '0'},\n", + " '2021-10-19': {'1. open': '26.5600',\n", + " '2. high': '26.5600',\n", + " '3. low': '26.5600',\n", + " '4. close': '26.5600',\n", + " '5. volume': '0'},\n", + " '2021-10-18': {'1. open': '26.5500',\n", + " '2. high': '26.5500',\n", + " '3. low': '26.5500',\n", + " '4. close': '26.5500',\n", + " '5. volume': '0'},\n", + " '2021-10-15': {'1. open': '26.5600',\n", + " '2. high': '26.5600',\n", + " '3. low': '26.5600',\n", + " '4. close': '26.5600',\n", + " '5. volume': '0'},\n", + " '2021-10-14': {'1. open': '26.5400',\n", + " '2. high': '26.5400',\n", + " '3. low': '26.5400',\n", + " '4. close': '26.5400',\n", + " '5. volume': '0'},\n", + " '2021-10-13': {'1. open': '26.5100',\n", + " '2. high': '26.5100',\n", + " '3. low': '26.5100',\n", + " '4. close': '26.5100',\n", + " '5. volume': '0'},\n", + " '2021-10-12': {'1. open': '26.4900',\n", + " '2. high': '26.4900',\n", + " '3. low': '26.4900',\n", + " '4. close': '26.4900',\n", + " '5. volume': '0'},\n", + " '2021-10-11': {'1. open': '26.4700',\n", + " '2. high': '26.4700',\n", + " '3. low': '26.4700',\n", + " '4. close': '26.4700',\n", + " '5. volume': '0'},\n", + " '2021-10-08': {'1. open': '26.4500',\n", + " '2. high': '26.4500',\n", + " '3. low': '26.4500',\n", + " '4. close': '26.4500',\n", + " '5. volume': '0'},\n", + " '2021-10-07': {'1. open': '26.4400',\n", + " '2. high': '26.4400',\n", + " '3. low': '26.4400',\n", + " '4. close': '26.4400',\n", + " '5. volume': '0'},\n", + " '2021-10-06': {'1. open': '26.4000',\n", + " '2. high': '26.4000',\n", + " '3. low': '26.4000',\n", + " '4. close': '26.4000',\n", + " '5. volume': '0'},\n", + " '2021-10-05': {'1. open': '26.4100',\n", + " '2. high': '26.4100',\n", + " '3. low': '26.4100',\n", + " '4. close': '26.4100',\n", + " '5. volume': '0'},\n", + " '2021-10-04': {'1. open': '26.3900',\n", + " '2. high': '26.3900',\n", + " '3. low': '26.3900',\n", + " '4. close': '26.3900',\n", + " '5. volume': '0'},\n", + " '2021-10-01': {'1. open': '26.4000',\n", + " '2. high': '26.4000',\n", + " '3. low': '26.4000',\n", + " '4. close': '26.4000',\n", + " '5. volume': '0'},\n", + " '2021-09-30': {'1. open': '26.3600',\n", + " '2. high': '26.3600',\n", + " '3. low': '26.3600',\n", + " '4. close': '26.3600',\n", + " '5. volume': '0'},\n", + " '2021-09-29': {'1. open': '26.3700',\n", + " '2. high': '26.3700',\n", + " '3. low': '26.3700',\n", + " '4. close': '26.3700',\n", + " '5. volume': '0'},\n", + " '2021-09-28': {'1. open': '26.3500',\n", + " '2. high': '26.3500',\n", + " '3. low': '26.3500',\n", + " '4. close': '26.3500',\n", + " '5. volume': '0'},\n", + " '2021-09-27': {'1. open': '26.3800',\n", + " '2. high': '26.3800',\n", + " '3. low': '26.3800',\n", + " '4. close': '26.3800',\n", + " '5. volume': '0'},\n", + " '2021-09-24': {'1. open': '26.3700',\n", + " '2. high': '26.3700',\n", + " '3. low': '26.3700',\n", + " '4. close': '26.3700',\n", + " '5. volume': '0'},\n", + " '2021-09-23': {'1. open': '26.7200',\n", + " '2. high': '26.7200',\n", + " '3. low': '26.7200',\n", + " '4. close': '26.7200',\n", + " '5. volume': '0'},\n", + " '2021-09-22': {'1. open': '26.7200',\n", + " '2. high': '26.7200',\n", + " '3. low': '26.7200',\n", + " '4. close': '26.7200',\n", + " '5. volume': '0'},\n", + " '2021-09-21': {'1. open': '26.6800',\n", + " '2. high': '26.6800',\n", + " '3. low': '26.6800',\n", + " '4. close': '26.6800',\n", + " '5. volume': '0'},\n", + " '2021-09-20': {'1. open': '26.6300',\n", + " '2. high': '26.6300',\n", + " '3. low': '26.6300',\n", + " '4. close': '26.6300',\n", + " '5. volume': '0'},\n", + " '2021-09-17': {'1. open': '26.6900',\n", + " '2. high': '26.6900',\n", + " '3. low': '26.6900',\n", + " '4. close': '26.6900',\n", + " '5. volume': '0'},\n", + " '2021-09-16': {'1. open': '26.7000',\n", + " '2. high': '26.7000',\n", + " '3. low': '26.7000',\n", + " '4. close': '26.7000',\n", + " '5. volume': '0'},\n", + " '2021-09-15': {'1. open': '26.7100',\n", + " '2. high': '26.7100',\n", + " '3. low': '26.7100',\n", + " '4. close': '26.7100',\n", + " '5. volume': '0'},\n", + " '2021-09-14': {'1. open': '26.6900',\n", + " '2. high': '26.6900',\n", + " '3. low': '26.6900',\n", + " '4. close': '26.6900',\n", + " '5. volume': '0'},\n", + " '2021-09-13': {'1. open': '26.6700',\n", + " '2. high': '26.6700',\n", + " '3. low': '26.6700',\n", + " '4. close': '26.6700',\n", + " '5. volume': '0'},\n", + " '2021-09-10': {'1. open': '26.6500',\n", + " '2. high': '26.6500',\n", + " '3. low': '26.6500',\n", + " '4. close': '26.6500',\n", + " '5. volume': '0'},\n", + " '2021-09-09': {'1. open': '26.6500',\n", + " '2. high': '26.6500',\n", + " '3. low': '26.6500',\n", + " '4. close': '26.6500',\n", + " '5. volume': '0'},\n", + " '2021-09-08': {'1. open': '26.6500',\n", + " '2. high': '26.6500',\n", + " '3. low': '26.6500',\n", + " '4. close': '26.6500',\n", + " '5. volume': '0'},\n", + " '2021-09-07': {'1. open': '26.6400',\n", + " '2. high': '26.6400',\n", + " '3. low': '26.6400',\n", + " '4. close': '26.6400',\n", + " '5. volume': '0'},\n", + " '2021-09-03': {'1. open': '26.6600',\n", + " '2. high': '26.6600',\n", + " '3. low': '26.6600',\n", + " '4. close': '26.6600',\n", + " '5. volume': '0'},\n", + " '2021-09-02': {'1. open': '26.6600',\n", + " '2. high': '26.6600',\n", + " '3. low': '26.6600',\n", + " '4. close': '26.6600',\n", + " '5. volume': '0'},\n", + " '2021-09-01': {'1. open': '26.6300',\n", + " '2. high': '26.6300',\n", + " '3. low': '26.6300',\n", + " '4. close': '26.6300',\n", + " '5. volume': '0'},\n", + " '2021-08-31': {'1. open': '26.6000',\n", + " '2. high': '26.6000',\n", + " '3. low': '26.6000',\n", + " '4. close': '26.6000',\n", + " '5. volume': '0'},\n", + " '2021-08-30': {'1. open': '26.5900',\n", + " '2. high': '26.5900',\n", + " '3. low': '26.5900',\n", + " '4. close': '26.5900',\n", + " '5. volume': '0'},\n", + " '2021-08-27': {'1. open': '26.5900',\n", + " '2. high': '26.5900',\n", + " '3. low': '26.5900',\n", + " '4. close': '26.5900',\n", + " '5. volume': '0'},\n", + " '2021-08-26': {'1. open': '26.5800',\n", + " '2. high': '26.5800',\n", + " '3. low': '26.5800',\n", + " '4. close': '26.5800',\n", + " '5. volume': '0'},\n", + " '2021-08-25': {'1. open': '26.5900',\n", + " '2. high': '26.5900',\n", + " '3. low': '26.5900',\n", + " '4. close': '26.5900',\n", + " '5. volume': '0'},\n", + " '2021-08-24': {'1. open': '26.5700',\n", + " '2. high': '26.5700',\n", + " '3. low': '26.5700',\n", + " '4. close': '26.5700',\n", + " '5. volume': '0'},\n", + " '2021-08-23': {'1. open': '26.5600',\n", + " '2. high': '26.5600',\n", + " '3. low': '26.5600',\n", + " '4. close': '26.5600',\n", + " '5. volume': '0'},\n", + " '2021-08-20': {'1. open': '26.5400',\n", + " '2. high': '26.5400',\n", + " '3. low': '26.5400',\n", + " '4. close': '26.5400',\n", + " '5. volume': '0'},\n", + " '2021-08-19': {'1. open': '26.5500',\n", + " '2. high': '26.5500',\n", + " '3. low': '26.5500',\n", + " '4. close': '26.5500',\n", + " '5. volume': '0'},\n", + " '2021-08-18': {'1. open': '26.5500',\n", + " '2. high': '26.5500',\n", + " '3. low': '26.5500',\n", + " '4. close': '26.5500',\n", + " '5. volume': '0'},\n", + " '2021-08-17': {'1. open': '26.5600',\n", + " '2. high': '26.5600',\n", + " '3. low': '26.5600',\n", + " '4. close': '26.5600',\n", + " '5. volume': '0'},\n", + " '2021-08-16': {'1. open': '26.5900',\n", + " '2. high': '26.5900',\n", + " '3. low': '26.5900',\n", + " '4. close': '26.5900',\n", + " '5. volume': '0'},\n", + " '2021-08-13': {'1. open': '26.6000',\n", + " '2. high': '26.6000',\n", + " '3. low': '26.6000',\n", + " '4. close': '26.6000',\n", + " '5. volume': '0'},\n", + " '2021-08-12': {'1. open': '26.5800',\n", + " '2. high': '26.5800',\n", + " '3. low': '26.5800',\n", + " '4. close': '26.5800',\n", + " '5. volume': '0'}}}" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ticker = 'OMOIX'\n", + "url = 'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol='+ticker+'&apikey={key}'\n", + "r = requests.get(url)\n", + "data = r.json()\n", + "data" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -696,11 +1780,534 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 26, "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "{'Meta Data': {'1. Information': 'Crypto Intraday (5min) Time Series',\n", + " '2. Digital Currency Code': 'ETH',\n", + " '3. Digital Currency Name': 'Ethereum',\n", + " '4. Market Code': 'USD',\n", + " '5. Market Name': 'United States Dollar',\n", + " '6. Last Refreshed': '2022-01-05 17:10:00',\n", + " '7. Interval': '5min',\n", + " '8. Output Size': 'Compact',\n", + " '9. Time Zone': 'UTC'},\n", + " 'Time Series Crypto (5min)': {'2022-01-05 17:10:00': {'1. open': '3801.83000',\n", + " '2. high': '3804.23000',\n", + " '3. low': '3801.82000',\n", + " '4. close': '3803.78000',\n", + " '5. volume': 214},\n", + " '2022-01-05 17:05:00': {'1. open': '3800.40000',\n", + " '2. high': '3804.00000',\n", + " '3. low': '3798.84000',\n", + " '4. close': '3801.83000',\n", + " '5. volume': 397},\n", + " '2022-01-05 17:00:00': {'1. open': '3792.87000',\n", + " '2. high': '3803.70000',\n", + " '3. low': '3791.02000',\n", + " '4. close': '3800.40000',\n", + " '5. volume': 810},\n", + " '2022-01-05 16:55:00': {'1. open': '3792.72000',\n", + " '2. high': '3795.53000',\n", + " '3. low': '3790.88000',\n", + " '4. close': '3792.88000',\n", + " '5. volume': 416},\n", + " '2022-01-05 16:50:00': {'1. open': '3792.50000',\n", + " '2. high': '3797.42000',\n", + " '3. low': '3791.41000',\n", + " '4. close': '3792.71000',\n", + " '5. volume': 646},\n", + " '2022-01-05 16:45:00': {'1. open': '3796.24000',\n", + " '2. high': '3796.25000',\n", + " '3. low': '3790.13000',\n", + " '4. close': '3792.50000',\n", + " '5. volume': 989},\n", + " '2022-01-05 16:40:00': {'1. open': '3802.98000',\n", + " '2. high': '3803.98000',\n", + " '3. low': '3795.25000',\n", + " '4. close': '3796.25000',\n", + " '5. volume': 648},\n", + " '2022-01-05 16:35:00': {'1. open': '3809.44000',\n", + " '2. high': '3809.45000',\n", + " '3. low': '3801.26000',\n", + " '4. close': '3802.98000',\n", + " '5. volume': 534},\n", + " '2022-01-05 16:30:00': {'1. open': '3819.75000',\n", + " '2. high': '3819.78000',\n", + " '3. low': '3808.40000',\n", + " '4. close': '3809.44000',\n", + " '5. volume': 523},\n", + " '2022-01-05 16:25:00': {'1. open': '3813.91000',\n", + " '2. high': '3820.39000',\n", + " '3. low': '3813.90000',\n", + " '4. close': '3819.76000',\n", + " '5. volume': 1073},\n", + " '2022-01-05 16:20:00': {'1. open': '3809.11000',\n", + " '2. high': '3818.00000',\n", + " '3. low': '3805.99000',\n", + " '4. close': '3813.90000',\n", + " '5. volume': 599},\n", + " '2022-01-05 16:15:00': {'1. open': '3809.73000',\n", + " '2. high': '3811.84000',\n", + " '3. low': '3807.65000',\n", + " '4. close': '3809.12000',\n", + " '5. volume': 783},\n", + " '2022-01-05 16:10:00': {'1. open': '3807.52000',\n", + " '2. high': '3810.89000',\n", + " '3. low': '3800.03000',\n", + " '4. close': '3809.73000',\n", + " '5. volume': 854},\n", + " '2022-01-05 16:05:00': {'1. open': '3814.66000',\n", + " '2. high': '3814.67000',\n", + " '3. low': '3806.00000',\n", + " '4. close': '3807.52000',\n", + " '5. volume': 787},\n", + " '2022-01-05 16:00:00': {'1. open': '3820.97000',\n", + " '2. high': '3823.33000',\n", + " '3. low': '3814.17000',\n", + " '4. close': '3814.67000',\n", + " '5. volume': 911},\n", + " '2022-01-05 15:55:00': {'1. open': '3821.07000',\n", + " '2. high': '3822.42000',\n", + " '3. low': '3819.86000',\n", + " '4. close': '3820.97000',\n", + " '5. volume': 617},\n", + " '2022-01-05 15:50:00': {'1. open': '3813.46000',\n", + " '2. high': '3822.24000',\n", + " '3. low': '3812.60000',\n", + " '4. close': '3821.06000',\n", + " '5. volume': 618},\n", + " '2022-01-05 15:45:00': {'1. open': '3814.45000',\n", + " '2. high': '3815.69000',\n", + " '3. low': '3804.27000',\n", + " '4. close': '3813.45000',\n", + " '5. volume': 583},\n", + " '2022-01-05 15:40:00': {'1. open': '3809.46000',\n", + " '2. high': '3815.17000',\n", + " '3. low': '3807.88000',\n", + " '4. close': '3814.45000',\n", + " '5. volume': 544},\n", + " '2022-01-05 15:35:00': {'1. open': '3814.53000',\n", + " '2. high': '3817.27000',\n", + " '3. low': '3805.75000',\n", + " '4. close': '3809.99000',\n", + " '5. volume': 673},\n", + " '2022-01-05 15:30:00': {'1. open': '3820.78000',\n", + " '2. high': '3820.97000',\n", + " '3. low': '3812.72000',\n", + " '4. close': '3814.53000',\n", + " '5. volume': 454},\n", + " '2022-01-05 15:25:00': {'1. open': '3814.87000',\n", + " '2. high': '3823.06000',\n", + " '3. low': '3814.28000',\n", + " '4. close': '3820.78000',\n", + " '5. volume': 1131},\n", + " '2022-01-05 15:20:00': {'1. open': '3808.07000',\n", + " '2. high': '3818.51000',\n", + " '3. low': '3808.06000',\n", + " '4. close': '3814.87000',\n", + " '5. volume': 597},\n", + " '2022-01-05 15:15:00': {'1. open': '3810.34000',\n", + " '2. high': '3814.94000',\n", + " '3. low': '3807.30000',\n", + " '4. close': '3808.07000',\n", + " '5. volume': 567},\n", + " '2022-01-05 15:10:00': {'1. open': '3815.56000',\n", + " '2. high': '3816.94000',\n", + " '3. low': '3807.89000',\n", + " '4. close': '3810.34000',\n", + " '5. volume': 815},\n", + " '2022-01-05 15:05:00': {'1. open': '3820.05000',\n", + " '2. high': '3824.12000',\n", + " '3. low': '3814.36000',\n", + " '4. close': '3815.55000',\n", + " '5. volume': 898},\n", + " '2022-01-05 15:00:00': {'1. open': '3821.02000',\n", + " '2. high': '3828.18000',\n", + " '3. low': '3816.12000',\n", + " '4. close': '3820.05000',\n", + " '5. volume': 1421},\n", + " '2022-01-05 14:55:00': {'1. open': '3819.10000',\n", + " '2. high': '3829.18000',\n", + " '3. low': '3813.92000',\n", + " '4. close': '3821.00000',\n", + " '5. volume': 1243},\n", + " '2022-01-05 14:50:00': {'1. open': '3793.52000',\n", + " '2. high': '3825.55000',\n", + " '3. low': '3789.09000',\n", + " '4. close': '3818.53000',\n", + " '5. volume': 2068},\n", + " '2022-01-05 14:45:00': {'1. open': '3803.15000',\n", + " '2. high': '3808.25000',\n", + " '3. low': '3788.57000',\n", + " '4. close': '3793.10000',\n", + " '5. volume': 1049},\n", + " '2022-01-05 14:40:00': {'1. open': '3793.94000',\n", + " '2. high': '3833.00000',\n", + " '3. low': '3793.02000',\n", + " '4. close': '3802.84000',\n", + " '5. volume': 3766},\n", + " '2022-01-05 14:35:00': {'1. open': '3803.75000',\n", + " '2. high': '3805.60000',\n", + " '3. low': '3793.61000',\n", + " '4. close': '3793.94000',\n", + " '5. volume': 956},\n", + " '2022-01-05 14:30:00': {'1. open': '3810.95000',\n", + " '2. high': '3820.00000',\n", + " '3. low': '3800.38000',\n", + " '4. close': '3803.75000',\n", + " '5. volume': 1504},\n", + " '2022-01-05 14:25:00': {'1. open': '3805.24000',\n", + " '2. high': '3811.50000',\n", + " '3. low': '3804.78000',\n", + " '4. close': '3810.94000',\n", + " '5. volume': 436},\n", + " '2022-01-05 14:20:00': {'1. open': '3803.40000',\n", + " '2. high': '3806.40000',\n", + " '3. low': '3802.84000',\n", + " '4. close': '3805.24000',\n", + " '5. volume': 348},\n", + " '2022-01-05 14:15:00': {'1. open': '3815.02000',\n", + " '2. high': '3815.18000',\n", + " '3. low': '3801.73000',\n", + " '4. close': '3803.39000',\n", + " '5. volume': 527},\n", + " '2022-01-05 14:10:00': {'1. open': '3810.43000',\n", + " '2. high': '3819.00000',\n", + " '3. low': '3809.61000',\n", + " '4. close': '3815.02000',\n", + " '5. volume': 731},\n", + " '2022-01-05 14:05:00': {'1. open': '3814.13000',\n", + " '2. high': '3815.00000',\n", + " '3. low': '3809.99000',\n", + " '4. close': '3810.42000',\n", + " '5. volume': 851},\n", + " '2022-01-05 14:00:00': {'1. open': '3814.54000',\n", + " '2. high': '3818.80000',\n", + " '3. low': '3813.48000',\n", + " '4. close': '3814.14000',\n", + " '5. volume': 972},\n", + " '2022-01-05 13:55:00': {'1. open': '3807.51000',\n", + " '2. high': '3816.17000',\n", + " '3. low': '3807.23000',\n", + " '4. close': '3814.54000',\n", + " '5. volume': 1214},\n", + " '2022-01-05 13:50:00': {'1. open': '3800.24000',\n", + " '2. high': '3807.70000',\n", + " '3. low': '3798.01000',\n", + " '4. close': '3807.23000',\n", + " '5. volume': 603},\n", + " '2022-01-05 13:45:00': {'1. open': '3802.99000',\n", + " '2. high': '3807.01000',\n", + " '3. low': '3798.80000',\n", + " '4. close': '3800.23000',\n", + " '5. volume': 736},\n", + " '2022-01-05 13:40:00': {'1. open': '3806.34000',\n", + " '2. high': '3807.35000',\n", + " '3. low': '3800.04000',\n", + " '4. close': '3803.00000',\n", + " '5. volume': 547},\n", + " '2022-01-05 13:35:00': {'1. open': '3808.38000',\n", + " '2. high': '3808.39000',\n", + " '3. low': '3803.03000',\n", + " '4. close': '3806.35000',\n", + " '5. volume': 665},\n", + " '2022-01-05 13:30:00': {'1. open': '3804.40000',\n", + " '2. high': '3808.39000',\n", + " '3. low': '3799.40000',\n", + " '4. close': '3808.39000',\n", + " '5. volume': 945},\n", + " '2022-01-05 13:25:00': {'1. open': '3803.64000',\n", + " '2. high': '3807.72000',\n", + " '3. low': '3800.70000',\n", + " '4. close': '3804.40000',\n", + " '5. volume': 758},\n", + " '2022-01-05 13:20:00': {'1. open': '3800.00000',\n", + " '2. high': '3804.16000',\n", + " '3. low': '3796.21000',\n", + " '4. close': '3803.27000',\n", + " '5. volume': 1312},\n", + " '2022-01-05 13:15:00': {'1. open': '3788.32000',\n", + " '2. high': '3804.16000',\n", + " '3. low': '3785.99000',\n", + " '4. close': '3800.00000',\n", + " '5. volume': 1268},\n", + " '2022-01-05 13:10:00': {'1. open': '3784.63000',\n", + " '2. high': '3789.06000',\n", + " '3. low': '3780.79000',\n", + " '4. close': '3788.33000',\n", + " '5. volume': 499},\n", + " '2022-01-05 13:05:00': {'1. open': '3785.77000',\n", + " '2. high': '3787.55000',\n", + " '3. low': '3782.80000',\n", + " '4. close': '3784.63000',\n", + " '5. volume': 484},\n", + " '2022-01-05 13:00:00': {'1. open': '3790.02000',\n", + " '2. high': '3796.71000',\n", + " '3. low': '3784.87000',\n", + " '4. close': '3785.76000',\n", + " '5. volume': 1123},\n", + " '2022-01-05 12:55:00': {'1. open': '3785.00000',\n", + " '2. high': '3792.31000',\n", + " '3. low': '3783.44000',\n", + " '4. close': '3790.03000',\n", + " '5. volume': 1122},\n", + " '2022-01-05 12:50:00': {'1. open': '3771.98000',\n", + " '2. high': '3785.83000',\n", + " '3. low': '3770.62000',\n", + " '4. close': '3785.00000',\n", + " '5. volume': 905},\n", + " '2022-01-05 12:45:00': {'1. open': '3776.91000',\n", + " '2. high': '3777.49000',\n", + " '3. low': '3765.93000',\n", + " '4. close': '3771.76000',\n", + " '5. volume': 785},\n", + " '2022-01-05 12:40:00': {'1. open': '3778.46000',\n", + " '2. high': '3778.79000',\n", + " '3. low': '3761.44000',\n", + " '4. close': '3776.91000',\n", + " '5. volume': 1422},\n", + " '2022-01-05 12:35:00': {'1. open': '3781.61000',\n", + " '2. high': '3783.41000',\n", + " '3. low': '3776.66000',\n", + " '4. close': '3778.46000',\n", + " '5. volume': 675},\n", + " '2022-01-05 12:30:00': {'1. open': '3782.58000',\n", + " '2. high': '3783.40000',\n", + " '3. low': '3776.79000',\n", + " '4. close': '3781.60000',\n", + " '5. volume': 1196},\n", + " '2022-01-05 12:25:00': {'1. open': '3773.73000',\n", + " '2. high': '3784.08000',\n", + " '3. low': '3771.16000',\n", + " '4. close': '3782.58000',\n", + " '5. volume': 1192},\n", + " '2022-01-05 12:20:00': {'1. open': '3784.41000',\n", + " '2. high': '3784.41000',\n", + " '3. low': '3769.00000',\n", + " '4. close': '3773.74000',\n", + " '5. volume': 2061},\n", + " '2022-01-05 12:15:00': {'1. open': '3786.85000',\n", + " '2. high': '3791.00000',\n", + " '3. low': '3783.69000',\n", + " '4. close': '3784.41000',\n", + " '5. volume': 779},\n", + " '2022-01-05 12:10:00': {'1. open': '3788.24000',\n", + " '2. high': '3789.80000',\n", + " '3. low': '3781.09000',\n", + " '4. close': '3786.85000',\n", + " '5. volume': 1074},\n", + " '2022-01-05 12:05:00': {'1. open': '3791.19000',\n", + " '2. high': '3791.30000',\n", + " '3. low': '3784.34000',\n", + " '4. close': '3788.23000',\n", + " '5. volume': 600},\n", + " '2022-01-05 12:00:00': {'1. open': '3791.69000',\n", + " '2. high': '3796.71000',\n", + " '3. low': '3790.91000',\n", + " '4. close': '3791.18000',\n", + " '5. volume': 825},\n", + " '2022-01-05 11:55:00': {'1. open': '3788.51000',\n", + " '2. high': '3792.86000',\n", + " '3. low': '3783.40000',\n", + " '4. close': '3791.69000',\n", + " '5. volume': 813},\n", + " '2022-01-05 11:50:00': {'1. open': '3789.48000',\n", + " '2. high': '3792.36000',\n", + " '3. low': '3781.42000',\n", + " '4. close': '3788.51000',\n", + " '5. volume': 802},\n", + " '2022-01-05 11:45:00': {'1. open': '3788.55000',\n", + " '2. high': '3794.49000',\n", + " '3. low': '3788.11000',\n", + " '4. close': '3789.49000',\n", + " '5. volume': 701},\n", + " '2022-01-05 11:40:00': {'1. open': '3793.02000',\n", + " '2. high': '3796.71000',\n", + " '3. low': '3783.65000',\n", + " '4. close': '3788.54000',\n", + " '5. volume': 1271},\n", + " '2022-01-05 11:35:00': {'1. open': '3791.60000',\n", + " '2. high': '3796.91000',\n", + " '3. low': '3783.00000',\n", + " '4. close': '3793.02000',\n", + " '5. volume': 2063},\n", + " '2022-01-05 11:30:00': {'1. open': '3804.51000',\n", + " '2. high': '3805.90000',\n", + " '3. low': '3790.08000',\n", + " '4. close': '3791.54000',\n", + " '5. volume': 1590},\n", + " '2022-01-05 11:25:00': {'1. open': '3810.01000',\n", + " '2. high': '3811.40000',\n", + " '3. low': '3800.15000',\n", + " '4. close': '3804.50000',\n", + " '5. volume': 789},\n", + " '2022-01-05 11:20:00': {'1. open': '3814.20000',\n", + " '2. high': '3814.96000',\n", + " '3. low': '3804.17000',\n", + " '4. close': '3810.02000',\n", + " '5. volume': 1960},\n", + " '2022-01-05 11:15:00': {'1. open': '3812.00000',\n", + " '2. high': '3814.99000',\n", + " '3. low': '3811.75000',\n", + " '4. close': '3814.21000',\n", + " '5. volume': 759},\n", + " '2022-01-05 11:10:00': {'1. open': '3817.70000',\n", + " '2. high': '3817.72000',\n", + " '3. low': '3810.98000',\n", + " '4. close': '3812.00000',\n", + " '5. volume': 940},\n", + " '2022-01-05 11:05:00': {'1. open': '3818.11000',\n", + " '2. high': '3822.64000',\n", + " '3. low': '3816.40000',\n", + " '4. close': '3817.70000',\n", + " '5. volume': 469},\n", + " '2022-01-05 11:00:00': {'1. open': '3826.45000',\n", + " '2. high': '3828.08000',\n", + " '3. low': '3818.00000',\n", + " '4. close': '3818.11000',\n", + " '5. volume': 951},\n", + " '2022-01-05 10:55:00': {'1. open': '3823.55000',\n", + " '2. high': '3828.15000',\n", + " '3. low': '3822.12000',\n", + " '4. close': '3826.45000',\n", + " '5. volume': 534},\n", + " '2022-01-05 10:50:00': {'1. open': '3822.58000',\n", + " '2. high': '3826.45000',\n", + " '3. low': '3822.27000',\n", + " '4. close': '3823.55000',\n", + " '5. volume': 516},\n", + " '2022-01-05 10:45:00': {'1. open': '3822.08000',\n", + " '2. high': '3827.18000',\n", + " '3. low': '3821.72000',\n", + " '4. close': '3822.57000',\n", + " '5. volume': 520},\n", + " '2022-01-05 10:40:00': {'1. open': '3824.69000',\n", + " '2. high': '3827.82000',\n", + " '3. low': '3821.26000',\n", + " '4. close': '3822.08000',\n", + " '5. volume': 486},\n", + " '2022-01-05 10:35:00': {'1. open': '3828.18000',\n", + " '2. high': '3828.93000',\n", + " '3. low': '3822.71000',\n", + " '4. close': '3824.68000',\n", + " '5. volume': 483},\n", + " '2022-01-05 10:30:00': {'1. open': '3832.00000',\n", + " '2. high': '3835.04000',\n", + " '3. low': '3825.94000',\n", + " '4. close': '3828.19000',\n", + " '5. volume': 457},\n", + " '2022-01-05 10:25:00': {'1. open': '3830.38000',\n", + " '2. high': '3833.40000',\n", + " '3. low': '3829.00000',\n", + " '4. close': '3832.00000',\n", + " '5. volume': 476},\n", + " '2022-01-05 10:20:00': {'1. open': '3829.79000',\n", + " '2. high': '3833.55000',\n", + " '3. low': '3827.84000',\n", + " '4. close': '3830.38000',\n", + " '5. volume': 753},\n", + " '2022-01-05 10:15:00': {'1. open': '3839.17000',\n", + " '2. high': '3839.27000',\n", + " '3. low': '3827.78000',\n", + " '4. close': '3829.78000',\n", + " '5. volume': 856},\n", + " '2022-01-05 10:10:00': {'1. open': '3842.74000',\n", + " '2. high': '3847.76000',\n", + " '3. low': '3837.44000',\n", + " '4. close': '3839.18000',\n", + " '5. volume': 784},\n", + " '2022-01-05 10:05:00': {'1. open': '3842.69000',\n", + " '2. high': '3846.32000',\n", + " '3. low': '3842.03000',\n", + " '4. close': '3842.74000',\n", + " '5. volume': 658},\n", + " '2022-01-05 10:00:00': {'1. open': '3836.70000',\n", + " '2. high': '3848.00000',\n", + " '3. low': '3836.69000',\n", + " '4. close': '3842.51000',\n", + " '5. volume': 926},\n", + " '2022-01-05 09:55:00': {'1. open': '3833.59000',\n", + " '2. high': '3837.76000',\n", + " '3. low': '3832.85000',\n", + " '4. close': '3836.69000',\n", + " '5. volume': 565},\n", + " '2022-01-05 09:50:00': {'1. open': '3831.92000',\n", + " '2. high': '3834.61000',\n", + " '3. low': '3830.06000',\n", + " '4. close': '3833.59000',\n", + " '5. volume': 549},\n", + " '2022-01-05 09:45:00': {'1. open': '3838.30000',\n", + " '2. high': '3840.00000',\n", + " '3. low': '3831.22000',\n", + " '4. close': '3831.93000',\n", + " '5. volume': 531},\n", + " '2022-01-05 09:40:00': {'1. open': '3832.55000',\n", + " '2. high': '3839.99000',\n", + " '3. low': '3831.75000',\n", + " '4. close': '3838.30000',\n", + " '5. volume': 988},\n", + " '2022-01-05 09:35:00': {'1. open': '3830.00000',\n", + " '2. high': '3833.44000',\n", + " '3. low': '3829.85000',\n", + " '4. close': '3832.54000',\n", + " '5. volume': 605},\n", + " '2022-01-05 09:30:00': {'1. open': '3831.18000',\n", + " '2. high': '3833.10000',\n", + " '3. low': '3827.00000',\n", + " '4. close': '3830.01000',\n", + " '5. volume': 862},\n", + " '2022-01-05 09:25:00': {'1. open': '3830.01000',\n", + " '2. high': '3833.00000',\n", + " '3. low': '3825.98000',\n", + " '4. close': '3831.19000',\n", + " '5. volume': 1350},\n", + " '2022-01-05 09:20:00': {'1. open': '3824.23000',\n", + " '2. high': '3830.61000',\n", + " '3. low': '3822.42000',\n", + " '4. close': '3830.00000',\n", + " '5. volume': 696},\n", + " '2022-01-05 09:15:00': {'1. open': '3818.73000',\n", + " '2. high': '3824.43000',\n", + " '3. low': '3816.46000',\n", + " '4. close': '3824.23000',\n", + " '5. volume': 606},\n", + " '2022-01-05 09:10:00': {'1. open': '3821.19000',\n", + " '2. high': '3821.32000',\n", + " '3. low': '3817.84000',\n", + " '4. close': '3818.74000',\n", + " '5. volume': 572},\n", + " '2022-01-05 09:05:00': {'1. open': '3820.22000',\n", + " '2. high': '3825.94000',\n", + " '3. low': '3818.57000',\n", + " '4. close': '3821.20000',\n", + " '5. volume': 660},\n", + " '2022-01-05 09:00:00': {'1. open': '3820.83000',\n", + " '2. high': '3827.09000',\n", + " '3. low': '3816.64000',\n", + " '4. close': '3820.22000',\n", + " '5. volume': 738},\n", + " '2022-01-05 08:55:00': {'1. open': '3821.03000',\n", + " '2. high': '3822.76000',\n", + " '3. low': '3818.06000',\n", + " '4. close': '3820.82000',\n", + " '5. volume': 652}}}" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "url = \"https://www.alphavantage.co/query\"" + "ticker = 'ETH'\n", + "url = 'https://www.alphavantage.co/query?function=CRYPTO_INTRADAY&symbol='+ticker+'&market=USD&interval=5min&apikey={key}'\n", + "r = requests.get(url)\n", + "data = r.json()\n", + "data" ] }, { diff --git a/Source/Alphavantage.rst b/Source/Alphavantage.rst index 764c0f3..145daa9 100644 --- a/Source/Alphavantage.rst +++ b/Source/Alphavantage.rst @@ -1,7 +1,7 @@ .. _Alphavantage: Alphavantage -========= +============ Alpha Vantage provides enterprise-grade financial market data through a set of powerful and developer-friendly APIs. To set up this environment you will need to have an API key, it can be straightly taken from the documentation here. @@ -12,14 +12,14 @@ https://medium.com/codex/alpha-vantage-an-introduction-to-a-highly-efficient-fre https://github.com/RomelTorres/alpha_vantage Fetching the data ---------------- - -- `1. Historical Price and Volume for 1 Stock. <#1>`__ -- `2. Time Periods <#2>`__ -- `3. Frequency <#3>`__ -- `4. Split and Dividends <#4>`__ -- `5. Many Stocks <#5>`__ -- `6. Finanical Indices <#6>`__ +----------------- + +- `1. Historical Price and Volume for 1 Stock. <#1>`_ +- `2. Time Periods <#2>`_ +- `3. Frequency <#3>`_ +- `4. Split and Dividends <#4>`_ +- `5. Many Stocks <#5>`_ +- `6. Finanical Indices <#6>`_ - `7. Currencies <#7>`_ - `8. Crypto <#8>`_ - `9. Mutual Funds <#9>`_ @@ -27,110 +27,95 @@ Fetching the data - `11. Stock Fundamentals <#11>`_ - `12. Financials <#12>`_ - `13. Put Call Options <#13>`_ -- `14. Stream Real Time Data <#14>`__ +- `14. Stream Real Time Data <#14>`_ +- `15. Economic Indicators <#15>`_ +- `16. Technical Indicators <#16>`_ .. code:: ipython3 - import numpy as np - import yfinance as yf + from alpha_vantage.timeseries import TimeSeries + import pandas as pd + import time + import requests + from io import BytesIO Historical Price and Volume for 1 Stock ----------- - -.. code:: ipython3 - import numpy as np - import yfinance as yf - ticker = 'GE' - yf.download(ticker) - -Adding Time Periods ----------- +--------------------------------------- .. code:: ipython3 - yf.download(ticker, start = "2014-01-01", end = "2018-12-31") - GE = yf.download(ticker, start = "2014-01-01", end = "2018-12-31") - GE.info() - - -.. parsed-literal:: - - - DatetimeIndex: 1257 entries, 2014-01-02 to 2018-12-28 - Data columns (total 6 columns): - Open 1257 non-null float64 - High 1257 non-null float64 - Low 1257 non-null float64 - Close 1257 non-null float64 - Adj Close 1257 non-null float64 - Volume 1257 non-null int64 - dtypes: float64(5), int64(1) - memory usage: 68.7 KB - + data = { + "function": "DIGITAL_CURRENCY_DAILY", # WEEKLY, MONTHLY possible + "symbol": "ETH", + "market": 'CNY', + "apikey": key + } + r = requests.get(url, params=data) + data = r.json() + crypto_df = pd.DataFrame(data['Time Series (Digital Currency Daily)']).T.reset_index() + crypto_df = crypto_df.rename(columns={"index": "Date"}) + crypto_df['Date'] = pd.to_datetime(crypto_df['Date']) +Adding Time Periods +------------------- .. code:: ipython3 - yf.download(ticker, period = "ytd") - yf.download(ticker, period = "1mo") - yf.download(ticker, period = "5d") - yf.download(ticker, period = "10y") + weekly = { + "function": "DIGITAL_CURRENCY_WEEKLY", # WEEKLY, MONTHLY possible + "symbol": "ETH", + "market": 'CNY', + "apikey": key + } + monthly = { + "function": "DIGITAL_CURRENCY_MONTHLY", # WEEKLY, MONTHLY possible + "symbol": "ETH", + "market": 'CNY', + "apikey": key + } Frequency Setting ----------- - -.. code:: ipython3 - - yf.download('GE',period='1mo',interval='1h') - yf.download('GE',period='1mo',interval='5m') - GE = yf.download('GE',period='5d',interval='5m') - #Pre or post market data - GE=yf.download('GE',prepost=True,period='5d',interval='5m') - -Stock Split and dividends ----------- +----------------- .. code:: ipython3 - ticker = "AAPL" - # action = True for dividend and Stock Split - AAPL = yf.download(ticker, period="10y", actions = True) - AAPL.head() + ticker = 'TSLA' + interval = '1min' + api_key = key -.. code:: ipython3 - - AAPL[AAPL["Dividends"]>0] - AAPL.loc["2019-08-05":"2019-08-15"].diff() - AAPL[AAPL["Stock Splits"] > 0] - ticker = ['GE', 'AAPL','FB'] - yf.download(ticker, period="5y") -.. code:: ipython3 + api_url = f'https://www.alphavantage.co/query?function=TIME_SERIES_INTRADAY&symbol={ticker}&interval={interval}&apikey={api_key}' + raw_df = requests.get(api_url).json() + df = pd.DataFrame(raw_df[f'Time Series ({interval})']).T + df = df.rename(columns = {'1. open': 'open', '2. high': 'high', '3. low': 'low', '4. close': 'close', '5. volume': 'volume'}) + for i in df.columns: + df[i] = df[i].astype(float) + df.index = pd.to_datetime(df.index) + df = df.iloc[::-1] + df.tail() - stock=yf.download(ticker, period="5y").Close - - -FInancial Indices - --------------- - -.. code:: ipython3 - - index = ['^DJI', '^GSPC'] +Stock Split and dividends +------------------------- .. code:: ipython3 - stock = yf.download(index,period='10y').Close + ticker = "IBM" + url = 'https://www.alphavantage.co/query?function=OVERVIEW&symbol='+ticker+'&apikey={key}' + r = requests.get(url) + data = r.json() + dividends = pd.DataFrame(data, index = ['Values']) + dividends = dividends[['DividendPerShare', 'DividendYield', 'DividendDate', 'ExDividendDate']].T +Financial Indices +----------------- .. code:: ipython3 - #Total Return - index = ['^DJITR', '^SP500TR'] - -.. code:: ipython3 - - indexes = yf.download(index,period='10y').Close - + # premium feature, NOT FULLY TESTED + index = "DJI" # FCHI, IXIC, ... + url = 'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&symbol='+index+'&outputsize=full&apikey={key}' + r = requests.get(url) + data = r.json() Currencies @@ -138,34 +123,23 @@ Currencies .. code:: ipython3 - #Tickers - ticker1 = "EURUSD=X" - ticker2 = "USDEUR=X" - -.. code:: ipython3 - - yf.download(ticker1,period='5y') - -.. code:: ipython3 - - yf.download(ticker2,period='5y') - - - - - + # Currency list: https://www.alphavantage.co/physical_currency_list/ + currency_a = 'EUR' + currency_b = 'USD' + interval = '5min' # 1min, 5min, 15min, 30min, 60min + url = 'https://www.alphavantage.co/query?function=FX_INTRADAY&from_symbol=EUR&to_symbol=USD&interval=5min&apikey=demo' + r = requests.get(url) + data = r.json() Crypto --------------- .. code:: ipython3 - #Tickers - ticker1 = ["BTC-USD", "ETH-USD"] - -.. code:: ipython3 - - data = yf.download(ticker1,start='2019-08-01',end='2020-05-01') + ticker = 'ETH' + url = 'https://www.alphavantage.co/query?function=CRYPTO_INTRADAY&symbol='+ticker+'&market=USD&interval=5min&apikey={key}' + r = requests.get(url) + data = r.json() @@ -175,13 +149,10 @@ Mutual Funds .. code:: ipython3 - #Tickers - #20+Y Treasury Bobd ETF and Vivoldi Multi-Strategy Fund Class - ticker1 = ["TLT", "OMOIX"] - -.. code:: ipython3 - - data = yf.download(ticker1,start='2019-08-01',end='2020-05-01') + ticker = 'OMOIX' + url = 'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol='+ticker+'&apikey={key}' + r = requests.get(url) + data = r.json() @@ -191,103 +162,113 @@ Treasury Rates .. code:: ipython3 - #10Y and 5Y Treasury Rates - ticker1 = ["^TNX", "^FVX"] - -.. code:: ipython3 - - data = yf.download(ticker1,period="5y") + maturity = '10year' # 3month, 5year, 10year, 30year + interval = 'daily' # weekly, monthly + url = 'https://www.alphavantage.co/query?function=TREASURY_YIELD&interval='+interval+'&maturity='+maturity+'&apikey={key}' + r = requests.get(url) + data = r.json() Stock Fundamentals ---------------- - -.. code:: ipython3 - - ticker ="DIS" - dis = yf.Ticker(ticker) - -.. code:: ipython3 - - dis.ticker - - -.. parsed-literal:: - - 'DIS' - -.. code:: ipython3 - - data=dis.history() - -.. code:: ipython3 - - ticker = ["MSFT","FB"] - -.. code:: ipython3 - - for i in ticker: - df.loc["{}".format(i)] = pd.Series(yf.Ticker(i).info) +------------------ .. code:: ipython3 - df.info() + ticker = "IBM" + url = 'https://www.alphavantage.co/query?function=OVERVIEW&symbol='+ticker+'&apikey={key}' + r = requests.get(url) + data = r.json() Import Financials ---------------- - -.. code:: ipython3 - - ticker ="DIS" - dis = yf.Ticker(ticker) - -.. code:: ipython3 - - dis.balance_sheet - -.. code:: ipython3 - - dis.financials - -.. code:: ipython3 - - dis.cashflow - -Put Call Option ---------------- - -.. code:: ipython3 - - ticker ="DIS" - dis = yf.Ticker(ticker) - -.. code:: ipython3 - - dis.option_chain() - -.. code:: ipython3 - - calls = dis.option_chain()[0] - calls - -.. code:: ipython3 - - puts = dis.option_chain()[1] - puts - - ### Stream Realtime Data - -.. code:: ipython3 - - import time - -.. code:: ipython3 - - ticker1 ="EURUSD=X" - data = yf.download(ticker1,interval = '1m', period='1d') - print(data.index[-1], data.iloc[-1,3]) - #Every 5 second data corresponding to 5 seconds - while True: - time.sleep(5) - data = yf.download(ticker1,interval = '1m', period='1d') - print(data.index[-1], data.iloc[-1,3]) +----------------- + +.. code:: ipython3 + + document = 'INCOME_STATEMENT' # BALANCE_SHEET, CASH_FLOW + url = 'https://www.alphavantage.co/query?function='+document+'&symbol=IBM&apikey=demo' + r = requests.get(url) + data = r.json() + +Stream Realtime Data +-------------------- + +.. code:: ipython3 + + def get_live_updates(symbol): + api_key = key + api_url = f'https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol={symbol}&apikey={api_key}' + raw_df = requests.get(api_url).json() + attributes = {'attributes':['symbol', 'open', 'high', 'low', 'price', 'volume', 'latest trading day', 'previous close', 'change', 'change percent']} + attributes_df = pd.DataFrame(attributes) + values = [] + for i in list(raw_df['Global Quote']): + values.append(raw_df['Global Quote'][i]) + values_dict = {'values':values} + values_df = pd.DataFrame(values).rename(columns = {0:'values'}) + frames = [attributes_df, values_df] + df = pd.concat(frames, axis = 1, join = 'inner').set_index('attributes') + return df + + ibm_updates = get_live_updates('IBM') + ibm_updates + +Economic Indicators +------------------- + +.. code:: ipython3 + + gdp = { + "function": "REAL_GDP", + "interval": "annual", # quarterly + "apikey": key + } + treasury_yield = { + "function": "TREASURY_YIELD", + "interval": "weekly", # daily, monthly + "maturity": "3month", # OPTIONAL 5year, 10year, 30year + "apikey": key + } + federal_funds_rate = { + "function": "FEDERAL_FUNDS_RATE", + "interval": "weekly", # daily, monthly + "apikey": key + } + cpi = { + "function": "CPI", + "interval": "weekly", # daily, monthly + "apikey": key + } + inflation = { + "function": "INFLATION", + "interval": "weekly", # daily, monthly + "apikey": key + } + consumer_sentiment = { + "function": "CONSUMER_SENTIMENT", + "apikey": key + } + unemployment = { + "function": "UNEMPLOYMENT", + "apikey": key + } + r = requests.get(url, params=unemployment) # REPLACE 'params' with desired dict + data = r.json() + df = pd.DataFrame(data['data']) + df = crypto_df.set_index("date") + +Technical Indicators +-------------------- + +.. code:: ipython3 + + popular_ti = { + "function": "ADX", # REPLACE: EMA, RSI, ADX, SMA + "symbol": "IBM", + "interval": "weekly", + "time_period": "10", + "series_type": "open", + "apikey": key + } + + r = requests.get(url, params=popular_ti) + data = r.json() \ No newline at end of file