Merge branch 'bot-features' of https://github.com/WebEngineering2/TelegramAktienBot into bot-features
This commit is contained in:
commit
51e3b89cda
BIN
project_requirements/2022-03-15 Anforderungen an Projekt.pdf
Normal file
BIN
project_requirements/2022-03-15 Anforderungen an Projekt.pdf
Normal file
Binary file not shown.
5
telegram_bot/requirements.txt
Normal file
5
telegram_bot/requirements.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
pyTelegramBotAPI~=4.4.0
|
||||||
|
beautifulsoup4==4.10.0
|
||||||
|
Markdown==3.3.6
|
||||||
|
Pillow==9.0.1
|
||||||
|
yfinance==0.1.70
|
@ -3,5 +3,52 @@ script for share fetching (by symbols (e.g. AAPL, TSLA etc.))
|
|||||||
"""
|
"""
|
||||||
__author__ = "Florian Kellermann, Linus Eickhoff"
|
__author__ = "Florian Kellermann, Linus Eickhoff"
|
||||||
__date__ = "15.03.2022"
|
__date__ = "15.03.2022"
|
||||||
__version__ = "0.0.1"
|
__version__ = "0.0.2"
|
||||||
__license__ = "None"
|
__license__ = "None"
|
||||||
|
|
||||||
|
import yfinance
|
||||||
|
|
||||||
|
class Share_Handler:
|
||||||
|
def __init__(self):
|
||||||
|
return
|
||||||
|
|
||||||
|
def all_share_prices_for_user(self, int_user_id):
|
||||||
|
|
||||||
|
""" Get all share prices for a certain user with his id
|
||||||
|
:type int_user_id: integer
|
||||||
|
:param int_user_id: user_id to get all share prices for
|
||||||
|
|
||||||
|
:raises: none
|
||||||
|
|
||||||
|
:rtype: ###tbd### (maybe dictonary)
|
||||||
|
"""
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def get_share_price(self, 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"]}'
|
||||||
|
return my_return_string
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
""" test object and get share price
|
||||||
|
:raises: none
|
||||||
|
|
||||||
|
:rtype: none
|
||||||
|
"""
|
||||||
|
|
||||||
|
new_handler = Share_Handler()
|
||||||
|
print(new_handler.get_share_price("TSLA"))
|
Loading…
Reference in New Issue
Block a user