Skip to content

Finance

_get_percentage_change(change)

Returns a formatted percentage change string.

Parameters:

Name Type Description Default
change str

The percentage change as a string.

required

Returns:

Type Description
str

The formatted percentage change string.

get_currency_by_country(country)

Returns the currency and the currency symbol for a given country.

Parameters:

Name Type Description Default
country str

The country for which the currency should be returned.

required

Returns:

Type Description
Tuple[str, str]

A tuple containing the currency and the currency symbol.

get_news_info_by_symbol(symbol)

Returns the latest news for a given symbol.

Parameters:

Name Type Description Default
symbol str

The symbol for which the latest news should be returned.

required

Returns:

Type Description
list[list[dict[str, str]]] | None

The three most relevant news in the last 24h for the given symbol.

get_stock_price(symbol, currency='USD')

Returns the current stock price for a given symbol.

Parameters:

Name Type Description Default
symbol str

The symbol for which the stock price should be returned.

required
currency str, optional

The currency in which the stock price should be returned. By default USD.

'USD'

Returns:

Type Description
float | None

The current stock price for the given symbol.

get_stock_price_change(symbol)

Returns the current stock price change for a given symbol.

Parameters:

Name Type Description Default
symbol str

The symbol for which the stock price change should be returned.

required

Returns:

Type Description
dict[str, str] | None

The current stock price change (per day and per 5 days) for the given symbol.

get_stock_rating(symbol)

Returns the current stock rating for a given symbol.

Parameters:

Name Type Description Default
symbol str

The symbol for which the stock rating should be returned.

required

Returns:

Type Description
str | None

The current stock rating for the given symbol.

get_ticker_by_symbol(ticker_list, symbol)

Returns the ticker data for a given symbol.

Parameters:

Name Type Description Default
ticker_list list[dict[str, str]]

The list of ticker data from a news source.

required
symbol str

The symbol for which the ticker data should be returned.

required

Returns:

Type Description
dict[str, str]

The ticker data for the given symbol.