How to do it...

Execute the following steps to create an interactive dashboard inside Jupyter Notebook.

  1. Import the libraries:
import ipywidgets as wdimport cufflinks as cfimport pandas as pd import yfinance as yffrom plotly.offline import iplot, init_notebook_modefrom ipywidgets import interact, interact_manualinit_notebook_mode()
  1. Define the possible values for assets and technical indicators:
stocks = ['TWTR', 'MSFT', 'GOOGL', 'FB', 'TSLA', 'AAPL']indicators = ['Bollinger Bands', 'MACD', 'RSI']
  1. Define a function for creating the interactive plot:
def ta_dashboard(asset, indicator, start_date, end_date,                  bb_k, bb_n, macd_fast, macd_slow, macd_signal,                 rsi_periods, rsi_upper, rsi_lower):            df = yf.download(asset,                      start=start_date, 

Get Python for Finance Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.