Inspiration 💡
I need to use the stock tracker to track stock price but I usually miss the notice on my phone and I like it more if it can notice me on the discord so try to make one
What it does 🗿
the idea is to track the stocks that the user ordered it to everyday it's for you to not miss the opportunities to buy it! that's the opportunity cost!! 💰💰💰
Challenges we ran into 😨
as I'm trying to make an auto stocks price tracker so I would need it to run every n sec/min/day basically, Schedule a Python Code to Run turned out it's harder than I think python worked synchronously and I'm trying to loop running function while running bot???!!! I would've needed to make it async!!!! 😱 I stuck so long on the thinking and searching how to pull it off I'm almost giving up on it... 😥 but I decided that I need to finish some core function even if I can't finish the scheduled running in these hacks I can finish that part later!!!😤
Accomplishments that we're proud of
I can finish the core function even in this despair situation when i use wrong tech for the job
How we built it
use yahoo finance API for getting stock data
def today_price(stock):
thisday = date.today()
data = yf.download(stock, start=thisday, end=thisday)
return data
then next cord to handle discord API and then next job is to design the prefix that's easiest to use
$track quote > or < price
Ex. $track googl > 100
because of this style of prefix so I need to find ways to get the input from the whole strings so I decided to split them up
msg = message.content.split(' ')
now I've got stock_quote condition and target_price!!! and then I use it as input for comparing function
def check_price(stocks,condition,target_price):
if condition == '>':
higher = True
elif condition == '<':
higher = False
else:
return 'Please enter the condition as > or <'
result = []
for stock in stocks:
if price_checker(target_price,stock,higher)[0]:
result.append(price_checker(target_price,stock,higher))
if result[0][0]:
return f'now reaching! {result[0][1]} price {condition} {target_price} '
else:
return
What we learned
should've written the workflow first!!!!📋 then i would've use node for the job
What's next for Stock_Tracker
NEEDED to finish the scheduled running function asap!!!
Built With
- nextcord
- python
- yfinance
Log in or sign up for Devpost to join the conversation.