Exercise

Tech stock performance over time

The hedge fund would like to analyze trends in tech stocks over the past few years. They have asked for a line plot displaying stock prices for Apple, IBM, and Netflix.

They would also like a DateRangeSlider so they can adjust the period they are viewing, making it easier to spot periods of interest.

A figure has been created, with line glyphs added. Additionally, earliest_date and lowest_date have been preloaded as the oldest and newest dates in the stocks["date"] column.

Instructions

100 XP
  • Import DateRangeSlider.
  • Call DateRangeSlider(), assigning "Date" to the title, earliest_date and latest_date to start and end, setting value equal to "2014, 6, 2", "2018, 2, 7", and including an increment of 1 day per interaction with the widget.
  • Call .js_link() twice, linking the widget's "value" to the "Start" and "End" of fig's x_range and setting the attribute selector to 0 and 1 in each call respectively.
  • Call layout() to display the slider above the fig.