Ejemplo n.º 1
0
def test_investpy_technical():
    """
    This function checks that investpy news retrieval functionality works as expected.
    """

    params = [
        {
            'name': 'bbva',
            'country': 'spain',
            'product_type': 'stock',
            'interval': 'weekly',
        },
        {
            'name': 'bbva mi inversion rf mixta fi',
            'country': 'spain',
            'product_type': 'fund',
            'interval': 'daily',
        },
    ]

    for param in params:
        investpy.technical_indicators(name=param['name'],
                                      country=param['country'],
                                      product_type=param['product_type'],
                                      interval=param['interval'])

        investpy.moving_averages(name=param['name'],
                                 country=param['country'],
                                 product_type=param['product_type'],
                                 interval=param['interval'])

        investpy.pivot_points(name=param['name'],
                              country=param['country'],
                              product_type=param['product_type'],
                              interval=param['interval'])
Ejemplo n.º 2
0
def test_investpy_technical():
    """
    This function checks that investpy news retrieval functionality works as expected.
    """

    params = list()

    for interval in list(investpy.utils.constant.INTERVAL_FILTERS.keys()):
        params.append({
            'name': 'bbva',
            'country': 'spain',
            'product_type': 'stock',
            'interval': interval
        })

    for param in params:
        investpy.technical_indicators(name=param['name'],
                                      country=param['country'],
                                      product_type=param['product_type'],
                                      interval=param['interval'])

        investpy.moving_averages(name=param['name'],
                                 country=param['country'],
                                 product_type=param['product_type'],
                                 interval=param['interval'])

        investpy.pivot_points(name=param['name'],
                              country=param['country'],
                              product_type=param['product_type'],
                              interval=param['interval'])
Ejemplo n.º 3
0
def MovingAvgCerca(dataframe, tipo_strumento, periodizzazione):   #country e tipo bloccati

    if tipo_strumento == GLOBE.mappa_strumenti.get("stock"):    #primo parametro simbolo
        
        mav = inv.moving_averages(name = dataframe.get("info_gen")["symbol"].values[0], country = dataframe.get("info_gen")["country"].values[0], product_type = tipo_strumento, interval = periodizzazione.lower())
        return mav

    else:

        mav = inv.moving_averages(name = dataframe.get("info_gen")["name"].values[0], country = dataframe.get("info_gen")["country"].values[0], product_type = tipo_strumento, interval = periodizzazione.lower())
        return mav
Ejemplo n.º 4
0
def test_investpy_technical():
    """
    This function checks that investpy technical retrieval functionality works as expected.
    """

    params = list()

    for interval in list(investpy.utils.constant.INTERVAL_FILTERS.keys()):
        params.append({
            'name': 'bbva',
            'country': 'spain',
            'product_type': 'stock',
            'interval': interval
        })

    for param in params:
        investpy.technical_indicators(name=param['name'],
                                      country=param['country'],
                                      product_type=param['product_type'],
                                      interval=param['interval'])

        investpy.moving_averages(name=param['name'],
                                 country=param['country'],
                                 product_type=param['product_type'],
                                 interval=param['interval'])

        investpy.pivot_points(name=param['name'],
                              country=param['country'],
                              product_type=param['product_type'],
                              interval=param['interval'])

        issue284 = investpy.technical_indicators(name='bbva',
                                                 country='spain',
                                                 product_type='stock',
                                                 interval='daily')
        assert len(issue284.columns) == 5

        index284 = issue284.index
        assert len(index284) == 16

        assert issue284.columns[0] == 'Name'
        assert issue284.columns[2] == 'Value'
        assert issue284.columns[4] == 'Action'

        assert issue284['Name'][14] == 'Price'
        assert issue284['Name'][15] == 'DateTimeStamp'

        assert str(type(issue284['Value'][14])) == "<class 'str'>"
        assert str(type(issue284['Value'][15])) == "<class 'str'>"
Ejemplo n.º 5
0
def señal(indicador, nombre, pais):
    rec = ''
    if indicador == 1:
        data = investpy.technical_indicators(name=nombre,
                                             country=pais,
                                             product_type='stock',
                                             interval='daily')
        if data.loc[0, 'signal'] == 'sell':
            rec = 'vender'
        else:
            rec = 'comprar'
        return nombre, data.loc[0, 'value'], rec

    elif indicador == 2:
        data = investpy.moving_averages(name=nombre,
                                        country=pais,
                                        product_type='stock',
                                        interval='daily')
        if data.loc[0, 'sma_signal'] == 'sell':
            rec = 'vender'
        else:
            rec = 'comprar'
        return nombre, data.loc[0, 'sma_value'], rec

    elif indicador == 3:
        data = investpy.technical_indicators(name=nombre,
                                             country=pais,
                                             product_type='stock',
                                             interval='daily')
        data2 = investpy.moving_averages(name=nombre,
                                         country=pais,
                                         product_type='stock',
                                         interval='daily')
        if data.loc[0, 'signal'] == 'sell':
            rec = 'vender'
        else:
            rec = 'comprar'

        if data2.loc[0, 'sma_signal'] == 'sell':
            rec2 = 'vender'
        else:
            rec2 = 'comprar'

        return nombre, data.loc[0, 'value'], rec, data2.loc[0,
                                                            'sma_value'], rec2