{"id":3503,"date":"2023-11-02T22:54:20","date_gmt":"2023-11-02T22:54:20","guid":{"rendered":"https:\/\/eodhd.com\/financial-academy\/?p=3503"},"modified":"2025-02-05T14:48:55","modified_gmt":"2025-02-05T14:48:55","slug":"how-to-build-a-stocks-market-web-app-with-python","status":"publish","type":"post","link":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python","title":{"rendered":"How to Build a Stocks Market Web App with Python"},"content":{"rendered":"\n<p>This tutorial will cover the creation of a web application written in Python using Flask. The web application will make use of the <a href=\"https:\/\/eodhd.com\/financial-apis\/python-financial-libraries-and-code-samples\/\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD API&#8217;s Python library<\/a> to supply the data. Users will be able to browse the API data through their browser, beautifully presented using Bootstrap tables. This article will cover the creation of the Python Flask dev project, retrieving the list of exchanges, drilling down into the exchange data to retrieve the markets, and then finally drilling down into the market to retrieve the hourly data for the market. The pages will use breadcrumbs to allow for easy navigation back and forth. Data will be presented using a Bootstrap data table that will natively allow for searching, sorting, filtering, and more.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><a class=\"maxbutton-1 maxbutton maxbutton-subscribe-to-api external-css btn\" href=\"https:\/\/eodhd.com\/register\"><span class='mb-text'>Register &amp; Get Data<\/span><\/a><\/p>\n\n\n\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-prerequisites\">Prerequisites<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Obtain an API Token from <a href=\"https:\/\/eodhd.com\/cp\/settings\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD APIs<\/a>.<br><\/li>\n\n\n\n<li>Install a current version of Python. A helpful guide can be found on <a href=\"https:\/\/realpython.com\/installing-python\/\" target=\"_blank\" rel=\"noreferrer noopener\">Real Python<\/a>.<br><\/li>\n\n\n\n<li>Install an IDE like <a href=\"https:\/\/code.visualstudio.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Visual Studio Code<\/a>.<br><\/li>\n\n\n\n<li>Create yourself a project directory.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-directory-and-file-structure\">Directory and File Structure<\/h2>\n\n\n\n<p>The initial directory and file structure will look like this:<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code lang=\"python\" class=\"language-python\">.\n|____requirements.txt\n|____app.py\n|____config.py\n|____api\n| |______init__.py\n| |____financial_data.py\n|____templates\n| |____exchanges.html<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>A lot more will be added to this, but this is our initial starting point. It will be easier to explain this in stages.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-file-contents\">File Contents<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-requirements-txt\">requirements.txt<\/h3>\n\n\n\n<p><em>flask<br>eodhd<\/em><\/p>\n\n\n\n<p>This file is used to define the library dependencies we need to install, primarily &#8220;flask&#8221; and &#8220;eodhd&#8221;. The way we install the library dependencies is as follows:<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code lang=\"python\" class=\"language-python\">% <strong>python3 -m pip install -r requirements.txt -U<\/strong><\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<h3 class=\"wp-block-heading\" id=\"h-config-py\">config.py<\/h3>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code lang=\"python\" class=\"language-python\"><em>API_TOKEN = \"YOUR_TOKEN\"<\/em><\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>This file only needs to contain your API TOKEN from EODHD APIs.<\/p>\n\n\n\n<p class=\"bordered_paragraph\">1. Use the \u201c<strong>demo<\/strong>\u201d API key to test our data from a limited set of tickers without registering:<br><a href=\"https:\/\/eodhistoricaldata.com\/financial-summary\/AAPL.US\" target=\"_blank\" rel=\"noreferrer noopener\">AAPL.US<\/a> | <a href=\"https:\/\/eodhistoricaldata.com\/financial-summary\/TSLA.US\" target=\"_blank\" rel=\"noreferrer noopener\">TSLA.US <\/a>| <a href=\"https:\/\/eodhistoricaldata.com\/financial-summary\/VTI.US\" target=\"_blank\" rel=\"noreferrer noopener\">VTI.US<\/a> | <a href=\"https:\/\/eodhistoricaldata.com\/financial-summary\/AMZN.US\" target=\"_blank\" rel=\"noreferrer noopener\">AMZN.US<\/a> | <a href=\"https:\/\/eodhistoricaldata.com\/financial-summary\/BTC-USD.CC\" target=\"_blank\" rel=\"noreferrer noopener\">BTC-USD<\/a> | <a href=\"https:\/\/eodhistoricaldata.com\/financial-summary\/EURUSD.FOREX\" target=\"_blank\" rel=\"noreferrer noopener\">EUR-USD<\/a><br><a href=\"https:\/\/eodhistoricaldata.com\/financial-apis\/new-real-time-data-api-websockets\/\" target=\"_blank\" rel=\"noreferrer noopener\">Real-Time Data<\/a> and all of the APIs (except Bulk) are included without API calls limitations with these tickers and the demo key.<br>2. Register to get your free API key (limited to 20 API calls per day) with access to:<br><a href=\"https:\/\/eodhistoricaldata.com\/financial-apis\/api-for-historical-data-and-volumes\/\" target=\"_blank\" rel=\"noreferrer noopener\">End-Of-Day Historical Data<\/a> with only the past year for any ticker, and the <a href=\"https:\/\/eodhistoricaldata.com\/financial-apis\/exchanges-api-list-of-tickers-and-trading-hours\/#Get_List_of_Tickers_Exchange_Symbols\" target=\"_blank\" rel=\"noreferrer noopener\">List of tickers per Exchange<\/a>.<br>3. To unlock your API key, we recommend to choose the subscription plan which covers your needs.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><a class=\"maxbutton-1 maxbutton maxbutton-subscribe-to-api external-css btn\" href=\"https:\/\/eodhd.com\/register\"><span class='mb-text'>Register &amp; Get Data<\/span><\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-app-py\">app.py<\/h3>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code lang=\"python\" class=\"language-python\">from flask import Flask, render_template\nfrom api.financial_data import EODHDAPIsDataFetcher\nfrom config import API_TOKEN\n\napp = Flask(__name__)\n\ndata_fetcher = EODHDAPIsDataFetcher(API_TOKEN)\n\n@app.route(\"\/\")\ndef exchanges():\n    exchanges = data_fetcher.fetch_exchanges()\n    return render_template(\"exchanges.html\", exchanges=exchanges)\n\nif __name__ == \"__main__\":\n    app.run()<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>This is the entry point to our application and some initial code to get us started. You will see we import the API_TOKEN from config.py and pass it into the class called &#8220;<strong>EODHDAPIsDataFetcher<\/strong>&#8220;.<\/p>\n\n\n\n<p>You will see the default route &#8220;<strong>\/<\/strong>&#8221; E.g., &#8220;http:\/\/127.0.0.1:5000<strong>\/<\/strong>&#8221; will retrieve a list of exchanges from the &#8220;<strong>data_fetcher<\/strong>&#8220;. The result returned from the function will be a JSON response.<\/p>\n\n\n\n<p>The JSON response will be passed to an HTML template called &#8220;<strong>exchanges.html<\/strong>&#8221; and the exchanges information will be passed to the file as &#8220;<strong>exchanges<\/strong>&#8220;.<\/p>\n\n\n\n<p>We will run it in the normal way:<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code lang=\"python\" class=\"language-python\">% python3 app.py<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>This will actually be extended to support configurable arguments as follows:<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code lang=\"python\" class=\"language-python\">% python3 app.py --host 127.0.0.1 --port 5000 --debug<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>When the web app is running we&#8217;ll be able to access it on: <strong>http:\/\/127.0.0.1:5000<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-templates-exchanges-html\">templates\/exchanges.html<\/h3>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code lang=\"python\" class=\"language-python\">&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n\n&lt;head&gt;\n    &lt;meta charset=\"UTF-8\"&gt;\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\n    &lt;title&gt;Exchanges&lt;\/title&gt;\n&lt;\/head&gt;\n\n&lt;body&gt;\n\n{% for exchange in exchanges %}\n    {{ exchange.Code }} &lt;br \/&gt;\n{% endfor %}\n\n&lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>This is not the finished file, but a minimal version of the file for illustration purposes. The main purpose of this file above is to show you how you import the &#8220;<strong>exchanges<\/strong>&#8221; variable array and loop through it. Each row will be returned as &#8220;<strong>exchange<\/strong>&#8221; and &#8220;<strong>Code<\/strong>&#8221; is a field on the row. You print a variable enclosed in double curly brackets. This structure can be replicated for all your API endpoints.<\/p>\n\n\n\n<p>Later we&#8217;ll add a Bootstrap data table to this that will make the output look very nice.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-api-financial-data-py\">api\/financial_data.py<\/h3>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code lang=\"python\" class=\"language-python\">import json\nfrom eodhd import APIClient\n\n\nclass EODHDAPIsDataFetcher:\n    def __init__(self, api_token):\n        self._api_token = api_token\n\n    def fetch_exchanges(self):\n        try:\n            api = APIClient(self._api_token)\n            df = api.get_exchanges()\n            return json.loads(df.to_json(orient=\"records\"))\n\n        except Exception as e:\n            print(f\"Error fetching data: {e}\")\n            return None<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>When a user opens their browser and goes to, &#8220;http:\/\/127.0.0.1:5000&#8221; it will essentially direct you at the &#8220;<strong>\/<\/strong>&#8221; route as described in &#8220;<strong>app.py<\/strong>&#8220;. You will see that the route calls &#8220;<strong>fetch_exchanges()<\/strong>&#8220;. This is where the API call will be made to the <a href=\"https:\/\/eodhd.com\/financial-apis\/python-financial-libraries-and-code-samples\/\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD API&#8217;s Python library<\/a> to retrieve the list of exchanges. The response from the Python library is returned as a Pandas dataframe. We want to convert this back to JSON to be returned back to the &#8220;<strong>exchanges.html<\/strong>&#8221; template.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-extending-templates-exchanges-html\">Extending templates\/exchanges.html<\/h2>\n\n\n\n<p>In the minimal code sample above I showed you how to display the data returned in an HTML format. It works, but doesn&#8217;t look very exciting without some styling. There is a really good Javascript library called Bootstrap that allows you to visualise tabulated data in a really nice way. It also has built in functionality to allow for page size, search, sort, pagination, and more natively.<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code lang=\"python\" class=\"language-python\">&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n\n&lt;head&gt;\n    &lt;meta charset=\"UTF-8\"&gt;\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\n    &lt;title&gt;Exchanges&lt;\/title&gt;\n\n    <a href=\"https:\/\/code.jquery.com\/jquery-3.6.0.min.js\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/code.jquery.com\/jquery-3.6.0.min.js<\/a>\n\n    <a href=\"https:\/\/cdn.datatables.net\/1.11.5\/js\/jquery.dataTables.min.js\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/cdn.datatables.net\/1.11.5\/js\/jquery.dataTables.min.js<\/a>\n    &lt;link rel=\"stylesheet\" type=\"text\/css\" href=\"https:\/\/cdn.datatables.net\/1.11.0\/css\/jquery.dataTables.min.css\"&gt;\n\n    &lt;link href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.1.0\/dist\/css\/bootstrap.min.css\" rel=\"stylesheet\"\n        integrity=\"sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p\/We\" crossorigin=\"anonymous\"&gt;\n    <a href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.1.0\/dist\/js\/bootstrap.bundle.min.js\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.1.0\/dist\/js\/bootstrap.bundle.min.js<\/a>\n\n    &lt;script&gt;\n        $(document).ready(function() {\n            $('#exchangesTable').DataTable();\n        });\n    &lt;\/script&gt;\n&lt;\/head&gt;\n\n&lt;body&gt;\n    &lt;div class=\"container\"&gt;\n        &lt;h1&gt;Exchanges&lt;\/h1&gt;\n        &lt;table id=\"exchangesTable\" class=\"table table-sm table-light table-bordered table-hover table-striped\"&gt;\n            &lt;thead&gt;\n                &lt;tr&gt;\n                    &lt;th&gt;Name&lt;\/th&gt;\n                    &lt;th&gt;Code&lt;\/th&gt;\n                    &lt;th&gt;OperatingMIC&lt;\/th&gt;\n                    &lt;th&gt;Currency&lt;\/th&gt;\n                    &lt;th&gt;CountryISO2&lt;\/th&gt;\n                    &lt;th&gt;CountryISO3&lt;\/th&gt;\n                &lt;\/tr&gt;\n            &lt;\/thead&gt;\n            &lt;tbody&gt;\n                {% for exchange in exchanges %}\n                    &lt;tr&gt;\n                        &lt;td&gt;&lt;a href=\"\/exchange\/{{ exchange.Code }}\"&gt;{{ exchange.Name }}&lt;\/a&gt;&lt;\/td&gt;\n                        &lt;td&gt;{{ exchange.Code }}&lt;\/td&gt;\n                        &lt;td&gt;{{ exchange.OperatingMIC }}&lt;\/td&gt;\n                        &lt;td&gt;{{ exchange.Currency }}&lt;\/td&gt;\n                        &lt;td&gt;{{ exchange.CountryISO2 }}&lt;\/td&gt;\n                        &lt;td&gt;{{ exchange.CountryISO3 }}&lt;\/td&gt;\n                    &lt;\/tr&gt;\n                {% endfor %}\n            &lt;\/tbody&gt;\n        &lt;\/table&gt;\n    &lt;\/div&gt;\n&lt;\/body&gt;\n\n&lt;\/html&gt;<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>In the above you will see that I imported the JQuery and Bootstrap libraries and stylesheets.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"2490\" height=\"1288\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/11\/Exchanges.png\" alt=\"\" class=\"wp-image-3523\"\/><\/figure>\n\n\n\n<p>All this table functionality from page size, search, sorting, and pagination is all &#8220;<strong>out the box<\/strong>&#8220;. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-building-on-from-here\">Building on from here&#8230;<\/h2>\n\n\n\n<p>You will notice that in the &#8220;<strong>app.py<\/strong>&#8221; the Flask application starts like this, &#8220;<strong>app.run()<\/strong>&#8220;. This works but run() can take additional parameters like the IP to listen on, port to listen on, and if it runs in debug mode. Let&#8217;s add some command line arguments to improve this.<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code lang=\"python\" class=\"language-python\"><strong>import re\nimport sys\nimport argparse<\/strong>\nfrom flask import Flask, render_template\nfrom api.financial_data import EODHDAPIsDataFetcher\nfrom config import API_TOKEN\n\n\n<strong>parser = argparse.ArgumentParser(description=\"EODHD APIs\")\nparser.add_argument(\n    \"--host\",\n    type=str,\n    help=\"Web service IP (default: 127.0.0.1)\",\n)\nparser.add_argument(\n    \"--port\",\n    type=int,\n    help=\"Web service port (default: 5000)\",\n)\nparser.add_argument(\"--debug\", action=\"store_true\", help=\"Enable debugging\")\nargs = parser.parse_args()\n\n\n# Listen on local host\nhttp_host = \"0.0.0.0\"\nif args.host is not None:\n    p = re.compile(r\"^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$\")\n    if p.match(args.host):\n        http_host = args.host\n    else:\n        parser.print_help(sys.stderr)\n\n# Listen on local port\nhttp_port = 5000\nif args.port is not None:\n    if args.port &gt;= 0 and args.port &lt;= 65535:\n        http_port = args.port\n    else:\n        parser.print_help(sys.stderr)<\/strong>\n\n\napp = Flask(__name__)\n\ndata_fetcher = EODHDAPIsDataFetcher(API_TOKEN)\n\n\n@app.route(\"\/\")\ndef exchanges():\n    exchanges = data_fetcher.fetch_exchanges()\n    return render_template(\"exchanges.html\", exchanges=exchanges)\n\n\nif __name__ == \"__main__\":\n    app.run(<strong>host=http_host, port=http_port, debug=args.debug<\/strong>)\n<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>What this will allow us to do is run the application like this:<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code lang=\"python\" class=\"language-python\">% python3 app.py --host 127.0.0.1 --port 5000 --debug<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>You may also notice in the Exchanges screenshot above that there is a hyperlink against each exchange. For example, the top entry points to this, &#8220;http:\/\/127.0.0.1:5000<strong>\/exchange\/AT<\/strong>&#8220;.<\/p>\n\n\n\n<p>The &#8220;<strong>\/exchange\/&lt;code&gt;<\/strong>&#8221; would be another route within Flask. The first step in adding a new route is to add it to the &#8220;<strong>app.py<\/strong>&#8220;.<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code lang=\"python\" class=\"language-python\">@app.route(\"\/exchange\/&lt;code&gt;\")\ndef exchange_markets(code):\n    markets = data_fetcher.fetch_exchange_markets(code)\n    return render_template(\"markets.html\", code=code, markets=markets)<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>Some important points to note:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The route has a configurable input that I called &#8220;<strong>&lt;code&gt;<\/strong>&#8220;. As you can see in the URL above &#8220;<strong>AT<\/strong>&#8221; is being passed as the &#8220;<strong>&lt;code&gt;<\/strong>&#8220;.<br><\/li>\n\n\n\n<li>&#8220;<strong>code<\/strong>&#8221; is then passed down to the function &#8220;<strong>exchange_markets(code)<\/strong>&#8221; which in turn passes the &#8220;<strong>code<\/strong>&#8221; down to &#8220;<strong>fetch_exchange_markets(code)<\/strong>&#8220;.<br><\/li>\n\n\n\n<li>You will also see that I&#8217;m passing a variables &#8220;<strong>code<\/strong>&#8221; and &#8220;<strong>markets<\/strong>&#8221; to the template, &#8220;<strong>markets.html<\/strong>&#8220;.<\/li>\n<\/ol>\n\n\n\n<p>We will also need to add the corresponding fetch function to the &#8220;<strong>api\/financial_data.py<\/strong>&#8221; file.<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code lang=\"python\" class=\"language-python\">    def fetch_exchange_markets(self, code: str = \"\"):\n        try:\n            api = APIClient(self._api_token)\n            df = api.get_exchange_symbols(code)\n            return json.loads(df.to_json(orient=\"records\"))\n\n        except Exception as e:\n            print(f\"Error fetching data: {e}\")\n            return None<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>It looks almost identical to the previous function, but takes &#8220;<strong>code<\/strong>&#8221; as an input.<\/p>\n\n\n\n<p>Finally, the &#8220;<strong>templates\/markets.html<\/strong>&#8221; will look like this.<\/p>\n\n\n\n            <div class=\"code__wrapper\">\n                <div class=\"code__content\">\n                    \n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code lang=\"python\" class=\"language-python\">&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n\n&lt;head&gt;\n    &lt;meta charset=\"UTF-8\"&gt;\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\n    &lt;title&gt;markets&lt;\/title&gt;\n\n    <a href=\"https:\/\/code.jquery.com\/jquery-3.6.0.min.js\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/code.jquery.com\/jquery-3.6.0.min.js<\/a>\n\n    <a href=\"https:\/\/cdn.datatables.net\/1.11.5\/js\/jquery.dataTables.min.js\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/cdn.datatables.net\/1.11.5\/js\/jquery.dataTables.min.js<\/a>\n    &lt;link rel=\"stylesheet\" type=\"text\/css\" href=\"https:\/\/cdn.datatables.net\/1.11.0\/css\/jquery.dataTables.min.css\"&gt;\n\n    &lt;link href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.1.0\/dist\/css\/bootstrap.min.css\" rel=\"stylesheet\"\n        integrity=\"sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p\/We\" crossorigin=\"anonymous\"&gt;\n    <a href=\"https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.1.0\/dist\/js\/bootstrap.bundle.min.js\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/cdn.jsdelivr.net\/npm\/bootstrap@5.1.0\/dist\/js\/bootstrap.bundle.min.js<\/a>\n\n    &lt;script&gt;\n        $(document).ready(function() {\n            $('#marketsTable').DataTable();\n        });\n    &lt;\/script&gt;\n&lt;\/head&gt;\n\n&lt;body&gt;\n    &lt;div class=\"container\"&gt;\n        &lt;a href=\"\/\"&gt;Exchanges&lt;\/a&gt; &gt; &lt;b&gt;{{ code }}&lt;\/b&gt;\n        &lt;p \/&gt;\n\n        &lt;h1&gt;{{ code }}&lt;\/h1&gt;\n        &lt;table id=\"marketsTable\" class=\"table table-sm table-light table-bordered table-hover table-striped\"&gt;\n            &lt;thead&gt;\n                &lt;tr&gt;\n                    \n                    &lt;th&gt;Code&lt;\/th&gt;\n                    &lt;th&gt;Name&lt;\/th&gt;\n                    &lt;th&gt;Country&lt;\/th&gt;\n                    &lt;th&gt;Exchange&lt;\/th&gt;\n                    &lt;th&gt;Currency&lt;\/th&gt;\n                    &lt;th&gt;Type&lt;\/th&gt;\n                    &lt;th&gt;Isin&lt;\/th&gt;\n                &lt;\/tr&gt;\n            &lt;\/thead&gt;\n            &lt;tbody&gt;\n                {% for item in markets %}\n                    &lt;tr&gt;\n                        &lt;td&gt;&lt;a href=\"\/exchange\/CC\/{{ item.Code }}\/1h\"&gt;{{ item.Code }}&lt;\/a&gt;&lt;\/td&gt;\n                        &lt;td&gt;{{ item.Name }}&lt;\/td&gt;\n                        &lt;td&gt;{{ item.Country }}&lt;\/td&gt;\n                        &lt;td&gt;{{ item.Exchange }}&lt;\/td&gt;\n                        &lt;td&gt;{{ item.Currency }}&lt;\/td&gt;\n                        &lt;td&gt;{{ item.Type }}&lt;\/td&gt;\n                        &lt;td&gt;{{ item.Isin }}&lt;\/td&gt;\n                    &lt;\/tr&gt;\n                {% endfor %}\n            &lt;\/tbody&gt;\n        &lt;\/table&gt;\n    &lt;\/div&gt;\n&lt;\/body&gt;\n\n&lt;\/html&gt;<\/code><\/pre>\n\n                <\/div>\n                <div class=\"code__btns\">\n                    <button class=\"code__copy\" class=\"copy\" title=\"Copy url\">\n                        <svg class=\"code__copy__icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                            <use xlink:href=\"\/img\/icons\/copy.svg#copy\"><\/use>\n                        <\/svg>\n                        <img decoding=\"async\" class=\"code__copy__approve\" alt=\"\" src=\"\/img\/approve_ico.svg\" loading=\"eager\">\n                    <\/button>\n                <\/div>\n            <\/div>\n        \n\n\n<p>Once again, it has an almost identical structure to the &#8220;<strong>exchanges.html<\/strong>&#8221; file.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"2564\" height=\"1780\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/11\/Markets.png\" alt=\"\" class=\"wp-image-3548\"\/><\/figure>\n\n\n\n<p>As you can see we have now drilled down into the &#8220;<strong>Athens Exchange (AT)<\/strong>&#8221; and viewing the markets. You will notice there are breadcrumbs at the top to be able to jump back to the exchange list easily. You are also able to drill down further into &#8220;<strong>Austriacard Holdings AG (ACAG)<\/strong>&#8221; market to view the hourly candlestick data.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"2670\" height=\"1354\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/11\/ACAG-Th.png\" alt=\"\" class=\"wp-image-3552\"\/><\/figure>\n\n\n\n<p class=\"has-text-align-center\"><a class=\"maxbutton-1 maxbutton maxbutton-subscribe-to-api external-css btn\" href=\"https:\/\/eodhd.com\/register\"><span class='mb-text'>Register &amp; Get Data<\/span><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2>\n\n\n\n<p>And there you have it, a functional web application written in Python using Flask to browse <a href=\"https:\/\/eodhd.com\/financial-apis\/\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD APIs<\/a> data in your browser. Although a solid, start this is only the beginning of your journey. We currently have the web application running in a development environment. This should be running on a production WSGI server instead E.g. the mod_wsgi in Apache 2.4.<\/p>\n\n\n\n<p>The candlestick data is currently showing hourly data only. It could be further enhanced to support the other supported intervals as well. Maybe including buttons on the market list page to drill down into an interval specifically.<\/p>\n\n\n\n<p>The data is currently displaying the raw API data. It could be further enhanced to include technical indicators E.g., trend indicators, momentum indicators, volume indicators, volatility indicators, and more.<\/p>\n\n\n\n<p>You would also add some graphs to enhance the aesthetic appeal of the web application. Maybe use a graphing library like D3.js.<\/p>\n\n\n\n<p>You can find the complete solution in <a href=\"https:\/\/github.com\/whittlem\/python-flask-eodhd-apis\" target=\"_blank\" rel=\"noreferrer noopener\">my Github repo<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial will cover the creation of a web application written in Python using Flask. The web application will make use of the EODHD API&#8217;s Python library to supply the data. Users will be able to browse the API data through their browser, beautifully presented using Bootstrap tables. This article will cover the creation of [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":3504,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[64],"tags":[],"coding-language":[53,30],"ready-to-go-solution":[56],"qualification":[32],"financial-apis-category":[34,36],"financial-apis-manuals":[],"class_list":["post-3503","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-building-stocks-apps-examples","coding-language-javascript","coding-language-python","ready-to-go-solution-eodhd-python-financial-library","qualification-guru","financial-apis-category-crypto-market-prices","financial-apis-category-stock-market-prices","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.9 (Yoast SEO v26.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Creating a Python Web App for Stocks Market with Flask | EODHD APIs Academy<\/title>\n<meta name=\"description\" content=\"Create a Python web application using Flask and Bootstrap to build a stocks market web app. Fetch, display, and analyze market data with ease\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Build a Stocks Market Web App with Python\" \/>\n<meta property=\"og:description\" content=\"Create a Python web application using Flask and Bootstrap to build a stocks market web app. Fetch, display, and analyze market data with ease\" \/>\n<meta property=\"og:url\" content=\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python\" \/>\n<meta property=\"og:site_name\" content=\"Financial Academy\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/eodhistoricaldata\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-02T22:54:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-05T14:48:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/11\/AdobeStock_577669489.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"980\" \/>\n\t<meta property=\"og:image:height\" content=\"653\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Michael Whittle\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@EOD_data\" \/>\n<meta name=\"twitter:site\" content=\"@EOD_data\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Whittle\" \/>\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:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python#article\",\"isPartOf\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python\"},\"author\":{\"name\":\"Michael Whittle\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/50784c270b6267df5969514d80d510ad\"},\"headline\":\"How to Build a Stocks Market Web App with Python\",\"datePublished\":\"2023-11-02T22:54:20+00:00\",\"dateModified\":\"2025-02-05T14:48:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python\"},\"wordCount\":1250,\"publisher\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#organization\"},\"image\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/11\/AdobeStock_577669489.jpeg\",\"articleSection\":[\"Building Stocks Apps Examples\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python\",\"name\":\"Creating a Python Web App for Stocks Market with Flask | EODHD APIs Academy\",\"isPartOf\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python#primaryimage\"},\"image\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/11\/AdobeStock_577669489.jpeg\",\"datePublished\":\"2023-11-02T22:54:20+00:00\",\"dateModified\":\"2025-02-05T14:48:55+00:00\",\"description\":\"Create a Python web application using Flask and Bootstrap to build a stocks market web app. Fetch, display, and analyze market data with ease\",\"breadcrumb\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python#primaryimage\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/11\/AdobeStock_577669489.jpeg\",\"contentUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/11\/AdobeStock_577669489.jpeg\",\"width\":4608,\"height\":3072},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/eodhd.com\/financial-academy\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Build a Stocks Market Web App with Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#website\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/\",\"name\":\"Financial APIs Academy | EODHD\",\"description\":\"Financial Stock Market Academy\",\"publisher\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/eodhd.com\/financial-academy\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#organization\",\"name\":\"EODHD (EOD Historical Data)\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png\",\"contentUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png\",\"width\":159,\"height\":82,\"caption\":\"EODHD (EOD Historical Data)\"},\"image\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/eodhistoricaldata\",\"https:\/\/x.com\/EOD_data\",\"https:\/\/www.reddit.com\/r\/EODHistoricalData\/\",\"https:\/\/eod-historical-data.medium.com\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/50784c270b6267df5969514d80d510ad\",\"name\":\"Michael Whittle\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5076af85c7ee0445454257247cad4970ae8cf5d7d4940d2b32c521f51c0a0f5a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5076af85c7ee0445454257247cad4970ae8cf5d7d4940d2b32c521f51c0a0f5a?s=96&d=mm&r=g\",\"caption\":\"Michael Whittle\"},\"description\":\"Solution architect, developer, and analyst with over 20+ years experience (TOP author on Medium).\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/author\/michaelwhittle\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Creating a Python Web App for Stocks Market with Flask | EODHD APIs Academy","description":"Create a Python web application using Flask and Bootstrap to build a stocks market web app. Fetch, display, and analyze market data with ease","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:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python","og_locale":"en_US","og_type":"article","og_title":"How to Build a Stocks Market Web App with Python","og_description":"Create a Python web application using Flask and Bootstrap to build a stocks market web app. Fetch, display, and analyze market data with ease","og_url":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python","og_site_name":"Financial Academy","article_publisher":"https:\/\/www.facebook.com\/eodhistoricaldata","article_published_time":"2023-11-02T22:54:20+00:00","article_modified_time":"2025-02-05T14:48:55+00:00","og_image":[{"url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/11\/AdobeStock_577669489.jpeg","width":980,"height":653,"type":"image\/jpeg"}],"author":"Michael Whittle","twitter_card":"summary_large_image","twitter_creator":"@EOD_data","twitter_site":"@EOD_data","twitter_misc":{"Written by":"Michael Whittle","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python#article","isPartOf":{"@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python"},"author":{"name":"Michael Whittle","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/50784c270b6267df5969514d80d510ad"},"headline":"How to Build a Stocks Market Web App with Python","datePublished":"2023-11-02T22:54:20+00:00","dateModified":"2025-02-05T14:48:55+00:00","mainEntityOfPage":{"@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python"},"wordCount":1250,"publisher":{"@id":"https:\/\/eodhd.com\/financial-academy\/#organization"},"image":{"@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python#primaryimage"},"thumbnailUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/11\/AdobeStock_577669489.jpeg","articleSection":["Building Stocks Apps Examples"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python","url":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python","name":"Creating a Python Web App for Stocks Market with Flask | EODHD APIs Academy","isPartOf":{"@id":"https:\/\/eodhd.com\/financial-academy\/#website"},"primaryImageOfPage":{"@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python#primaryimage"},"image":{"@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python#primaryimage"},"thumbnailUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/11\/AdobeStock_577669489.jpeg","datePublished":"2023-11-02T22:54:20+00:00","dateModified":"2025-02-05T14:48:55+00:00","description":"Create a Python web application using Flask and Bootstrap to build a stocks market web app. Fetch, display, and analyze market data with ease","breadcrumb":{"@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python#primaryimage","url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/11\/AdobeStock_577669489.jpeg","contentUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/11\/AdobeStock_577669489.jpeg","width":4608,"height":3072},{"@type":"BreadcrumbList","@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/how-to-build-a-stocks-market-web-app-with-python#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/eodhd.com\/financial-academy\/"},{"@type":"ListItem","position":2,"name":"How to Build a Stocks Market Web App with Python"}]},{"@type":"WebSite","@id":"https:\/\/eodhd.com\/financial-academy\/#website","url":"https:\/\/eodhd.com\/financial-academy\/","name":"Financial APIs Academy | EODHD","description":"Financial Stock Market Academy","publisher":{"@id":"https:\/\/eodhd.com\/financial-academy\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/eodhd.com\/financial-academy\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/eodhd.com\/financial-academy\/#organization","name":"EODHD (EOD Historical Data)","url":"https:\/\/eodhd.com\/financial-academy\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/","url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png","contentUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/12\/EODHD-Logo.png","width":159,"height":82,"caption":"EODHD (EOD Historical Data)"},"image":{"@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/eodhistoricaldata","https:\/\/x.com\/EOD_data","https:\/\/www.reddit.com\/r\/EODHistoricalData\/","https:\/\/eod-historical-data.medium.com\/"]},{"@type":"Person","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/50784c270b6267df5969514d80d510ad","name":"Michael Whittle","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5076af85c7ee0445454257247cad4970ae8cf5d7d4940d2b32c521f51c0a0f5a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5076af85c7ee0445454257247cad4970ae8cf5d7d4940d2b32c521f51c0a0f5a?s=96&d=mm&r=g","caption":"Michael Whittle"},"description":"Solution architect, developer, and analyst with over 20+ years experience (TOP author on Medium).","url":"https:\/\/eodhd.com\/financial-academy\/author\/michaelwhittle"}]}},"jetpack_featured_media_url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2023\/11\/AdobeStock_577669489.jpeg","jetpack_shortlink":"https:\/\/wp.me\/pdOdVT-Uv","jetpack_sharing_enabled":true,"acf":[],"_links":{"self":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/3503","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/comments?post=3503"}],"version-history":[{"count":19,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/3503\/revisions"}],"predecessor-version":[{"id":6331,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/3503\/revisions\/6331"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/media\/3504"}],"wp:attachment":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/media?parent=3503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/categories?post=3503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/tags?post=3503"},{"taxonomy":"coding-language","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/coding-language?post=3503"},{"taxonomy":"ready-to-go-solution","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/ready-to-go-solution?post=3503"},{"taxonomy":"qualification","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/qualification?post=3503"},{"taxonomy":"financial-apis-category","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/financial-apis-category?post=3503"},{"taxonomy":"financial-apis-manuals","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/financial-apis-manuals?post=3503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}