TelegramAktienBot/telegram_bot/shares/share_fetcher.py
2022-04-26 12:49:19 +02:00

26 lines
690 B
Python

"""
script for share fetching (by symbols (e.g. AAPL, TSLA etc.))
"""
__author__ = "Florian Kellermann, Linus Eickhoff"
__date__ = "15.03.2022"
__version__ = "0.0.2"
__license__ = "None"
import yfinance
def get_share_price(str_symbol):
""" get current share price for a certain symbol
:type str_symbol: string
:param str_symbol: share symbol to get price for
:raises:
:rtype:
"""
my_share_info = yfinance.Ticker(str_symbol)
my_share_data = my_share_info.info
#my_return_string = f'{my_share_data["regularMarketPrice"]} {my_share_data["currency"]}'
my_return_string = f'{my_share_data["regularMarketPrice"]}'
return my_return_string