jackluo / py-quantmod

Powerful financial charting library based on R's Quantmod | http://py-quantmod.readthedocs.io/en/latest/
MIT License
175 stars 55 forks source link

Error encountered trying to plot online with plotly? #6

Closed joshanderson99 closed 6 years ago

joshanderson99 commented 6 years ago

I've run the start_here.ipynb notebook, but in the first example an error is produced, to the effect that it seems to be trying to log in to a plotly account for online display with unrecognised username ''. Error msg below. Any idea why?

Aw, snap! We don't have an account for ''. Want to try again? You can authenticate with your email address or username. Sign in is not case sensitive.

Don't have an account? plot.ly

Questions? support@plot.ly

---------------------------------------------------------------------------
PlotlyError                               Traceback (most recent call last)
<ipython-input-2-fb18fdd6a581> in <module>()
      9 
     10 # Plot
---> 11 ch.iplot()

~/dev/py-quantmod/quantmod/chart.py in iplot(self, type, volume, log, theme, layout, title, subtitle, hovermode, legend, annotations, shapes, dimensions, width, height, margin, filename, online, **kwargs)
   1070                              link_text=link_text)
   1071         else:
-> 1072             return py.iplot(figure, filename=filename)
   1073 
   1074 

...

~/anaconda3/lib/python3.6/site-packages/plotly-2.2.3-py3.6.egg/plotly/tools.py in get_embed(file_owner_or_url, file_id, width, height)
    293                 "'{1}'."
    294                 "\nRun help on this function for more information."
--> 295                 "".format(url, plotly_rest_url))
    296         urlsplit = six.moves.urllib.parse.urlparse(url)
    297         file_owner = urlsplit.path.split('/')[1].split('~')[1]

PlotlyError: Because you didn't supply a 'file_id' in the call, we're assuming you're trying to snag a figure from a url. You supplied the url, '', we expected it to start with 'https://plot.ly'.
Run help on this function for more information.
joshanderson99 commented 6 years ago

Another issue is that the get_symbol function is producing an error, yahoo not returning the requested data.

pandas_datareader._utils.RemoteDataError: Unable to read URL: https://query1.finance.yahoo.com/v7/finance/download/QQQ?period1=1451566800&period2=1516798799&interval=1d&events=history&crumb=dncO2%5Cu002F2yRne

jackluo commented 6 years ago

@joshanderson99 you need to create a plotly accuont as detailed here https://plot.ly/python/getting-started/

for yahoo, the API has been retired - i'm currently looking to get alphavantage data in it instead