0

I'm running a private Django project, that might be summarized as an html page with a form composed of an input search, and a submit button. I want to be able to write any stock ticker ('AAPL') in the input, and to generate a chart following the request.

However, I made all my tests outside the django framework. Here comes the tricky part. My code related to the data scrapping designed previously, does not work when executed in the Django framework.

from yahoo_finance import Share
def checkview(request):
    yahoo = Share('YHOO')
    stock = yahoo.get_open()
    return HttpResponse(room)

Here is the error code. enter image description here

Also, I tried a different approach with this code:

import yfinance as yf

tsla = yf.Ticker("TSLA")
hist = tsla.history(period='1y')

import plotly.graph_objects as go

fig = go.Figure(data=go.Scatter(x=hist.index,y=hist.Close, mode='lines'))
fig.show()

Can someone explain me, how can I solve the error ? And, how to install properly packages in the Django Framework. As an example, I will want to use Plotly going further in this project.

Thanks !

Marc Kch
  • 71
  • 5
  • plotly isn't needed at the moment. I basically want yfinance to work in my django framework. – Marc Kch Jan 20 '23 at 17:31
  • does this help ? https://stackoverflow.com/questions/32065895/how-to-fix-python-urlopen-error-errno-8-using-eventlet-green – Amin S Jan 20 '23 at 17:51

0 Answers0