Merge remote-tracking branch 'origin/main' into bot
This commit is contained in:
commit
79870ecb1c
@ -9,19 +9,42 @@ import os
|
|||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import investpy
|
||||||
|
import pandas
|
||||||
import requests
|
import requests
|
||||||
import yfinance
|
from currency_converter import CurrencyConverter
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
|
||||||
def thread_function(s):
|
def thread_function(s):
|
||||||
my_share_info = yfinance.Ticker(s)
|
try:
|
||||||
my_share_data = my_share_info.info
|
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 = {
|
payload = {
|
||||||
"symbol": s,
|
"isin": s,
|
||||||
"price": float(my_share_data['regularMarketPrice']),
|
"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")
|
"time": datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.000Z")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,5 +12,7 @@ pytest~=7.1.2
|
|||||||
pytest-cov
|
pytest-cov
|
||||||
marshmallow~=3.15.0
|
marshmallow~=3.15.0
|
||||||
faker~=13.7.0
|
faker~=13.7.0
|
||||||
yfinance~=0.1.70
|
requests~=2.27.1
|
||||||
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": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build",
|
"build": "ng build --prod --build-optimizer",
|
||||||
"watch": "ng build --watch --configuration development",
|
"watch": "ng build --watch --configuration development",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"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