Merge remote-tracking branch 'origin/main' into bot
This commit is contained in:
commit
79870ecb1c
@ -9,19 +9,42 @@ import os
|
||||
import threading
|
||||
import time
|
||||
|
||||
import investpy
|
||||
import pandas
|
||||
import requests
|
||||
import yfinance
|
||||
from currency_converter import CurrencyConverter
|
||||
from dotenv import load_dotenv
|
||||
|
||||
|
||||
def thread_function(s):
|
||||
my_share_info = yfinance.Ticker(s)
|
||||
my_share_data = my_share_info.info
|
||||
try:
|
||||
search_result = investpy.search_quotes(text=s, products=['stocks'], countries=['germany'], n_results=1)
|
||||
|
||||
recent_data = pandas.DataFrame(search_result.retrieve_recent_data())
|
||||
|
||||
stock_price = round(float(recent_data.iloc[-1]["Close"]), 2)
|
||||
|
||||
if my_share_data['regularMarketPrice'] is not None:
|
||||
payload = {
|
||||
"symbol": s,
|
||||
"price": float(my_share_data['regularMarketPrice']),
|
||||
"isin": s,
|
||||
"price": round(float(stock_price), 2),
|
||||
"time": datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.000Z")
|
||||
}
|
||||
|
||||
requests.post(os.getenv("API_URL") + '/symbol', json=payload, headers={'Authorization': 'Bearer ' + token})
|
||||
except RuntimeError:
|
||||
my_converter = CurrencyConverter()
|
||||
|
||||
search_result = investpy.search_quotes(text=s, products=['stocks'], n_results=1)
|
||||
|
||||
currency = str(search_result.retrieve_currency())
|
||||
|
||||
recent_data = pandas.DataFrame(search_result.retrieve_recent_data())
|
||||
|
||||
stock_price = my_converter.convert(float(recent_data.iloc[-1]["Close"]), str(currency), 'EUR')
|
||||
|
||||
payload = {
|
||||
"isin": s,
|
||||
"price": round(float(stock_price), 2),
|
||||
"time": datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.000Z")
|
||||
}
|
||||
|
||||
|
@ -12,5 +12,7 @@ pytest~=7.1.2
|
||||
pytest-cov
|
||||
marshmallow~=3.15.0
|
||||
faker~=13.7.0
|
||||
yfinance~=0.1.70
|
||||
requests~=2.27.1
|
||||
investpy~=1.0.8
|
||||
pandas~=1.4.1
|
||||
currencyconverter~=0.16.12
|
Binary file not shown.
BIN
documentation/Kurzdokumentation.pdf
Normal file
BIN
documentation/Kurzdokumentation.pdf
Normal file
Binary file not shown.
@ -4,7 +4,7 @@
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
"build": "ng build --prod --build-optimizer",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 33 KiB |
Loading…
Reference in New Issue
Block a user