managed git conflicts

This commit is contained in:
Linus E
2022-05-12 08:37:53 +02:00
96 changed files with 18423 additions and 12223 deletions

View File

@@ -3,13 +3,14 @@ script for share fetching (by symbols (e.g. AAPL, TSLA etc.))
"""
__author__ = "Florian Kellermann, Linus Eickhoff"
__date__ = "10.05.2022"
__version__ = "1.0.1"
__version__ = "1.0.1"
__license__ = "None"
import helper_functions as hf
import investpy
import pandas
from currency_converter import CurrencyConverter
import helper_functions as hf
def get_share_price(str_search_for):
"""get stock price per share for company name or isin or symbol
@@ -40,25 +41,26 @@ def get_share_price(str_search_for):
my_Converter = CurrencyConverter() # need a currency converter
search_result = investpy.search_quotes(text=str_search_for, products=['stocks'], n_results=1)
currency = str(search_result.retrieve_currency())
recent_data = pandas.DataFrame(search_result.retrieve_recent_data())
stock_price = recent_data.iloc[-1]["Close"]
#convert stock price from currency to EUR
stock_price = my_Converter.convert(float(stock_price), str(currency), 'EUR')
stock_price = round(float(stock_price), 2)
str_return =str(stock_price) + " EUR"
str_return = str(stock_price) + " EUR"
return str_return
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:
@@ -67,44 +69,45 @@ def get_share_price_no_currency(str_search_for):
"""
try:
search_result = investpy.search_quotes(text=str_search_for, products=['stocks'],
countries=['germany'], n_results=1)
countries=['germany'], n_results=1)
recent_data = pandas.DataFrame(search_result.retrieve_recent_data())
stock_price = recent_data.iloc[-1]["Close"]
stock_price = round(float(stock_price), 2)
return stock_price
except RuntimeError:
my_Converter = CurrencyConverter()
search_result = investpy.search_quotes(text=str_search_for, products=['stocks'], n_results=1)
currency = str(search_result.retrieve_currency())
recent_data = pandas.DataFrame(search_result.retrieve_recent_data())
stock_price = recent_data.iloc[-1]["Close"]
stock_price = my_Converter.convert(float(stock_price), str(currency), 'EUR')
stock_price = round(float(stock_price), 2)
str_return =str(stock_price)
str_return = str(stock_price)
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)
countries=['germany'], n_results=1)
str_return = "Company: " + search_result.name + "\nSymbol: " + search_result.symbol + "\nCurrent Price/Share: " + get_share_price(str_search_for)
return str_return
def get_share_information_markdown(str_search_for):
try:
@@ -120,12 +123,14 @@ def get_share_information_markdown(str_search_for):
str_return = f'*{hf.make_markdown_proof(search_result.name)}*\n_{hf.make_markdown_proof(search_result.symbol)}_\nworth: {hf.make_markdown_proof(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)
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("None")
print("None")

View File

@@ -1,16 +1,16 @@
{
"user": "FloKell",
"share_count": 2,
"shares": [
{
"symbol": "APC.DE",
"price_bought": "50.06",
"amount_bought": "5.1"
},
{
"symbol": "TL0.DE",
"price_bought": "450.06",
"amount_bought": "5.13"
}
]
"user": "FloKell",
"share_count": 2,
"shares": [
{
"symbol": "APC.DE",
"price_bought": "50.06",
"amount_bought": "5.1"
},
{
"symbol": "TL0.DE",
"price_bought": "450.06",
"amount_bought": "5.13"
}
]
}