{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "parameters" ] }, "outputs": [], "source": [ "title = \"Stock Time Series\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "meta" ] }, "outputs": [], "source": [ "import datetime\n", "\n", "import numpy as np\n", "import pandas as pd\n", "import pandas_datareader.data as web\n", "\n", "import plotly.graph_objects as go" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "start = datetime.datetime(2015, 1, 1)\n", "end = datetime.datetime(2019, 12, 1)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "df_1 = web.DataReader(\"AAPL\", \"yahoo\", start, end).reset_index()\n", "df_2 = web.DataReader(\"MSFT\", \"yahoo\", start, end).reset_index()\n", "df_3 = web.DataReader(\"AMZN\", \"yahoo\", start, end).reset_index()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Apple" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "margin = go.layout.Margin(l=20, r=20, b=20, t=30)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "chart" ] }, "outputs": [], "source": [ "fig = go.Figure([go.Scatter(x=df_1['Date'], y=df_1['Close'])])\n", "fig.update_layout(margin=margin)\n", "fig" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Microsoft" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "chart" ] }, "outputs": [], "source": [ "fig = go.Figure([go.Scatter(x=df_2['Date'], y=df_2['Close'])])\n", "fig.update_layout(margin=margin)\n", "fig" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Amazon" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "chart" ] }, "outputs": [], "source": [ "fig = go.Figure([go.Scatter(x=df_3['Date'], y=df_3['Close'])])\n", "fig.update_layout(margin=margin)\n", "fig" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "celltoolbar": "Tags", "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.0" } }, "nbformat": 4, "nbformat_minor": 4 }