\shares working now and also sensing with daily update. Daily update message prettier

This commit is contained in:
Florian Kellermann
2022-05-10 16:43:17 +02:00
parent 00eeb1c924
commit 7eaddabadc
3 changed files with 32 additions and 13 deletions

View File

@@ -55,13 +55,11 @@ def get_share_price(str_search_for):
except RuntimeError:
return "None"
def get_share_price_no_currency(str_search_for):
"""get stock price per share for company name or isin or symbol no currency
Args:
str_search_for (string): search for this string/isin
Returns: none
"""
try:
@@ -96,7 +94,6 @@ def get_share_price_no_currency(str_search_for):
return str_return
def get_share_information(str_search_for):
search_result = investpy.search_quotes(text=str_search_for, products=['stocks'],
countries=['germany'], n_results=1)
@@ -105,8 +102,19 @@ def get_share_information(str_search_for):
return str_return
def get_share_information_markdown(str_search_for):
search_result = investpy.search_quotes(text=str_search_for, products=['stocks'],
countries=['germany'], n_results=1)
str_return = f'*{search_result.name}*\n_{search_result.symbol}_\nworth: {get_share_price(str_search_for)}'
return str_return
def get_share_information_simple(str_search_for):
search_result = investpy.search_quotes(text=str_search_for, products=['stocks'],
countries=['germany'], n_results=1)
str_return = search_result.name + "\n" +search_result.symbol + "\nworth: " + get_share_price(str_search_for)
return str_return
if __name__ == "__main__":
print(get_share_price("US2515661054"))
print(get_share_price("DE0005557508"))
print(get_share_price_no_currency("US2515661054"))
print(get_share_price_no_currency("DE0005557508"))
print("None")