Last active
June 10, 2019 16:40
-
-
Save alvarobartt/107afe09f711eee1b5e71cfeca19674d to your computer and use it in GitHub Desktop.
Test investpy (https://github.com/alvarob96/investpy) functions on World ETF Retrieval
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Copyright 2018-2019 Alvaro Bartolome | |
# See LICENSE for details. | |
__author__ = "Alvaro Bartolome <[email protected]>" | |
import investpy | |
import pandas as pd | |
import datetime | |
# Listing Retrieval of Available ETFs | |
available_markets = investpy.get_etf_markets() # retrieves all the available merkets/countries for ETF retrieval | |
world_etf_df = investpy.get_etf_df(country=None) # ``country=None`` pandas.DataFrame containing all ETFs | |
autria_etf_df = investpy.get_etf_df(country='austria') # ``country=austria`` pandas.DataFrame containing all the ETFs from Austria | |
world_etf_list = investpy.get_etf_list(country=None) # ``country=None`` lists all ETFs | |
austria_etf_list = investpy.get_etf_list(country='austria') # ``country=austria`` lists all the ETFs from Austria | |
world_etf_dict = investpy.get_etf_dict(country=None, columns=['name', 'symbol'], as_json=False) # ``country=None`` dictionary containing all ETFs | |
austria_etf_dict = investpy.get_etf_dict(country='austria', columns=['name', 'symbol'], as_json=False) # ``country=austria`` dictionary containing all all the ETFs from Austria | |
# Historical Data Retrieval of Available ETFs | |
recent_df = investpy.get_etf_recent_data(etf='Russell High Dividend Australian Shares', as_json=False, order='ascending') | |
today = str(datetime.datetime.today().strftime('%d/%m/%Y')) | |
five_years_ago = str((datetime.datetime.today() - datetime.timedelta(days=5*365)).strftime('%d/%m/%Y')) | |
historical_df = investpy.get_etf_historical_data(etf='First Trust Canadian Capital Strength', start=five_years_ago, end=today, as_json=False, order='ascending') | |
# Please STAR investpy on https://github.com/alvarob96/investpy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment