Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

hi this code right here prints this Stock Symbol: IBM Should Buy: True Current Price: 1 4 3 . 0 High Price: 1 4 5

hi this code right here prints this Stock Symbol: IBM
Should Buy: True
Current Price: 143.0
High Price: 145.0
Low Price: 139.5
{'stocksymbol': 'IBM', 'shouldbuy': True, 'price': 143.0,'high': 145.0,'low': 139.5} can you code that flask part and have it print out that in a html flask app as simple as possible and explan here is my code import requests plz do not use chat gpt for the htmp template code it in python
def get_stock_info(stocksymbol):
apikKey ="I2FIH3DMPX4A1GDM"
url =f"https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol={stocksymbol}&apikey={apikKey}"
httpresponse =requests.get(url)
json =httpresponse.json()
stocksymbol =json['Global Quote']['01.symbol']
price =json['Global Quote']['05.price']
previous_close =json['Global Quote']['08.previous close']
high =json['Global Quote']['03.high']
low =json['Global Quote']['04.low']
shouldbuy =price >previous_close
info_dictionary ={
"stocksymbol": stocksymbol,
"shouldbuy": shouldbuy,
"price": price,
"high": high, "low": low,
"previous_close": previous_close
}
return info_dictionary

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions

Question

What research interests does the faculty member have?

Answered: 1 week ago