Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'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'
},
{
'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',
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'
},
{
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',
if labels is not None and isinstance(labels, list) and isinstance(trend_limit, int):
if len(labels) != trend_limit:
raise ValueError('if labels is not None and a `list`, it must have the same length as the trend_limit!')
if labels is not None and not isinstance(labels, list):
raise ValueError('labels is neither None or a `list`!')
if not isinstance(identify, str):
raise ValueError('identify should be a `str` contained in [both, up, down]!')
if isinstance(identify, str) and identify not in ['both', 'up', 'down']:
raise ValueError('identify should be a `str` contained in [both, up, down]!')
try:
df = get_stock_historical_data(stock=stock,
country=country,
from_date=from_date,
to_date=to_date)
except Exception as e:
raise RuntimeError(f'investpy function call failed with Exception: {e}!')
objs = list()
up_trend = {
'name': 'Up Trend',
'element': np.negative(df['Close'])
}
down_trend = {
'name': 'Down Trend',
'element': df['Close']
raise ValueError("to_date should be greater than from_date, both formatted as 'dd/mm/yyyy'.")
if not isinstance(window_size, int):
raise ValueError('window_size must be an `int`')
if isinstance(window_size, int) and window_size < 3:
raise ValueError('window_size must be an `int` equal or higher than 3!')
if not isinstance(identify, str):
raise ValueError('identify should be a `str` contained in [both, up, down]!')
if isinstance(identify, str) and identify not in ['both', 'up', 'down']:
raise ValueError('identify should be a `str` contained in [both, up, down]!')
try:
df = get_stock_historical_data(stock=stock,
country=country,
from_date=from_date,
to_date=to_date)
except Exception as e:
raise RuntimeError(f'investpy function call failed with Exception: {e}!')
objs = list()
up_trend = {
'name': 'Up Trend',
'element': np.negative(df['Close'])
}
down_trend = {
'name': 'Down Trend',
'element': df['Close']