How to use investpy - 10 common examples

To help you get started, we’ve selected a few investpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alvarob96 / investpy / tests / test_investpy_errors.py View on Github external
'interval': ['error']
        },
        {
            'stock': 'BBVA',
            'country': 'spain',
            'from_date': '01/01/2019',
            'to_date': '01/03/2019',
            'as_json': False,
            'order': 'ascending',
            'interval': 'error'
        },
    ]

    for param in params:
        try:
            investpy.get_stock_historical_data(stock=param['stock'],
                                               country=param['country'],
                                               from_date=param['from_date'],
                                               to_date=param['to_date'],
                                               as_json=param['as_json'],
                                               order=param['order'],
                                               interval=param['interval'])
        except:
            pass

    params = [
        {
            'stock': None,
            'country': 'spain',
            'language': 'spanish'
        },
        {
github alvarob96 / investpy / tests / test_investpy.py View on Github external
'order': 'descending',
        },
        {
            'as_json': False,
            'order': 'descending',
        },
    ]

    for param in params:
        investpy.get_stock_recent_data(stock='BBVA',
                                       country='spain',
                                       as_json=param['as_json'],
                                       order=param['order'],
                                       interval='Daily')

        investpy.get_stock_historical_data(stock='BBVA',
                                           country='spain',
                                           from_date='01/01/1990',
                                           to_date='01/01/2019',
                                           as_json=param['as_json'],
                                           order=param['order'],
                                           interval='Daily')

    for value in ['spanish', 'english']:
        investpy.get_stock_company_profile(stock='BBVA',
                                           country='spain',
                                           language=value)

    params = [
        {
            'stock': 'bbva',
            'country': 'spain',
github alvarob96 / trendet / tests / test_trendet.py View on Github external
country=param['country'],
                                from_date=param['from_date'],
                                to_date=param['to_date'],
                                window_size=param['window_size'],
                                trend_limit=param['trend_limit'],
                                labels=param['labels'],
                                identify=param['identify'])

        trendet.identify_all_trends(stock=param['stock'],
                                    country=param['country'],
                                    from_date=param['from_date'],
                                    to_date=param['to_date'],
                                    window_size=param['window_size'],
                                    identify=param['identify'])

    df = get_stock_historical_data(stock='REP',
                                   country='Spain',
                                   from_date='01/01/2018',
                                   to_date='01/01/2019')

    params = [
        {
            'column': 'Close',
            'window_size': 5,
            'identify': 'both'
        },
        {
            'column': 'Close',
            'window_size': 5,
            'identify': 'up'
        },
        {
github alvarob96 / trendet / tests / test_trendet_errors.py View on Github external
labels=param['labels'],
                                    identify=param['identify'])
        except:
            pass

        try:
            trendet.identify_all_trends(stock=param['stock'],
                                        country=param['country'],
                                        from_date=param['from_date'],
                                        to_date=param['to_date'],
                                        window_size=param['window_size'],
                                        identify=param['identify'])
        except:
            pass

    df = get_stock_historical_data(stock='REP',
                                   country='Spain',
                                   from_date='01/01/2018',
                                   to_date='01/01/2019')

    df['error'] = 'error'

    params = [
        {
            'df': None,
            'column': 'Close',
            'window_size': 5,
            'identify': 'both'
        },
        {
            'df': ['error'],
            'column': 'Close',
github alvarob96 / investpy / tests / test_investpy_errors.py View on Github external
{
            'country': ['error']
        },
        {
            'country': 'error'
        },
    ]

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

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

    params = [
        {
            'country': ['error'],
            'columns': None,
            'as_json': False
        },
        {
            'country': 'spain',
            'columns': None,
            'as_json': 'error'
        },
        {
            'country': 'spain',
github alvarob96 / trendet / tests / test_trendet.py View on Github external
'labels': ['A', 'B'],
            'identify': 'down',
        },
        {
            'stock': 'BBVA',
            'country': 'Spain',
            'from_date': '01/01/2018',
            'to_date': '01/01/2019',
            'window_size': 5,
            'trend_limit': 2,
            'labels': None,
            'identify': 'down',
        }
    ]

    stocks = get_stocks_list(country='Spain')

    for stock in stocks[:25]:
        obj = {
            'stock': stock,
            'country': 'Spain',
            'from_date': '01/01/2018',
            'to_date': '01/01/2019',
            'window_size': 5,
            'trend_limit': 5,
            'labels': None,
            'identify': 'both',
        }

        params.append(obj)

    for param in params:
github alvarob96 / investpy / tests / test_investpy.py View on Github external
"""
    This function checks that stock data retrieval functions listed in investpy work properly.
    """

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

    for param in params:
        investpy.get_stocks(country=param['country'])
        investpy.get_stocks_list(country=param['country'])

    params = [
        {
            'country': None,
            'columns': ['full_name', 'name'],
            'as_json': True
        },
        {
            'country': None,
            'columns': ['full_name', 'name'],
            'as_json': False
        },
        {
            'country': 'spain',
            'columns': ['full_name', 'name'],
            'as_json': True
github alvarob96 / investpy / tests / test_investpy_errors.py View on Github external
'order': 'ascending',
            'interval': ['error']
        },
        {
            'bond': 'Argentina 3Y',
            'from_date': '01/01/2019',
            'to_date': '01/03/2019',
            'as_json': False,
            'order': 'ascending',
            'interval': 'error'
        },
    ]

    for param in params:
        try:
            investpy.get_bond_historical_data(bond=param['bond'],
                                              from_date=param['from_date'],
                                              to_date=param['to_date'],
                                              as_json=param['as_json'],
                                              order=param['order'],
                                              interval=param['interval'])
        except:
            pass

    params = [
        {
            'bond': None,
            'as_json': False
        },
        {
            'bond': ['error'],
            'as_json': False
github alvarob96 / investpy / tests / test_investpy.py View on Github external
'as_json': True,
            'order': 'descending',
        },
        {
            'as_json': False,
            'order': 'descending',
        },
    ]

    for param in params:
        investpy.get_bond_recent_data(bond='Spain 30Y',
                                      as_json=param['as_json'],
                                      order=param['order'],
                                      interval='Daily')

        investpy.get_bond_historical_data(bond='Spain 30Y',
                                          from_date='01/01/1990',
                                          to_date='01/01/2019',
                                          as_json=param['as_json'],
                                          order=param['order'],
                                          interval='Daily')

    params = [
        {
            'bond': 'spain 30y',
            'as_json': False
        },
        {
            'bond': 'argentina 3y',
            'as_json': True
        },
        {
github alvarob96 / investpy / tests / test_investpy.py View on Github external
{
            'bond': 'spain 30y',
            'as_json': False
        },
        {
            'bond': 'argentina 3y',
            'as_json': True
        },
        {
            'bond': 'germany 3m',
            'as_json': False
        },
    ]

    for param in params:
        investpy.get_bond_information(bond=param['bond'], as_json=param['as_json'])
    
    params = [
        {
            'country': 'united states',
            'as_json': True,
        },
        {
            'country': 'united kingdom',
            'as_json': False,
        }
    ]

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

    investpy.search_bonds(by='name', value='Spain')