mirror of
https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot.git
synced 2025-06-16 23:16:48 +00:00
making linter happy
This commit is contained in:
parent
c7634967f6
commit
53d655fa48
10
functions.py
10
functions.py
@ -5,7 +5,6 @@ from datetime import datetime
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
IEX_TOKEN = os.environ["IEX"]
|
|
||||||
|
|
||||||
|
|
||||||
def getSymbols(text: str):
|
def getSymbols(text: str):
|
||||||
@ -29,7 +28,7 @@ def symbolDataReply(symbols: list):
|
|||||||
)
|
)
|
||||||
|
|
||||||
response = requests.get(IEXurl)
|
response = requests.get(IEXurl)
|
||||||
if response.status_code is 200:
|
if response.status_code == 200:
|
||||||
IEXData = response.json()
|
IEXData = response.json()
|
||||||
message = f"The current stock price of {IEXData['companyName']} is $**{IEXData['latestPrice']}**"
|
message = f"The current stock price of {IEXData['companyName']} is $**{IEXData['latestPrice']}**"
|
||||||
|
|
||||||
@ -55,7 +54,7 @@ def symbolDividend(symbols: list):
|
|||||||
for symbol in symbols:
|
for symbol in symbols:
|
||||||
IEXurl = f"https://cloud.iexapis.com/stable/data-points/{symbol}/NEXTDIVIDENDDATE?token={IEX_TOKEN}"
|
IEXurl = f"https://cloud.iexapis.com/stable/data-points/{symbol}/NEXTDIVIDENDDATE?token={IEX_TOKEN}"
|
||||||
response = requests.get(IEXurl)
|
response = requests.get(IEXurl)
|
||||||
if response.status_code is 200:
|
if response.status_code == 200:
|
||||||
|
|
||||||
# extract date from json
|
# extract date from json
|
||||||
date = response.json()
|
date = response.json()
|
||||||
@ -88,7 +87,7 @@ def symbolNews(symbols: list):
|
|||||||
for symbol in symbols:
|
for symbol in symbols:
|
||||||
IEXurl = f"https://cloud.iexapis.com/stable/stock/{symbol}/news/last/3?token={IEX_TOKEN}"
|
IEXurl = f"https://cloud.iexapis.com/stable/stock/{symbol}/news/last/3?token={IEX_TOKEN}"
|
||||||
response = requests.get(IEXurl)
|
response = requests.get(IEXurl)
|
||||||
if response.status_code is 200:
|
if response.status_code == 200:
|
||||||
data = response.json()
|
data = response.json()
|
||||||
newsMessages[symbol] = f"News for **{symbol.upper()}**:\n"
|
newsMessages[symbol] = f"News for **{symbol.upper()}**:\n"
|
||||||
for news in data:
|
for news in data:
|
||||||
@ -111,7 +110,7 @@ def symbolInfo(symbols: list):
|
|||||||
)
|
)
|
||||||
response = requests.get(IEXurl)
|
response = requests.get(IEXurl)
|
||||||
|
|
||||||
if response.status_code is 200:
|
if response.status_code == 200:
|
||||||
data = response.json()
|
data = response.json()
|
||||||
infoMessages[
|
infoMessages[
|
||||||
symbol
|
symbol
|
||||||
@ -123,4 +122,3 @@ def symbolInfo(symbols: list):
|
|||||||
] = f"No information found for: {symbol}\nEither today is boring or the symbol does not exist."
|
] = f"No information found for: {symbol}\nEither today is boring or the symbol does not exist."
|
||||||
|
|
||||||
return infoMessages
|
return infoMessages
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user