コード例 #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'])
コード例 #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'])
コード例 #3
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'>"
コード例 #4
0
def get_technical_indicators(symbol, interval):
    return inp.technical_indicators(
        name=symbol, country='turkey', product_type='stock',
        interval=interval).set_index('technical_indicator').rename(
            columns={
                'value': 'Değer',
                'signal': 'Gösterge'
            })
コード例 #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