1

I tried the following code in ipython3. But I don't see any figure plotted. Could anybody let me know how to make the figure visible? Thanks.

import pandas as pd
apple_df = pd.read_csv('AAPL.csv', index_col=0, parse_dates=True)
dt_range = pd.date_range(start="2021-05-01", end="2020-05-31")
apple_df = apple_df[apple_df.index.isin(dt_range)]
apple_df.head()

import cufflinks as cf
qf=cf.QuantFig(apple_df,title='Apple Quant Figure',legend='top',name='GS')

qf.add_bollinger_bands(periods=20,boll_std=2,colors=['magenta','grey'],fill=True)
qf.add_sma([10,20],width=2,color=['green','lightgreen'],legendgroup=True)
qf.add_rsi(periods=20,color='java')

qf.iplot()

https://coderzcolumn.com/tutorials/data-science/candlestick-chart-in-python-mplfinance-plotly-bokeh

user1424739
  • 11,937
  • 17
  • 63
  • 152
  • I have no experience with cufflinks, but I have tried your code in Collabo. The great [answers](https://stackoverflow.com/questions/52859983/interactive-matplotlib-figures-in-google-colab) here have been a big help. There are two improvements: setting the cufflinks preferences `cf.set_config_file(theme='pearl',sharing='public',offline=True)` and introducing `configure_plotly_browser_state()`. – r-beginners Jun 13 '21 at 04:01
  • I don't know if this is the output you are expecting, so please check [Colab](https://colab.research.google.com/drive/14i5CcGE-5kqSnBctkxHAibXmcuMJkLC9?usp=sharing). Once confirmed, delete this comment. – r-beginners Jun 13 '21 at 04:04
  • I can't run it. I see some errors. `ModuleNotFoundError Traceback (most recent call last) in () ----> 1 import yfinance as yf 2 import pandas as pd 3 4 data = yf.download("AAPL", start="2021-05-01", end="2021-05-31") 5 # df.index = pd.to_datetime(df.index)` – user1424739 Jun 13 '21 at 23:11
  • Do you have Ipython installed? If not, try running the following code. `pip3 install Ipython` – r-beginners Jun 14 '21 at 01:49
  • I have ipython3 installed. – user1424739 Jun 14 '21 at 03:06
  • Does the error still occur? Please share the traceback. – r-beginners Jun 14 '21 at 03:17

0 Answers0