{"id":46624,"date":"2020-12-16T00:00:00","date_gmt":"2020-12-16T08:00:00","guid":{"rendered":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/"},"modified":"2025-11-13T12:55:06","modified_gmt":"2025-11-13T20:55:06","slug":"stock-market-analysis-with-python-pandas-plotly-and-griddb","status":"publish","type":"post","link":"https:\/\/www.griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/","title":{"rendered":"Stock Market Analysis with Python Pandas, Plotly and GridDB"},"content":{"rendered":"<h2> Introduction <\/h2>\n<p>Stock markets are fickle and often changing. Humans have tried to tame the bull throughout history but have never been successful. Stock market prediction is difficult because there are too many factors at play, and creating models to consider such variances is almost impossible. However, recent advances in machine learning and computing have allowed machines to process large amounts of data. This will enable us to use past stock exchange data and analyze trends. This post will leverage python and GridDB to analyze stock data for Google for the past year.<\/p>\n<p>Stock prices are stored daily. Thus, daily stock data can grow very large. We will use GridDB as the database to store our data as it has been known to handle large datasets well. GridDB ensures high performance while being scalable and reliable at the same time. GridDB is easy to use and works with most modern programming languages. In this post, we will run some fundamental stock price analysis using python and visualize our results.<\/p>\n<p><a href=\"#source-code\"> FULL SOURCE CODE <\/a><\/p>\n<h2 id=\"setup\">Setup<\/h2>\n<h3 id=\"griddb-setup\">GridDB setup<\/h3>\n<p>Setup for the GridDB python client can be found in this <a\n    href=\"https:\/\/www.youtube.com\/watch?v=yWCVfLoV9_0&amp;t=61s\">video<\/a>. Before we begin, we should have the following endpoints correctly defined.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"lang-bash\">export LIBRARY_PATH=<span class=\"hljs-variable\">$LIBRARY_PATH<\/span><span class=\"hljs-symbol\">:\/usr\/share\/doc\/griddb-c-client<\/span> [insert path to c_client]\nexport PYTHONPATH=<span class=\"hljs-variable\">$PYTHONPATH<\/span><span class=\"hljs-symbol\">:<\/span>[insert path to python_client]\nexport LIBRARY_PATH=<span class=\"hljs-variable\">$LD_LIBRARY_PATH<\/span><span class=\"hljs-symbol\">:<\/span>[insert path to c_client\/bin]\n<\/code><\/pre>\n<\/div>\n<h4 id=\"python-libraries\">Python Libraries<\/h4>\n<p>We will use <code>python 3.6<\/code> for this analysis. To install libraries we will use <code>pip<\/code>.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"lang-bash\">pip <span class=\"hljs-keyword\">install<\/span> pandas\npip <span class=\"hljs-keyword\">install<\/span> plotly\n<\/code><\/pre>\n<\/div>\n<h3 id=\"data-collection\">Data Collection<\/h3>\n<p>GridDB provides an excellent interface to access data. The GridDB python client blog goes into great detail on linking a GridDB database and pushing all the data to a pandas data frame. We will use yahoo finance to get data for Google stock. The data can be found at : <a href=\"https:\/\/finance.yahoo.com\/quote\/GOOG\">Yahoo! Finance<\/a> We save the data for one year at <code>GOOG.csv<\/code>.<\/p>\n<p>We can insert and retrive this data into GridDB with SQL queries. <\/p>\n<p>To insert:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"lang-python\"><span class=\"hljs-built_in\">import<\/span> griddb_python as griddb\n<span class=\"hljs-built_in\">import<\/span> pandas as pd\n\n<span class=\"hljs-comment\"># Initialize container<\/span>\n<span class=\"hljs-attr\">gridstore<\/span> = factory.get_store(<span class=\"hljs-attr\">host=<\/span> host, <span class=\"hljs-attr\">port=port,<\/span> \n            <span class=\"hljs-attr\">cluster_name=cluster_name,<\/span> <span class=\"hljs-attr\">username=uname,<\/span> \n            <span class=\"hljs-attr\">password=pwd)<\/span>\n\n<span class=\"hljs-attr\">conInfo<\/span> = griddb.ContainerInfo(<span class=\"hljs-string\">\"GOOGL\"<\/span>,\n                    [[<span class=\"hljs-string\">\"Date\"<\/span>, griddb.Type.TIMESTAMP],\n                    [<span class=\"hljs-string\">\"Open\"<\/span>,griddb.Type.LONG],\n                    [<span class=\"hljs-string\">\"High\"<\/span>, griddb.Type.LONG],\n                    [<span class=\"hljs-string\">\"Low\"<\/span>,griddb.Type.LONG]\n                    [<span class=\"hljs-string\">\"Close\"<\/span>, griddb.Type.LONG]\n                    [<span class=\"hljs-string\">\"Adj. Close\"<\/span>, griddb.Type.LONG]\n                    [<span class=\"hljs-string\">\"Volume\"<\/span>, griddb.Type.LONG]],\n                    griddb.ContainerType.COLLECTION, True)\n\n<span class=\"hljs-attr\">cont<\/span> = gridstore.put_container(conInfo)    \ncont.create_index(<span class=\"hljs-string\">\"Date\"<\/span>, griddb.IndexType.DEFAULT)\n<span class=\"hljs-attr\">data<\/span> = pd.read.csv(<span class=\"hljs-string\">\"GOOG.csv\"<\/span>)\n<span class=\"hljs-comment\">#Add data<\/span>\nfor i <span class=\"hljs-keyword\">in<\/span> range(len(data)):\n    <span class=\"hljs-attr\">ret<\/span> = cont.put(data.iloc[i, :])\n<\/code><\/pre>\n<p>Note that this process can be automa,ted to query regualrly from Yahoo! Finacne as well.<br \/>\nWe can retrive data from GridDB using the following SQL query:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"lang-python\">query = cont.query(\"<span class=\"hljs-keyword\">select<\/span> * <span class=\"hljs-keyword\">where<\/span> <span class=\"hljs-built_in\">Date<\/span> &gt; <span class=\"hljs-keyword\">TIMESTAMPADD<\/span>(<span class=\"hljs-keyword\">YEAR<\/span>, <span class=\"hljs-keyword\">NOW<\/span>(), <span class=\"hljs-number\">-1<\/span>)<span class=\"hljs-string\">\")<\/span>\n<\/code><\/pre>\n<\/div>\n<h3 id=\"data-analysis\">Data Analysis<\/h3>\n<p>We can load the data using <code>pandas<\/code><\/p>\n<div class=\"clipboard\">\n<pre><code class=\"lang-python\"><span class=\"hljs-keyword\">Import<\/span> pandas <span class=\"hljs-built_in\">as<\/span> pd\ngoogf = pd.read_csv(<span class=\"hljs-string\">\"GOOG.csv\"<\/span>)\n<\/code><\/pre>\n<\/div>\n<p>This is what stock data looks like:<br \/>\n<img decoding=\"async\"\n    src=\"https:\/\/lh6.googleusercontent.com\/ry_RpBcfT4zZt285ZDIWRjv3GTgaYvyiv73DFAwERC57vmiCCsYpdQ4TlDfM78ZiUUlW_iG2DtLxm_-GfRohODMF2o2r4JhccFUvuTHJP0O33lmz_A4eK4v__7-lgmYqOz71mu3t\"\n    alt=\"\"><br \/>\nThe columns are interpreted as:<\/p>\n<ul>\n<li><strong>Date<\/strong>: The date of the trading day.<\/li>\n<li><strong>Open<\/strong>: The first trade price on Date.<\/li>\n<li><strong>High<\/strong>: The highest price at which the stock is traded on Date.<\/li>\n<li><strong>Low<\/strong>: The lowest price at which the stock is traded on Date.<\/li>\n<li><strong>Close<\/strong>: The last trade price on Date<\/li>\n<li><strong>Adj Close<\/strong>: This is defined as the closing price after all dividends are split.<\/li>\n<li><strong>Volume<\/strong>: The number of shares traded on Date.<\/li>\n<\/ul>\n<p>First, we visualize that data on line plots. We use the plot functionality in pandas to plot the close price and the traded volume.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"lang-python\">googf<span class=\"hljs-string\">[[\"Close\"]]<\/span>.plot()\n<\/code><\/pre>\n<\/div>\n<p><img decoding=\"async\"\n    src=\"https:\/\/lh4.googleusercontent.com\/Uqq05hqweUJC9c0IV_qVheMHZiwDmONtgKNlBhxpll5SroxizEyggQUQYpz4OIp6S03E1Rj7JX7tc8j6MNHhLoGx_sdoBOJRyj0UUUhKLihALGyVpl-LvSe47y3qUNlbcd26lII9\"\n    alt=\"\"><\/p>\n<div class=\"clipboard\">\n<pre><code class=\"lang-python\">googf<span class=\"hljs-string\">[[\"Volume\"]]<\/span>.plot()\n<\/code><\/pre>\n<\/div>\n<p><img decoding=\"async\"\n    src=\"https:\/\/lh5.googleusercontent.com\/NpBFjoKzMIOfvL6rQnLkGWC1g34xqumQoLx4IeqSX7nVZ9IRuwZifCTrFc2mBskMW0GCKVmE9k80p41VSFzPfMZaw29UEEcz6Am1U8y9eHN2g2RQKgPrz4nCRoRqe7CUY6YHs329\"\n    alt=\"\"><br \/>\nWe see that volume traded and closing price have an inverse relationship. This relationship is a common practice in finance. If the closing price of a stock decreases, people are more likely to trade a particular stock. However, we see that the data is very spiky. This spikiness is because there are subtle market forces that guide the price fluctuations.<\/p>\n<p>Next, we can use an OHLC chart to visualize the data. The OLHC (open, high, low and close) chart is a financial chart describing open, high, low and close values for a given date.<\/p>\n<p>The horizontal segments represent open and close values, and the tip of the lines represents the low and high values. Points, where the close value is higher than open are called increasing (in green) and decreasing close value is lower than open( in red).<\/p>\n<p>We will use plotly to plot this.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"lang-python\"><span class=\"hljs-keyword\">import<\/span> plotly.graph_objects <span class=\"hljs-keyword\">as<\/span> go\n\n<span class=\"hljs-title\">fig<\/span> = go.<span class=\"hljs-type\">Figure<\/span>(<span class=\"hljs-class\"><span class=\"hljs-keyword\">data<\/span>=go.<span class=\"hljs-type\">Ohlc<\/span>(<span class=\"hljs-title\">x<\/span>=<span class=\"hljs-title\">googf<\/span>['<span class=\"hljs-type\">Date<\/span>'],\n        <span class=\"hljs-title\">open<\/span>=<span class=\"hljs-title\">googf<\/span>['<span class=\"hljs-type\">Open<\/span>'],\n        <span class=\"hljs-title\">high<\/span>=<span class=\"hljs-title\">googf<\/span>['<span class=\"hljs-type\">High<\/span>'],\n        <span class=\"hljs-title\">low<\/span>=<span class=\"hljs-title\">googf<\/span>['<span class=\"hljs-type\">Low<\/span>'],\n        <span class=\"hljs-title\">close<\/span>=<span class=\"hljs-title\">googf<\/span>['<span class=\"hljs-type\">Close<\/span>']))<\/span>\n<span class=\"hljs-title\">fig<\/span>.show()\n<\/code><\/pre>\n<\/div>\n<p><img decoding=\"async\"\n    src=\"https:\/\/lh6.googleusercontent.com\/DgPKLbnGyqEa9yz1Un3CTmlyD5-YC8TB5xr7HiFmUWSVD8TVp5D9L8EupP8ZeqdISkPhtAm0vQLqHwUDmFCdQz6KMRoWpC4ikIS8hJRPRsK8_eHj_1UILe-R0nLwOTY_6qUcYmug\"\n    alt=\"\"><br \/>\nWe see that there was a dip in google stock in March. Moreover, the red lines are more prominent in the earlier half of the year than the latter. This could be due to multiple factors like the COVID epidemic, for instance. In a later post, we will try to analyze stock trends with Covid spread data.<\/p>\n<p>Next, we use the range slider to zoom in in March.<br \/>\n<img decoding=\"async\"\n    src=\"https:\/\/lh6.googleusercontent.com\/jjvucGN3FI89xe25XStEEchCqa8HO3AFu1_ro6JpqeNRShnlsyIXvEBrMIstRuOyz05r4R6KjdjDMdyCgsz2eh90ugH_vde3sOoUixozUq4FgESlRDQoq2nvAPUszwszQsmS2btK\"\n    alt=\"\"><\/p>\n<p>We see that the vertical bars are longer, indicating a massive difference between opening and closing. This shows that there was large volatility in the market at the time.<\/p>\n<p>These charts are much more intuitive than regular line plots.<\/p>\n<h3 id=\"market-trends-analysis\">Market Trends Analysis<\/h3>\n<h4 id=\"moving-averages\">Moving averages<\/h4>\n<p>Next, we compute moving averages. The moving average of a stock is creating a continually updated average price. Moving averages are used to confirm trend changes and are not used for future prediction.<\/p>\n<p>We can calculate moving averages for short, intermediate, and longer terms to analyze market trends.<\/p>\n<ul>\n<li><strong>Short-term<\/strong>: The time frames are between 5\u00e2\u20ac\u201c20 days and are used to identify trends that can last<br \/>\n    a few days to a few weeks.<\/li>\n<li><strong>Intermediate<\/strong>: The time frames are between 20\u00e2\u20ac\u201c65 days and are used to identify trends that can<br \/>\n    last a few months.<\/li>\n<li><strong>Long<\/strong>: The time frames are between 65\u00e2\u20ac\u201c200 days and are used to identify trends that can last<br \/>\n    years.<\/li>\n<\/ul>\n<p>As we have only one year of data, we will look at short trends. We will calculate moving averages for 5, 20 and 50 days and use them to analyze trends.<\/p>\n<p>To calculate the moving average in python, we use the rolling function.<\/p>\n<h5 id=\"simple-moving-average\">Simple Moving Average<\/h5>\n<p>A simple moving average of N days can be defined as the mean of the closing price for N days. We shift the period by one day and keep calculating his average for every N range. Here is the code:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"lang-python\">googf[<span class=\"hljs-string\">'SMA5'<\/span>] = googf<span class=\"hljs-selector-class\">.Close<\/span><span class=\"hljs-selector-class\">.rolling<\/span>(<span class=\"hljs-number\">5<\/span>).mean()\ngoogf[<span class=\"hljs-string\">'SMA20'<\/span>] = googf<span class=\"hljs-selector-class\">.Close<\/span><span class=\"hljs-selector-class\">.rolling<\/span>(<span class=\"hljs-number\">20<\/span>).mean()\ngoogf[<span class=\"hljs-string\">'SMA50'<\/span>] = googf<span class=\"hljs-selector-class\">.Close<\/span><span class=\"hljs-selector-class\">.rolling<\/span>(<span class=\"hljs-number\">50<\/span>).mean()\n\nfig = go.Figure(data=[go.Ohlc(x=googf[<span class=\"hljs-string\">'Date'<\/span>],\n            open=googf[<span class=\"hljs-string\">'Open'<\/span>],\n            high=googf[<span class=\"hljs-string\">'High'<\/span>],\n            low=googf[<span class=\"hljs-string\">'Low'<\/span>],\n            close=googf[<span class=\"hljs-string\">'Close'<\/span>], name = <span class=\"hljs-string\">\"OHLC\"<\/span>),\n            go.Scatter(x=googf<span class=\"hljs-selector-class\">.Date<\/span>, y=googf<span class=\"hljs-selector-class\">.SMA5<\/span>, line=dict(<span class=\"hljs-attribute\">color<\/span>=<span class=\"hljs-string\">'orange'<\/span>, width=<span class=\"hljs-number\">1<\/span>), name=<span class=\"hljs-string\">\"SMA5\"<\/span>),\n            go.Scatter(x=googf<span class=\"hljs-selector-class\">.Date<\/span>, y=googf<span class=\"hljs-selector-class\">.SMA20<\/span>, line=dict(<span class=\"hljs-attribute\">color<\/span>=<span class=\"hljs-string\">'green'<\/span>, width=<span class=\"hljs-number\">1<\/span>), name=<span class=\"hljs-string\">\"SMA20\"<\/span>),\n            go.Scatter(x=googf<span class=\"hljs-selector-class\">.Date<\/span>, y=googf<span class=\"hljs-selector-class\">.SMA50<\/span>, line=dict(<span class=\"hljs-attribute\">color<\/span>=<span class=\"hljs-string\">'blue'<\/span>, width=<span class=\"hljs-number\">1<\/span>), name=<span class=\"hljs-string\">\"SMA50\"<\/span>)])\nfig.show()\n<\/code><\/pre>\n<\/div>\n<p><img decoding=\"async\"\n    src=\"https:\/\/lh3.googleusercontent.com\/NAv_8yhDKq8lqKk6yxE-H55VJAX9rZrOI-JVNmauRdA7wFATTkevunlVIFcVKD_FYAh0gNL6ErZbF1gkOD9PrW6-TdhpPgerCdTWa-f4cVu7SYMw3SNLbgPB8L-VRcuQ0uzHYhsD\"\n    alt=\"\"><\/p>\n<p>The yellow line shoes moving average for five days, green one shows a trend for 20 days and blue shows the trend for 50 days. We zoom in in March again. We can see a crossover at the start and end of March, i.e., the blue line goes above the green, and at the end of March, it goes down again. This indicates that the market is bearish at the start of March and then picks up again.<\/p>\n<p>Simple moving averages can be slow to respond to large price swings. To gauge this effect, investors use exponential moving averages.<\/p>\n<h5 id=\"exponential-moving-average\">Exponential Moving Average<\/h5>\n<p>The exponential moving average calculates the average again but gives more weight to more recent points of data.<\/p>\n<p>We use the ewm function and get the exponential moving average for five days, 20 days and 50 days. Here is the code:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"lang-python\">\ngoogf[<span class=\"hljs-string\">'EMA5'<\/span>] = googf<span class=\"hljs-selector-class\">.Close<\/span><span class=\"hljs-selector-class\">.ewm<\/span>(span=<span class=\"hljs-number\">5<\/span>, adjust=False).mean()\n\ngoogf[<span class=\"hljs-string\">'EMA20'<\/span>] = googf<span class=\"hljs-selector-class\">.Close<\/span><span class=\"hljs-selector-class\">.ewm<\/span>(span=<span class=\"hljs-number\">20<\/span>, adjust=False).mean()\n\nfig = go.Figure(data=[go.Ohlc(x=googf[<span class=\"hljs-string\">'Date'<\/span>],\n        open=googf[<span class=\"hljs-string\">'Open'<\/span>],\n        high=googf[<span class=\"hljs-string\">'High'<\/span>],\n        low=googf[<span class=\"hljs-string\">'Low'<\/span>],\n        close=googf[<span class=\"hljs-string\">'Close'<\/span>], name = <span class=\"hljs-string\">\"OHLC\"<\/span>),\n        go.Scatter(x=googf<span class=\"hljs-selector-class\">.Date<\/span>, y=googf<span class=\"hljs-selector-class\">.EMA5<\/span>, line=dict(<span class=\"hljs-attribute\">color<\/span>=<span class=\"hljs-string\">'orange'<\/span>, width=<span class=\"hljs-number\">1<\/span>), name=<span class=\"hljs-string\">\"EMA5\"<\/span>),\n        go.Scatter(x=googf<span class=\"hljs-selector-class\">.Date<\/span>, y=googf<span class=\"hljs-selector-class\">.EMA20<\/span>, line=dict(<span class=\"hljs-attribute\">color<\/span>=<span class=\"hljs-string\">'green'<\/span>, width=<span class=\"hljs-number\">1<\/span>), name=<span class=\"hljs-string\">\"EMA20\"<\/span>)])\nfig.show()\n<\/code><\/pre>\n<\/div>\n<p><img decoding=\"async\"\n    src=\"https:\/\/lh4.googleusercontent.com\/Ninvh_WF_whG03D4h7BM9Z5FCREk8ANd33CyFvLOd37FRAQ3NFijw2fxG8fR5p0X2N6GP6phV0namorbxvn-anZ97NkymK10xzRmq1QF4n2m-cDNjHd9uwP7-PTtd9SePOvTcUOn\"\n    alt=\"\"><\/p>\n<p>Here we again see a similar double crossover at the beginning of March and at the end. However, the gap is less significant. This implies that the market trend is more stable than we thought.<\/p>\n<p>Moving averages are easy to calculate but are limited because they\u00e2\u20ac\u2122re based on previous data. They will not be of much use for extremely volatile stocks.<\/p>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>In this post we first learned how to do market trend analysis with GridDB and python. We learned how to plot OHLP plots and do some moving average analysis.<\/p>\n<p>You can read more about moving averages <a\n    href=\"https:\/\/www.investopedia.com\/ask\/answers\/122414\/what-are-most-common-periods-used-creating-moving-average-ma-lines.asp\">here.<\/a><\/p>\n<h3 id=\"source-code\"> Source Code <\/h3>\n<p>    <a href=\"https:\/\/griddb.net\/en\/download\/27098\/\"> <span class=\"download-button\"> Click here to download the full source code <\/span><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Stock markets are fickle and often changing. Humans have tried to tame the bull throughout history but have never been successful. Stock market prediction is difficult because there are too many factors at play, and creating models to consider such variances is almost impossible. However, recent advances in machine learning and computing have allowed [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":27103,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[121],"tags":[],"class_list":["post-46624","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Stock Market Analysis with Python Pandas, Plotly and GridDB | GridDB: Open Source Time Series Database for IoT<\/title>\n<meta name=\"description\" content=\"Introduction Stock markets are fickle and often changing. Humans have tried to tame the bull throughout history but have never been successful. Stock\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Stock Market Analysis with Python Pandas, Plotly and GridDB | GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"og:description\" content=\"Introduction Stock markets are fickle and often changing. Humans have tried to tame the bull throughout history but have never been successful. Stock\" \/>\n<meta property=\"og:url\" content=\"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/\" \/>\n<meta property=\"og:site_name\" content=\"GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/griddbcommunity\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-12-16T08:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-13T20:55:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.griddb.net\/wp-content\/uploads\/2020\/12\/newplot.png\" \/>\n\t<meta property=\"og:image:width\" content=\"966\" \/>\n\t<meta property=\"og:image:height\" content=\"525\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"griddb-admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@GridDBCommunity\" \/>\n<meta name=\"twitter:site\" content=\"@GridDBCommunity\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"griddb-admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/\"},\"author\":{\"name\":\"griddb-admin\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233\"},\"headline\":\"Stock Market Analysis with Python Pandas, Plotly and GridDB\",\"datePublished\":\"2020-12-16T08:00:00+00:00\",\"dateModified\":\"2025-11-13T20:55:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/\"},\"wordCount\":1130,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/griddb.net\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2020\/12\/newplot.png\",\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/\",\"url\":\"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/\",\"name\":\"Stock Market Analysis with Python Pandas, Plotly and GridDB | GridDB: Open Source Time Series Database for IoT\",\"isPartOf\":{\"@id\":\"https:\/\/griddb.net\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2020\/12\/newplot.png\",\"datePublished\":\"2020-12-16T08:00:00+00:00\",\"dateModified\":\"2025-11-13T20:55:06+00:00\",\"description\":\"Introduction Stock markets are fickle and often changing. Humans have tried to tame the bull throughout history but have never been successful. Stock\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/#primaryimage\",\"url\":\"\/wp-content\/uploads\/2020\/12\/newplot.png\",\"contentUrl\":\"\/wp-content\/uploads\/2020\/12\/newplot.png\",\"width\":966,\"height\":525},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/griddb.net\/en\/#website\",\"url\":\"https:\/\/griddb.net\/en\/\",\"name\":\"GridDB: Open Source Time Series Database for IoT\",\"description\":\"GridDB is an open source time-series database with the performance of NoSQL and convenience of SQL\",\"publisher\":{\"@id\":\"https:\/\/griddb.net\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/griddb.net\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/griddb.net\/en\/#organization\",\"name\":\"Fixstars\",\"url\":\"https:\/\/griddb.net\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png\",\"contentUrl\":\"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png\",\"width\":200,\"height\":83,\"caption\":\"Fixstars\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/griddbcommunity\/\",\"https:\/\/x.com\/GridDBCommunity\",\"https:\/\/www.linkedin.com\/company\/griddb-by-toshiba\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233\",\"name\":\"griddb-admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g\",\"caption\":\"griddb-admin\"},\"url\":\"https:\/\/www.griddb.net\/en\/author\/griddb-admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Stock Market Analysis with Python Pandas, Plotly and GridDB | GridDB: Open Source Time Series Database for IoT","description":"Introduction Stock markets are fickle and often changing. Humans have tried to tame the bull throughout history but have never been successful. Stock","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/","og_locale":"en_US","og_type":"article","og_title":"Stock Market Analysis with Python Pandas, Plotly and GridDB | GridDB: Open Source Time Series Database for IoT","og_description":"Introduction Stock markets are fickle and often changing. Humans have tried to tame the bull throughout history but have never been successful. Stock","og_url":"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/","og_site_name":"GridDB: Open Source Time Series Database for IoT","article_publisher":"https:\/\/www.facebook.com\/griddbcommunity\/","article_published_time":"2020-12-16T08:00:00+00:00","article_modified_time":"2025-11-13T20:55:06+00:00","og_image":[{"width":966,"height":525,"url":"https:\/\/www.griddb.net\/wp-content\/uploads\/2020\/12\/newplot.png","type":"image\/png"}],"author":"griddb-admin","twitter_card":"summary_large_image","twitter_creator":"@GridDBCommunity","twitter_site":"@GridDBCommunity","twitter_misc":{"Written by":"griddb-admin","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/#article","isPartOf":{"@id":"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/"},"author":{"name":"griddb-admin","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233"},"headline":"Stock Market Analysis with Python Pandas, Plotly and GridDB","datePublished":"2020-12-16T08:00:00+00:00","dateModified":"2025-11-13T20:55:06+00:00","mainEntityOfPage":{"@id":"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/"},"wordCount":1130,"commentCount":0,"publisher":{"@id":"https:\/\/griddb.net\/en\/#organization"},"image":{"@id":"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2020\/12\/newplot.png","articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/","url":"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/","name":"Stock Market Analysis with Python Pandas, Plotly and GridDB | GridDB: Open Source Time Series Database for IoT","isPartOf":{"@id":"https:\/\/griddb.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/#primaryimage"},"image":{"@id":"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2020\/12\/newplot.png","datePublished":"2020-12-16T08:00:00+00:00","dateModified":"2025-11-13T20:55:06+00:00","description":"Introduction Stock markets are fickle and often changing. Humans have tried to tame the bull throughout history but have never been successful. Stock","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.net\/en\/blog\/stock-market-analysis-with-python-pandas-plotly-and-griddb\/#primaryimage","url":"\/wp-content\/uploads\/2020\/12\/newplot.png","contentUrl":"\/wp-content\/uploads\/2020\/12\/newplot.png","width":966,"height":525},{"@type":"WebSite","@id":"https:\/\/griddb.net\/en\/#website","url":"https:\/\/griddb.net\/en\/","name":"GridDB: Open Source Time Series Database for IoT","description":"GridDB is an open source time-series database with the performance of NoSQL and convenience of SQL","publisher":{"@id":"https:\/\/griddb.net\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/griddb.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/griddb.net\/en\/#organization","name":"Fixstars","url":"https:\/\/griddb.net\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/","url":"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png","contentUrl":"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png","width":200,"height":83,"caption":"Fixstars"},"image":{"@id":"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/griddbcommunity\/","https:\/\/x.com\/GridDBCommunity","https:\/\/www.linkedin.com\/company\/griddb-by-toshiba"]},{"@type":"Person","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233","name":"griddb-admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g","caption":"griddb-admin"},"url":"https:\/\/www.griddb.net\/en\/author\/griddb-admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts\/46624","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/comments?post=46624"}],"version-history":[{"count":1,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts\/46624\/revisions"}],"predecessor-version":[{"id":51300,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts\/46624\/revisions\/51300"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/media\/27103"}],"wp:attachment":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/media?parent=46624"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/categories?post=46624"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/tags?post=46624"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}