def search_investing_etf(isins=False, tickers=False, visual=''):
    etfs = investpy.get_etfs()

    if isins:
        for isin in isins:
            if visual == 'jupyter':
                display(etfs.loc[etfs['isin'] == isin.upper()][[
                    'symbol', 'isin', 'stock_exchange', 'currency', 'name',
                    'country'
                ]])
            else:
                print(etfs.loc[etfs['isin'] == isin.upper()][[
                    'symbol', 'isin', 'stock_exchange', 'currency', 'name',
                    'country'
                ]])

    elif tickers:
        for ticker in tickers:
            if visual == 'jupyter':
                display(etfs.loc[etfs['symbol'] == ticker.upper()].sort_values(
                    by='def_stock_exchange', ascending=False)[[
                        'symbol', 'isin', 'stock_exchange', 'currency', 'name',
                        'country'
                    ]])
            else:
                print(etfs.loc[etfs['symbol'] == ticker.upper()].sort_values(
                    by='def_stock_exchange', ascending=False)[[
                        'symbol', 'isin', 'stock_exchange', 'currency', 'name',
                        'country'
                    ]])

    else:
        print('Something went wrong with the function inputs')
Exemplo n.º 2
0
def get_stock_lists():
    '''Retrieve stock lists as dataframe tables, from investpy library'''

    stocks = investpy.get_stocks()
    etfs = investpy.get_etfs()
    indices = investpy.get_indices()

    return stocks, etfs, indices
Exemplo n.º 3
0
    def _build_index(self):
        def with_index(df, type, column, new_name="symbol"):
            if not "country" in df:
                df["country"] = "unknown"
            else:
                df["country"] = df["country"].replace({
                    None: "unknown",
                    "": "unknown"
                }).fillna('unknown')

            df.index = pd.MultiIndex.from_tuples([
                (s, type, c)
                for s, c in zip(df[column].to_list(), df["country"].to_list())
            ]).rename([
                new_name if new_name is not None else column, "type", "country"
            ])
            df = df.drop([column, "country"], axis=1)
            df = df.drop(df.index[df.index.duplicated('first')], axis=0)
            return df.loc[df.index.dropna()]

        symbols_df = pd.concat(
            [
                with_index(ip.get_bonds(), "BOND",
                           "name"),  # country	"name"	full_name
                with_index(
                    ip.get_certificates(), "CERT", "symbol"
                ),  # country', 'name', 'full_name', '"symbol"', 'issuer', 'isin', 'asset_class', 'underlying'
                with_index(ip.get_cryptos(), "CRYPTO",
                           "symbol"),  # 'name', '"symbol"', 'currency'
                with_index(
                    ip.get_commodities(), "COMM", "name"
                ),  # 'title', 'country', '"name"', 'full_name', 'currency', 'group'
                with_index(
                    ip.get_etfs(), "ETF", "symbol"
                ),  # 'country', 'name', 'full_name', '"symbol"', 'isin', 'asset_class', 'currency', 'stock_exchange', 'def_stock_exchange'
                # with_index(ip.get_funds(), "FUND", "isin"),             # 'country', 'name', 'symbol', 'issuer', '"isin"', 'asset_class', 'currency', 'underlying'
                with_index(
                    ip.get_indices(), "INDEX", "symbol"
                ),  # 'country', 'name', 'full_name', '"symbol"', 'currency', 'class', 'market'
                with_index(
                    ip.get_stocks(), "STOCK", "symbol"
                ),  # ['country', 'name', 'full_name', 'isin', 'currency', '"symbol"'
                with_index(
                    pd.DataFrame(
                        [f'{c}/USD' for c in ip.get_available_currencies()],
                        columns=['symbol']), "FX", "symbol")
            ],
            axis=0)

        # update the index table
        upsert(self.engine,
               symbols_df,
               DataProvider.symbols_table_name,
               if_row_exists='ignore')
Exemplo n.º 4
0
def test_etfs_errors():
    """
    This function raises errors on etf retrieval functions
    """

    try:
        retrieve_etfs(test_mode=None)
    except:
        pass

    params = [
        {
            'country': ['error']
        },
        {
            'country': 'error'
        },
    ]

    for param in params:
        try:
            investpy.get_etfs(country=param['country'])
        except:
            pass

        try:
            investpy.get_etfs_list(country=param['country'])
        except:
            pass

    params = [
        {
            'country': ['error'],
            'columns': None,
            'as_json': False
        },
        {
            'country': 'spain',
            'columns': None,
            'as_json': 'error'
        },
        {
            'country': 'spain',
            'columns': 0,
            'as_json': True
        },
        {
            'country': 'spain',
            'columns': ['error'],
            'as_json': False
        },
    ]

    for param in params:
        try:
            investpy.get_etfs_dict(country=param['country'],
                                   columns=param['columns'],
                                   as_json=param['as_json'])
        except:
            pass

    params = [
        {
            'etf': None,
            'country': 'spain',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': ['error'],
            'country': 'spain',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': None,
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'error',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'netherlands',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': ['error'],
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'spain',
            'as_json': 'error',
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'spain',
            'as_json': True,
            'order': 'error',
            'debug': True
        },
        {
            'etf': 'error',
            'country': 'spain',
            'as_json': True,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': ['error'],
            'country': 'spain',
            'as_json': True,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'spain',
            'as_json': True,
            'order': 'ascending',
            'debug': 'error'
        },
    ]

    for param in params:
        try:
            investpy.get_etf_recent_data(etf=param['etf'],
                                         country=param['country'],
                                         as_json=param['as_json'],
                                         order=param['order'],
                                         debug=param['debug'])
        except:
            pass

    params = [
        {
            'etf': None,
            'country': 'spain',
            'from_date': '01/01/2018',
            'to_date': '01/01/2019',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'error',
            'from_date': '01/01/2018',
            'to_date': '01/01/2019',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'netherlands',
            'from_date': '01/01/2018',
            'to_date': '01/01/2019',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': None,
            'from_date': '01/01/2018',
            'to_date': '01/01/2019',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': ['error'],
            'from_date': '01/01/2018',
            'to_date': '01/01/2019',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'spain',
            'from_date': '01/01/2018',
            'to_date': '01/01/2019',
            'as_json': 'error',
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'spain',
            'from_date': '01/01/2018',
            'to_date': '01/01/2019',
            'as_json': False,
            'order': 'error',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'spain',
            'from_date': 'error',
            'to_date': '01/01/2019',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'spain',
            'from_date': '01/01/2019',
            'to_date': 'error',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'error',
            'country': 'spain',
            'from_date': '01/01/2018',
            'to_date': '01/01/2019',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': ['error'],
            'country': 'spain',
            'from_date': '01/01/2018',
            'to_date': '01/01/2019',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'spain',
            'from_date': '01/01/1998',
            'to_date': '01/01/2019',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'spain',
            'from_date': '01/01/2019',
            'to_date': '01/01/1998',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'spain',
            'from_date': '01/01/1900',
            'to_date': '01/01/1950',
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'spain',
            'from_date': '01/01/2019',
            'to_date': '01/03/2019',
            'as_json': True,
            'order': 'ascending',
            'debug': 'error'
        },
    ]

    for param in params:
        try:
            investpy.get_etf_historical_data(etf=param['etf'],
                                             country=param['country'],
                                             from_date=param['from_date'],
                                             to_date=param['to_date'],
                                             as_json=param['as_json'],
                                             order=param['order'],
                                             debug=param['debug'])
        except:
            pass

    params = [
        {
            'country': 'error',
            'as_json': False,
        },
        {
            'country': None,
            'as_json': False,
        },
        {
            'country': ['error'],
            'as_json': False,
        },
        {
            'country': 'spain',
            'as_json': None,
        },
        {
            'country': 'spain',
            'as_json': ['error'],
        },
    ]

    for param in params:
        try:
            investpy.get_etfs_overview(country=param['country'])
        except:
            pass

    params = [
        {
            'by': None,
            'value': 'bbva',
        },
        {
            'by': ['error'],
            'value': 'bbva',
        },
        {
            'by': 'error',
            'value': 'bbva',
        },
        {
            'by': 'name',
            'value': None,
        },
        {
            'by': 'name',
            'value': ['error'],
        },
        {
            'by': 'isin',
            'value': 'error',
        },
    ]

    for param in params:
        try:
            investpy.search_etfs(by=param['by'], value=param['value'])
        except:
            pass
Exemplo n.º 5
0
def test_investpy_etfs():
    """
    This function checks that etf data retrieval functions listed in investpy work properly.
    """

    params = [
        {
            'country': 'spain',
        },
        {
            'country': None,
        },
    ]

    for param in params:
        investpy.get_etfs(country=param['country'])
        investpy.get_etfs_list(country=param['country'])

    params = [
        {
            'country': None,
            'columns': ['name'],
            'as_json': True
        },
        {
            'country': None,
            'columns': ['name'],
            'as_json': False
        },
        {
            'country': 'spain',
            'columns': ['name'],
            'as_json': True
        },
        {
            'country': 'spain',
            'columns': ['name'],
            'as_json': False
        },
        {
            'country': 'spain',
            'columns': None,
            'as_json': False
        },
    ]

    for param in params:
        investpy.get_etfs_dict(country=param['country'],
                               columns=param['columns'],
                               as_json=param['as_json'])

    investpy.get_etf_countries()

    params = [
        {
            'as_json': True,
            'order': 'ascending',
        },
        {
            'as_json': False,
            'order': 'ascending',
        },
        {
            'as_json': True,
            'order': 'descending',
        },
        {
            'as_json': False,
            'order': 'descending',
        },
    ]

    for param in params:
        investpy.get_etf_recent_data(etf='bbva accion dj eurostoxx 50',
                                     country='spain',
                                     as_json=param['as_json'],
                                     order=param['order'],
                                     interval='Daily')

        investpy.get_etf_historical_data(etf='bbva accion dj eurostoxx 50',
                                         country='spain',
                                         from_date='01/01/2010',
                                         to_date='01/01/2019',
                                         as_json=param['as_json'],
                                         order=param['order'],
                                         interval='Daily')

    params = [
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'spain',
            'as_json': False
        },
        {
            'etf': 'bbva accion dj eurostoxx 50',
            'country': 'spain',
            'as_json': True
        }
    ]

    for param in params:
        investpy.get_etf_information(etf=param['etf'], country=param['country'], as_json=param['as_json'])

    params = [
        {
            'country': 'united states',
            'as_json': True,
            'n_results': 2
        },
        {
            'country': 'united kingdom',
            'as_json': False,
            'n_results': 2
        },
    ]

    for param in params:
        investpy.get_etfs_overview(country=param['country'], as_json=param['as_json'], n_results=param['n_results'])

    investpy.search_etfs(by='name', value='bbva')
Exemplo n.º 6
0
def test_investpy_etfs():
    """
    This function checks that etf data retrieval functions listed in investpy work properly.
    """

    params = [
        {
            'country': 'spain',
        },
        {
            'country': None,
        },
    ]

    for param in params:
        investpy.get_etfs(country=param['country'])
        investpy.get_etfs_list(country=param['country'])

    params = [
        {
            'country': None,
            'columns': ['id', 'name'],
            'as_json': True
        },
        {
            'country': None,
            'columns': ['id', 'name'],
            'as_json': False
        },
        {
            'country': 'spain',
            'columns': ['id', 'name'],
            'as_json': True
        },
        {
            'country': 'spain',
            'columns': ['id', 'name'],
            'as_json': False
        },
        {
            'country': 'spain',
            'columns': None,
            'as_json': False
        },
    ]

    for param in params:
        investpy.get_etfs_dict(country=param['country'],
                               columns=param['columns'],
                               as_json=param['as_json'])

    investpy.get_etf_countries()

    params = [
        {
            'as_json': True,
            'order': 'ascending',
            'debug': False
        },
        {
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'as_json': True,
            'order': 'descending',
            'debug': False
        },
        {
            'as_json': False,
            'order': 'descending',
            'debug': False
        },
    ]

    for param in params:
        investpy.get_etf_recent_data(etf='bbva accion dj eurostoxx 50',
                                     country='spain',
                                     as_json=param['as_json'],
                                     order=param['order'],
                                     debug=param['debug'])

        investpy.get_etf_historical_data(etf='bbva accion dj eurostoxx 50',
                                         country='spain',
                                         from_date='01/01/2010',
                                         to_date='01/01/2019',
                                         as_json=param['as_json'],
                                         order=param['order'],
                                         debug=param['debug'])

    params = [
        {
            'country': 'france',
            'as_json': True,
        },
        {
            'country': 'france',
            'as_json': False,
        },
    ]

    for param in params:
        investpy.get_etfs_overview(country=param['country'],
                                   as_json=param['as_json'])

    investpy.search_etfs(by='name', value='bbva')
Exemplo n.º 7
0
    etf="iShares 7-10 Year Treasury Bond",
    country="United States",
    from_date="30/01/1900",
    to_date=DD_END_DATE)
investpy_IEF.to_pickle('./Market_Watch_Data/investpy_IEF.pkl')

# investpy 패키지를 사용하여 한국 국채 ETF 자료 받기 (Kiwoom KOSEF 10Y Treasury Bond)
investpy_148070 = investpy.get_etf_historical_data(
    etf="Kiwoom KOSEF 10Y Treasury Bond",
    country="south korea",
    from_date="30/01/1900",
    to_date=DD_END_DATE)
investpy_148070.to_pickle('./Market_Watch_Data/investpy_148070.pkl')

# 미국 ETF 리스트 검색
df_us_etf = investpy.get_etfs(country='United States')
df_us_etf_search = df_us_etf[df_us_etf['symbol'].str.contains("IEF")]

# 한국 ETF 리스트 검색
df_kr_etf = investpy.get_etfs(country='south korea')
df_kr_etf_search = df_kr_etf[df_kr_etf['symbol'].str.contains("148070")]
df_kr_etf_search["name"]

########################################################################################################################
# Economic Calendar
# investpy_economic_calendar_us_20000101_20220215 = investpy.economic_calendar(
#     countries=["united states"], from_date="01/01/2000", to_date="15/02/2022")
# investpy_economic_calendar_us_20000101_20220215.to_pickle('./Market_Watch_Data/investpy_economic_calendar_us_20000101_20220215.pkl')

# # Economic Calendar US (20000101~20220131)
# investpy_economic_calendar_us_20000101_20220131 = investpy.economic_calendar(
Exemplo n.º 8
0
fund_country = xw.sheets[home_sheet].range('F3').value
index_country = xw.sheets[home_sheet].range('F4').value
stock_country = xw.sheets[home_sheet].range('F5').value
bond_country = xw.sheets[home_sheet].range('F6').value
etf_country = xw.sheets[home_sheet].range('F7').value

req_funds = investpy.get_funds(country=fund_country)

req_indices = investpy.get_indices(country=index_country)

req_stocks = investpy.get_stocks(country=stock_country)

req_bonds = investpy.get_bonds(country=bond_country)

req_etfs = investpy.get_etfs(country=etf_country)


def GetFunds():
    wb = xw.Book.caller()
    wb.sheets[fund_sheet].range('D1').value = req_funds


def GetIndices():
    wb = xw.Book.caller()
    wb.sheets[index_sheet].range('D1').value = req_indices


def GetStocks():
    wb = xw.Book.caller()
    wb.sheets[stock_sheet].range('D1').value = req_stocks
Exemplo n.º 9
0
def test_investpy():
    """
    This function checks that main functions of investpy work properly.
    """

    print(investpy.__author__, investpy.__version__)

    for value in ['spain', None]:
        investpy.get_equities(country=value)
        investpy.get_equities_list(country=value)

    params = [
        {
            'country': None,
            'columns': ['id', 'name'],
            'as_json': True
        },
        {
            'country': 'spain',
            'columns': ['id', 'name'],
            'as_json': True
        },
        {
            'country': None,
            'columns': ['id', 'name'],
            'as_json': False
        },
        {
            'country': 'spain',
            'columns': None,
            'as_json': False
        },
        {
            'country': 'spain',
            'columns': ['id', 'name'],
            'as_json': False
        },
    ]

    for param in params:
        investpy.get_equities_dict(country=param['country'],
                                   columns=param['columns'],
                                   as_json=param['as_json'])

    investpy.get_equity_countries()

    params = [
        {
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'as_json': True,
            'order': 'descending',
            'debug': False
        },
        {
            'as_json': True,
            'order': 'ascending',
            'debug': False
        },
        {
            'as_json': False,
            'order': 'descending',
            'debug': False
        },
    ]

    for param in params:
        investpy.get_recent_data(equity='enagás',
                                 country='spain',
                                 as_json=param['as_json'],
                                 order=param['order'],
                                 debug=param['debug'])

        investpy.get_historical_data(equity='enagás',
                                     country='spain',
                                     from_date='01/01/1990',
                                     to_date='01/01/2019',
                                     as_json=param['as_json'],
                                     order=param['order'],
                                     debug=param['debug'])

    for value in ['spanish', 'english']:
        investpy.get_equity_company_profile(equity='enagás',
                                            country='spain',
                                            language=value)

    retrieve_equities(test_mode=True)
    retrieve_equity_countries(test_mode=True)

    params = [
        {
            'country': 'spain',
        },
        {
            'country': None,
        },
    ]

    for param in params:
        investpy.get_funds(country=param['country'])
        investpy.get_funds_list(country=param['country'])

    params = [
        {
            'country': None,
            'columns': ['id', 'name'],
            'as_json': True
        },
        {
            'country': 'spain',
            'columns': ['id', 'name'],
            'as_json': True
        },
        {
            'country': None,
            'columns': ['id', 'name'],
            'as_json': False
        },
        {
            'country': 'spain',
            'columns': None,
            'as_json': False
        },
        {
            'country': 'spain',
            'columns': ['id', 'name'],
            'as_json': False
        },
    ]

    for param in params:
        investpy.get_funds_dict(country=param['country'],
                                columns=param['columns'],
                                as_json=param['as_json'])

    params = [
        {
            'fund': 'bbva multiactivo conservador pp',
            'country': 'spain',
            'as_json': True,
        },
        {
            'fund': 'bbva multiactivo conservador pp',
            'country': 'spain',
            'as_json': False,
        },
    ]

    for param in params:
        investpy.get_fund_information(fund=param['fund'],
                                      country=param['country'],
                                      as_json=param['as_json'])

    params = [
        {
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'as_json': True,
            'order': 'descending',
            'debug': False
        },
        {
            'as_json': True,
            'order': 'ascending',
            'debug': False
        },
        {
            'as_json': False,
            'order': 'descending',
            'debug': False
        },
    ]

    for param in params:
        investpy.get_fund_recent_data(fund='bbva multiactivo conservador pp',
                                      country='spain',
                                      as_json=param['as_json'],
                                      order=param['order'],
                                      debug=param['debug'])

        investpy.get_fund_historical_data(
            fund='bbva multiactivo conservador pp',
            country='spain',
            from_date='01/01/2010',
            to_date='01/01/2019',
            as_json=param['as_json'],
            order=param['order'],
            debug=param['debug'])

    investpy.get_fund_countries()

    investpy.get_funds()

    retrieve_funds(test_mode=True)
    retrieve_fund_countries(test_mode=True)

    investpy.get_etf_countries()

    for value in ['spain', None]:
        investpy.get_etfs(country=value)
        investpy.get_etfs_list(country=value)

    params = [
        {
            'country': None,
            'columns': ['id', 'name'],
            'as_json': True
        },
        {
            'country': 'spain',
            'columns': ['id', 'name'],
            'as_json': True
        },
        {
            'country': None,
            'columns': ['id', 'name'],
            'as_json': False
        },
        {
            'country': 'spain',
            'columns': None,
            'as_json': False
        },
        {
            'country': 'spain',
            'columns': ['id', 'name'],
            'as_json': False
        },
    ]

    for param in params:
        investpy.get_etfs_dict(country=param['country'],
                               columns=param['columns'],
                               as_json=param['as_json'])

    params = [
        {
            'as_json': False,
            'order': 'ascending',
            'debug': True
        },
        {
            'as_json': True,
            'order': 'descending',
            'debug': False
        },
        {
            'as_json': True,
            'order': 'ascending',
            'debug': False
        },
        {
            'as_json': False,
            'order': 'descending',
            'debug': False
        },
    ]

    for param in params:
        investpy.get_etf_recent_data(etf='bbva accion dj eurostoxx 50',
                                     country='spain',
                                     as_json=param['as_json'],
                                     order=param['order'],
                                     debug=param['debug'])

        investpy.get_etf_historical_data(etf='bbva accion dj eurostoxx 50',
                                         country='spain',
                                         from_date='01/01/2010',
                                         to_date='01/01/2019',
                                         as_json=param['as_json'],
                                         order=param['order'],
                                         debug=param['debug'])

    params = [
        {
            'country': 'france',
            'as_json': True,
        },
        {
            'country': 'usa',
            'as_json': False,
        },
    ]

    for param in params:
        investpy.get_etfs_overview(country=param['country'],
                                   as_json=param['as_json'])

    retrieve_etfs(test_mode=True)
Exemplo n.º 10
0
def test_investpy():
    """
    This function checks that main functions of investpy work properly.
    """

    investpy.get_equities()
    investpy.get_equities_list()

    params = [
        {'as_json': False, 'order': 'ascending'},
        {'as_json': True, 'order': 'descending'},
        {'as_json': True, 'order': 'ascending'},
        {'as_json': False, 'order': 'descending'},
    ]

    for param in params:
        investpy.get_recent_data(equity='enagás', as_json=param['as_json'], order=param['order'])
        investpy.get_historical_data(equity='enagás', start='01/01/1990', end='01/01/2019', as_json=param['as_json'], order=param['order'])

    for value in ['spanish', 'english']:
        investpy.get_equity_company_profile(equity='enagás', language=value)

    retrieve_equities()

    investpy.get_funds()
    investpy.get_funds_list()

    for value in [True, False]:
        investpy.get_funds_dict(columns=['id', 'name'], as_json=value)
        investpy.get_fund_information(fund='bbva multiactivo conservador pp', as_json=value)

    params = [
        {'as_json': False, 'order': 'ascending'},
        {'as_json': True, 'order': 'descending'},
        {'as_json': True, 'order': 'ascending'},
        {'as_json': False, 'order': 'descending'},
    ]

    for param in params:
        investpy.get_fund_recent_data(fund='bbva multiactivo conservador pp', as_json=param['as_json'], order=param['order'])
        investpy.get_fund_historical_data(fund='bbva multiactivo conservador pp', start='01/01/2010', end='01/01/2019', as_json=param['as_json'], order=param['order'])

    investpy.get_funds()

    retrieve_funds()

    investpy.get_etfs()
    investpy.get_etf_countries()

    for value in ['spain', None]:
        investpy.get_etf_df(country=value)
        investpy.get_etf_list(country=value)

    params = [
        {'country': None, 'columns': ['id', 'name'], 'as_json': False},
        {'country': None, 'columns': ['id', 'name'], 'as_json': True},
        {'country': 'spain', 'columns': None, 'as_json': False},
        {'country': 'spain', 'columns': ['id', 'name'], 'as_json': True},
    ]

    for param in params:
        investpy.get_etf_dict(country=param['country'], columns=param['columns'], as_json=param['as_json'])

    params = [
        {'as_json': False, 'order': 'ascending'},
        {'as_json': True, 'order': 'descending'},
        {'as_json': True, 'order': 'ascending'},
        {'as_json': False, 'order': 'descending'},
    ]

    for param in params:
        investpy.get_etf_recent_data(etf='bbva accion dj eurostoxx 50', as_json=param['as_json'], order=param['order'])
        investpy.get_etf_historical_data(etf='bbva accion dj eurostoxx 50', start='01/01/2010', end='01/01/2019', as_json=param['as_json'], order=param['order'])

    retrieve_etfs()
import yfinance as yf
import pandas as pd


# In[69]:


# Retrieve all the available stocks as a Python list
investpy.get_stocks(country='brazil')


# In[70]:


# Retrieve all the available etfs as a Python list
investpy.get_etfs(country='brazil')


# In[138]:


# Retrieve all the indexes
investpy.get_indices()

# get data using investing website
indice = 'LBMA Gold Fixing Price'
country = 'united kingdom'
from_date = '19/11/2004'
to_date = '25/09/2020'
#investpy.indices.get_index_historical_data(indice, country, from_date, to_date, order='ascending', interval='Daily')
for item in investpy.search.search_quotes('OZ1'):
Exemplo n.º 12
0
def my_get_etf(country=None):
    return investpy.get_etfs(country=country)
Exemplo n.º 13
0
#       jupytext_version: 1.11.1
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import investpy
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns

# ### Get funds in Germany

funds = investpy.get_etfs(country='germany')

print(f"There are {len(funds)} funds avaliable in Germany")

# ## I am mostly interested in accumulating BlackRock (and later Amundi) ETFs

# So we are searching for iShares with Acc fields in the names.

n = 0
for fund in funds.name:
    if (fund.find('iShares') != -1 and fund.find('Acc') != -1) or (
            fund.find('Lyxor') != -1
            and fund.find('Acc') != -1):  # or (fund.find('Amundi') != -1)
        if n == 0:
            df = investpy.etfs.get_etf_information(etf=fund,
                                                   country='germany',