{"id":5915,"date":"2024-10-14T07:54:45","date_gmt":"2024-10-14T07:54:45","guid":{"rendered":"https:\/\/eodhd.com\/financial-academy\/?p=5915"},"modified":"2025-02-05T14:42:13","modified_gmt":"2025-02-05T14:42:13","slug":"build-a-financial-trading-dashboard-with-python-django","status":"publish","type":"post","link":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django","title":{"rendered":"Build a Financial Trading Dashboard with Python Django"},"content":{"rendered":"\n<p>Python Django is a high-level framework designed to facilitate the rapid development of web applications. I frequently work with Python, and when I opt for a framework, I typically choose Flask due to its flexibility, which allows me to build solutions with fewer restrictions. In contrast, Django is more opinionated, promoting a highly structured approach where there is often \u201cone right way\u201d to implement a solution.<\/p>\n\n\n\n<p>I thought this tutorial would be useful for introducing you to Django, while also serving as a helpful refresher for myself.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"859\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-1024x859.png\" alt=\"\" class=\"wp-image-5971\" srcset=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-1024x859.png 1024w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-300x252.png 300w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-768x644.png 768w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-1536x1288.png 1536w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-2048x1717.png 2048w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-60x50.png 60w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-150x126.png 150w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Recently, EODHD APIs introduced a new product called \u201c<a href=\"https:\/\/eodhd.com\/marketplace\/unicornbay\/spglobal\" target=\"_blank\" rel=\"noreferrer noopener\">Indices Historical Constituents Data<\/a>\u201d. This API is quite new and has not yet been integrated into the <a href=\"https:\/\/eodhd.com\/financial-apis\/python-financial-libraries-and-code-samples\" target=\"_blank\" rel=\"noreferrer noopener\">official Python library<\/a>. It provides two key functions: one for listing indices and another for retrieving the constituents of each index. To illustrate, consider the S&amp;P 500 index, which is denoted by the code \u201cGSPC.INDX.\u201d Although it&#8217;s called the S&amp;P 500, the index actually comprises of 503 stocks. This discrepancy exists because while there are 500 companies in the index, some companies have more than one type of stock class included.<\/p>\n\n\n\n<p>This new API offers up to 12 years of historical and current data for various global indices, including the S&amp;P 500, S&amp;P 600, S&amp;P 100, and S&amp;P 400, as well as key industry indices. The API provides detailed information such as the list of current constituents and any historical changes over time. Such data, which is difficult to find elsewhere, is highly valuable for in-depth analysis of market trends and long-term investment strategies. It&#8217;s designed for seamless integration and delivers structured data in JSON format, making it ideal for developers and analysts working on financial projects.<\/p>\n\n\n\n<p>For more information, you can visit the official product pages on EODHD&#8217;s marketplace or forum, where they discuss the features and details of the API in more depth <a href=\"https:\/\/eodhd.com\/marketplace\/unicornbay\/spglobal\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a> and <a href=\"https:\/\/forum.eodhd.com\/t\/update-s-p-and-dow-jones-indices-historical-constituents-api\/490\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<p class=\"bordered_paragraph\" style=\"font-size:16px\">Please note, API data availability depends on your subscription plan. Some data isn&#8217;t included in the free plan. Visit our <a href=\"https:\/\/eodhd.com\/pricing\" target=\"_blank\" rel=\"noreferrer noopener\">pricing page<\/a> to find the package that fits 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\n\n\n<h2 class=\"wp-block-heading\" id=\"h-prerequisites\">Prerequisites<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Install Python 3, ideally 3.9 or better. I&#8217;m using 3.9.6 on my Mac.<\/li>\n\n\n\n<li>Install an IDE. I&#8217;m using <a href=\"https:\/\/code.visualstudio.com\/download\">Visual Studio Code<\/a>, it&#8217;s free and excellent.<\/li>\n\n\n\n<li>Create a virtual environment called \u201cpython3 -m venv venv\u201d.<\/li>\n\n\n\n<li>Upgrade Python PIP, \u201cpython3 -m pip install &#8211;upgrade pip\u201d.<\/li>\n\n\n\n<li>Initialise the virtual environment \u201csource venv\/bin\/activate\u201d.<\/li>\n\n\n\n<li>Install Django using Python PIP. \u201cpython3 -m pip install django -U\u201d.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-django-the-basics\">Django &#8211; The Basics<\/h2>\n\n\n\n<p>Django has the concept of a project and app(s). A project may be made up of one or more app(s). You could consider an app as a component within the project. For my tutorial series I&#8217;m going to create a project called \u201ceodhd_apis\u201d. The project will consist of one more components or apps. The first app we will create will be called \u201cspglobal\u201d.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-d3-js\">D3.js<\/h2>\n\n\n\n<p>I&#8217;m going to use a popular javascript visualisation library called D3.js to create my treemap.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-bootstrap\">Bootstrap<\/h2>\n\n\n\n<p>I&#8217;m going to use a popular javascript data tables library called Bootstrap to create my constituents data table. Bootstrap is great as it&#8217;s easy to add export, sorting and pagination functionality to webpage tables.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-setting-up-our-django-project\">Setting up our Django project<\/h2>\n\n\n\n<p>Django has a utility (within the virtual environment) called \u201cdjango-admin\u201d that we&#8217;ll use to create our project.<\/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 has-link-color wp-elements-5b8546afab1e4ed14d4cf90b741fd024\"><code lang=\"python\" class=\"language-python\">(venv) $ <strong>django-admin startproject eodhd_apis<\/strong>\n(venv) $ <strong>cd <strong>eodhd_apis<\/strong><\/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<p>Django will create a project script called \u201cmanage.py\u201d that we&#8217;ll use to create and start our application.<\/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 has-link-color wp-elements-baa8e7dbe2739f23e6c77cd1203a752d\"><code lang=\"python\" class=\"language-python\">(venv) eodhd-django-webapp $ <strong>python manage.py startapp spglobal<\/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<h2 class=\"wp-block-heading\" id=\"h-add-the-app-to-the-settings\">Add the app to the Settings<\/h2>\n\n\n\n<p>Edit the file, \u201ceodhd_apis\/eodhd_apis\/settings.py\u201d and \u201cspglobal\u201d to the INSTALLED_APPS.<\/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 has-link-color wp-elements-3af982b8bd19c7ee002a664cbf2f97ab\"><code lang=\"python\" class=\"language-python\">INSTALLED_APPS = [\n    'django.contrib.admin',\n    'django.contrib.auth',\n    'django.contrib.contenttypes',\n    'django.contrib.sessions',\n    'django.contrib.messages',\n    'django.contrib.staticfiles',\n    '<strong>spglobal<\/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<h2 class=\"wp-block-heading\" id=\"h-creating-our-data-models\">Creating our data models<\/h2>\n\n\n\n<p>We will want to map this API endpoint to a model (\u201cSPGlobalIndex\u201d):<br>https:\/\/eodhd.com\/api\/mp\/unicornbay\/spglobal\/list?api_token=<strong>&lt;YOUR_API_KEY&gt;<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"681\" height=\"1024\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/09\/Screenshot-2024-09-30-at-20.39.36-681x1024.png\" alt=\"\" class=\"wp-image-5920\" srcset=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/09\/Screenshot-2024-09-30-at-20.39.36-681x1024.png 681w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/09\/Screenshot-2024-09-30-at-20.39.36-200x300.png 200w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/09\/Screenshot-2024-09-30-at-20.39.36-768x1155.png 768w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/09\/Screenshot-2024-09-30-at-20.39.36-1022x1536.png 1022w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/09\/Screenshot-2024-09-30-at-20.39.36-40x60.png 40w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/09\/Screenshot-2024-09-30-at-20.39.36-100x150.png 100w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/09\/Screenshot-2024-09-30-at-20.39.36.png 1108w\" sizes=\"auto, (max-width: 681px) 100vw, 681px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>We will want to map this API endpoint to a model (\u201cIndexConstituent\u201d):<br>https:\/\/eodhd.com\/api\/mp\/unicornbay\/spglobal\/comp\/<strong>GSPC.INDX<\/strong>?fmt=json&amp;api_token=<strong>&lt;YOUR_API_KEY&gt;<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"622\" height=\"1024\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-09.42.22-622x1024.png\" alt=\"\" class=\"wp-image-5957\" srcset=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-09.42.22-622x1024.png 622w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-09.42.22-182x300.png 182w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-09.42.22-768x1265.png 768w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-09.42.22-36x60.png 36w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-09.42.22-91x150.png 91w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-09.42.22.png 862w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Edit the file \u201ceodhd_apis\/spglobal\/models.py\u201d and add the two models below. I have done the hard part of mapping the API fields to the correct data types in the models.<\/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 has-link-color wp-elements-909d90711a35076c74c815643c908889\"><code lang=\"python\" class=\"language-python\">from django.db import models\n\n\nclass SPGlobalIndex(models.Model):\n    index_id = models.CharField(max_length=50, unique=True)\n    code = models.CharField(max_length=50)\n    name = models.CharField(max_length=255)\n    constituents = models.IntegerField()\n    value = models.FloatField()\n    market_cap = models.FloatField(null=True, blank=True)\n    divisor = models.FloatField(null=True, blank=True)\n    daily_return = models.FloatField()\n    dividend = models.FloatField(null=True, blank=True)\n    adjusted_market_cap = models.FloatField(null=True, blank=True)\n    adjusted_divisor = models.FloatField(null=True, blank=True)\n    adjusted_constituents = models.IntegerField()\n    currency_code = models.CharField(max_length=10)\n    currency_name = models.CharField(max_length=50)\n    currency_symbol = models.CharField(max_length=10)\n    last_update = models.DateField()\n\n    def __str__(self):\n        return self.name\n\n\nclass IndexConstituent(models.Model):\n    index = models.ForeignKey(\n        SPGlobalIndex, on_delete=models.CASCADE, related_name=\"components\"\n    )\n    code = models.CharField(max_length=10)\n    name = models.CharField(max_length=255)\n    sector = models.CharField(max_length=50)\n    industry = models.CharField(max_length=100)\n    weight = models.FloatField()\n\n    def __str__(self):\n        return self.name\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>Once the model is created, run the following commands to create and migrate the database.<\/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 has-link-color wp-elements-0facc141b5474ba1a93db15dede5fd2b\"><code lang=\"python\" class=\"language-python\">(venv) eodhd_apis % python3 manage.py makemigrations\nMigrations for 'spglobal':\n  spglobal\/migrations\/0001_initial.py\n    - Create model SPGlobalIndex\n    - Create model IndexConstituent\n\n(venv) eodhd_apis % python3 manage.py migrate       \nOperations to perform:\n  Apply all migrations: admin, auth, contenttypes, sessions, spglobal\nRunning migrations:\n  Applying contenttypes.0001_initial... OK\n  Applying auth.0001_initial... OK\n  Applying admin.0001_initial... OK\n  Applying admin.0002_logentry_remove_auto_add... OK\n  Applying admin.0003_logentry_add_action_flag_choices... OK\n  Applying contenttypes.0002_remove_content_type_name... OK\n  Applying auth.0002_alter_permission_name_max_length... OK\n  Applying auth.0003_alter_user_email_max_length... OK\n  Applying auth.0004_alter_user_username_opts... OK\n  Applying auth.0005_alter_user_last_login_null... OK\n  Applying auth.0006_require_contenttypes_0002... OK\n  Applying auth.0007_alter_validators_add_error_messages... OK\n  Applying auth.0008_alter_user_username_max_length... OK\n  Applying auth.0009_alter_user_last_name_max_length... OK\n  Applying auth.0010_alter_group_name_max_length... OK\n  Applying auth.0011_update_proxy_permissions... OK\n  Applying auth.0012_alter_user_first_name_max_length... OK\n  Applying sessions.0001_initial... OK\n  Applying spglobal.0001_initial... OK<\/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>Two actions are going to be done here:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>You will see a file called \u201cdb.sqlite3\u201d created in your project root. SQLite is the default database for Python Django. This is where your database data will be stored. If you ever run into trouble you can delete this file and let the app rebuild it from API data.<br><\/li>\n\n\n\n<li>In your \u201ceodhd_apis\/spglobal\/migrations\u201d directory, you will see files created to keep track of the change log in the database. The first file would typically be called \u201c0001_initial.py\u201d. If you ever get stuck and have to delete the database mentioned above, make sure you delete all the transaction files as well.<\/li>\n<\/ol>\n\n\n\n<p>Here are some useful model and database diagnostic commands if you need them&#8230;<\/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 has-link-color wp-elements-2326fe776b9e98d14e2c6730bbb1efac\"><code lang=\"python\" class=\"language-python\">(venv) eodhd_apis % python3 manage.py showmigrations\nadmin\n [X] 0001_initial\n [X] 0002_logentry_remove_auto_add\n [X] 0003_logentry_add_action_flag_choices\nauth\n [X] 0001_initial\n [X] 0002_alter_permission_name_max_length\n [X] 0003_alter_user_email_max_length\n [X] 0004_alter_user_username_opts\n [X] 0005_alter_user_last_login_null\n [X] 0006_require_contenttypes_0002\n [X] 0007_alter_validators_add_error_messages\n [X] 0008_alter_user_username_max_length\n [X] 0009_alter_user_last_name_max_length\n [X] 0010_alter_group_name_max_length\n [X] 0011_update_proxy_permissions\n [X] 0012_alter_user_first_name_max_length\ncontenttypes\n [X] 0001_initial\n [X] 0002_remove_content_type_name\nsessions\n [X] 0001_initial\nspglobal\n [X] 0001_initial\n\n\n(venv) eodhd_apis % python3 manage.py shell         \nPython 3.9.6 (default, Oct 18 2022, 12:41:40) \n[Clang 14.0.0 (clang-1400.0.29.202)] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n(InteractiveConsole)\n&gt;&gt;&gt; <strong>from spglobal.models import SPGlobalIndex<\/strong>\n&gt;&gt;&gt; <strong>SPGlobalIndex.objects.all()<\/strong>\n&lt;QuerySet []&gt;\n&gt;&gt;&gt; \n\n\n(venv) eodhd_apis % python manage.py dbshell\nSQLite version 3.37.0 2021-12-09 01:34:53\nEnter \".help\" for usage hints.\nsqlite&gt; <strong>.schema spglobal_indexconstituent<\/strong>\nCREATE TABLE IF NOT EXISTS \"spglobal_indexconstituent\" (\"id\" integer NOT NULL PRIMARY KEY AUTOINCREMENT, \"code\" varchar(10) NOT NULL, \"name\" varchar(255) NOT NULL, \"sector\" varchar(50) NOT NULL, \"industry\" varchar(100) NOT NULL, \"weight\" real NOT NULL, \"index_id\" bigint NOT NULL REFERENCES \"spglobal_spglobalindex\" (\"id\") DEFERRABLE INITIALLY DEFERRED);\nCREATE INDEX \"spglobal_indexconstituent_index_id_5d694d08\" ON \"spglobal_indexconstituent\" (\"index_id\");\nsqlite&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<h2 class=\"wp-block-heading\" id=\"h-creating-our-views\">Creating our Views<\/h2>\n\n\n\n<p>Edit the \u201ceodhd_apis\/spglobal\/views.py\u201d file and make it look as below. Make sure you replace &lt;YOUR_API_KEY&gt; with your subscription API key.<\/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 has-link-color wp-elements-cddd1753fe5f7bf4fc36b9a7a7bbfecc\"><code lang=\"python\" class=\"language-python\">import requests\nfrom django.shortcuts import render, get_object_or_404, redirect\nfrom .models import SPGlobalIndex, IndexConstituent\n\n\ndef fetch_data(request):\n    url = \"https:\/\/eodhd.com\/api\/mp\/unicornbay\/spglobal\/list?api_token=&lt;YOUR_API_KEY&gt;\"\n    response = requests.get(url)\n    data = response.json()\n\n    for item in data:\n        SPGlobalIndex.objects.update_or_create(\n            index_id=item.get(\"ID\"),\n            defaults={\n                \"code\": item.get(\"Code\"),\n                \"name\": item.get(\"Name\"),\n                \"constituents\": item.get(\"Constituents\"),\n                \"value\": item.get(\"Value\"),\n                \"market_cap\": item.get(\"MarketCap\"),\n                \"divisor\": item.get(\"Divisor\"),\n                \"daily_return\": item.get(\"DailyReturn\"),\n                \"dividend\": item.get(\"Dividend\"),\n                \"adjusted_market_cap\": item.get(\"AdjustedMarketCap\"),\n                \"adjusted_divisor\": item.get(\"AdjustedDivisor\"),\n                \"adjusted_constituents\": item.get(\"AdjustedConstituents\"),\n                \"currency_code\": item.get(\"CurrencyCode\"),\n                \"currency_name\": item.get(\"CurrencyName\"),\n                \"currency_symbol\": item.get(\"CurrencySymbol\"),\n                \"last_update\": item.get(\"LastUpdate\"),\n            },\n        )\n\n    indices = SPGlobalIndex.objects.all()\n    return render(request, \"spglobal\/index.html\", {\"indices\": indices})\n\n\ndef fetch_index_constituents(request, index_code):\n    url = f'https:\/\/eodhd.com\/api\/mp\/unicornbay\/spglobal\/comp\/{index_code}?fmt=json&amp;api_token=&lt;YOUR_API_KEY&gt;'\n    response = requests.get(url)\n    data = response.json()\n\n    # Extract constituents and general information\n    constituents = data['Components'].values()\n    general_info = data['General']\n\n    return render(request, 'spglobal\/constituents.html', {\n        'constituents': constituents,\n        'general_info': general_info\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>Create this file if it doesn&#8217;t exist to handle the routes, \u201ceodhd_apis\/spglobal\/urls.py\u201d.<\/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 has-link-color wp-elements-715196196cb42983d1217bfc6b3fc8a7\"><code lang=\"python\" class=\"language-python\">from django.urls import path\nfrom . import views\n\nurlpatterns = [\n    path(\"\", views.fetch_data, name=\"fetch_data\"),\n    path(\n        \"constituents\/&lt;str:index_code&gt;\/\",\n        views.fetch_index_constituents,\n        name=\"fetch_index_constituents\",\n    ),\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>And update this file with the following changes in bold, \u201ceodhd_apis\/eodhd_apis\/urls.py\u201d.<\/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 has-link-color wp-elements-0bccdb7b217c0ab401c37d11f5e980f0\"><code lang=\"python\" class=\"language-python\">from django.contrib import admin\nfrom django.urls import path<strong>, include<\/strong>\n\nurlpatterns = [\n    path(\"admin\/\", admin.site.urls),\n    <strong>path(\"\", include(\"spglobal.urls\")),<\/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<h2 class=\"wp-block-heading\" id=\"h-treemap-with-d3-js\">Treemap with D3.js<\/h2>\n\n\n\n<p>Create the template directory structure, \u201ceodhd_apis\/spglobal\/templates\/spglobal\u201d<\/p>\n\n\n\n<p>And create the file, \u201ceodhd_apis\/spgobal\/templates\/spglobal\/index.html\u201d.<\/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 has-link-color wp-elements-0f5ab25722a45bb6d1c171e487d7a5bf\"><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;Market Indices&lt;\/title&gt;\n    <a href=\"https:\/\/d3js.org\/d3.v6.min.js\">https:\/\/d3js.org\/d3.v6.min.js<\/a>\n    \n    &lt;link href=\"https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.5.2\/css\/bootstrap.min.css\" rel=\"stylesheet\"&gt;\n    \n    &lt;style&gt;\n        body {\n            background-color: #343a40;\n            color: #ffffff;\n        }\n        h1 {\n            color: #ffffff;\n            text-align: center;\n            margin-top: 20px;\n        }\n        #treemap {\n            margin: 0 auto;\n        }\n        .node {\n            border: solid 1px white;\n            font: 10px sans-serif;\n            line-height: 12px;\n            overflow: hidden;\n            position: absolute;\n            text-align: center;\n        }\n        a {\n            text-decoration: underline;\n            color: #ffffff;\n        }\n        a:hover {\n            color: #d3d3d3;\n        }\n    &lt;\/style&gt;\n&lt;\/head&gt;\n\n&lt;body&gt;\n    &lt;div class=\"container mt-5\"&gt;\n        &lt;h1&gt;Market Indices&lt;\/h1&gt;\n        &lt;div id=\"treemap\"&gt;&lt;\/div&gt;\n    &lt;\/div&gt;\n\n    &lt;script&gt;\n        const data = {\n            \"name\": \"Indices\",\n            \"children\": [\n                {% for index in indices %}\n                {\n                    \"index_id\": \"{{ index.index_id }}\",\n                    \"code\": \"{{ index.code }}\",\n                    \"name\": \"{{ index.name }}\",\n                    \"constituents\": {{ index.constituents }}\n                },\n                {% endfor %}\n            ]\n        };\n\n        const width = 1140;\n        const height = window.innerHeight * 0.8;\n\n        const treemap = d3.treemap()\n            .size([width, height])\n            .padding(1)\n            .round(true);\n\n        const root = d3.hierarchy(data)\n            .sum(d =&gt; d.constituents)\n            .sort((a, b) =&gt; b.constituents - a.constituents);\n\n        treemap(root);\n\n        const svg = d3.select(\"#treemap\")\n            .append(\"svg\")\n            .attr(\"width\", width)\n            .attr(\"height\", height)\n            .style(\"font\", \"10px sans-serif\");\n\n        const cell = svg.selectAll(\"g\")\n            .data(root.leaves())\n            .enter().append(\"g\")\n            .attr(\"transform\", d =&gt; `translate(${d.x0},${d.y0})`);\n\n        const colorScale = d3.scaleOrdinal(d3.schemeCategory10);\n\n        function getFontSize(tileWidth, tileHeight) {\n            const minSize = Math.min(tileWidth, tileHeight);\n            return Math.max(10, Math.min(16, minSize * 0.15));\n        }\n\n        function wrapText(text, width) {\n            text.each(function() {\n                const text = d3.select(this),\n                    words = text.text().split(\/\\s+\/).reverse(),\n                    lineHeight = 1.1;\n                let word,\n                    line = [],\n                    lineNumber = 0,\n                    y = text.attr(\"y\"),\n                    dy = parseFloat(text.attr(\"dy\")) || 0,\n                    tspan = text.text(null).append(\"tspan\").attr(\"x\", 3).attr(\"y\", y).attr(\"dy\", dy + \"em\");\n                while (word = words.pop()) {\n                    line.push(word);\n                    tspan.text(line.join(\" \"));\n                    if (tspan.node().getComputedTextLength() &gt; width) {\n                        line.pop();\n                        tspan.text(line.join(\" \"));\n                        line = [word];\n                        tspan = text.append(\"tspan\").attr(\"x\", 3).attr(\"y\", y).attr(\"dy\", ++lineNumber * lineHeight + dy + \"em\").text(word);\n                    }\n                }\n            });\n        }\n\n        cell.append(\"rect\")\n            .attr(\"id\", d =&gt; d.data.id)\n            .attr(\"width\", d =&gt; d.x1 - d.x0)\n            .attr(\"height\", d =&gt; d.y1 - d.y0)\n            .attr(\"fill\", d =&gt; colorScale(d.data.index_id))\n            .attr(\"stroke\", \"#ffffff\")\n            .on(\"click\", d =&gt; {\n                window.location.href = `\/index\/${d.data.code}\/`;\n            });\n\n        cell.append(\"foreignObject\")\n            .attr(\"x\", 3)\n            .attr(\"y\", 3)\n            .attr(\"width\", d =&gt; d.x1 - d.x0)\n            .attr(\"height\", d =&gt; d.y1 - d.y0)\n            .append(\"xhtml:div\")\n            .style(\"font-size\", d =&gt; getFontSize(d.x1 - d.x0, d.y1 - d.y0) + \"px\")\n            .style(\"color\", \"#ffffff\")\n            .style(\"overflow\", \"hidden\")\n            .html(d =&gt; `&lt;a href=\"\/constituents\/${d.data.index_id}\/\"&gt;${d.data.code}&lt;\/a&gt; (${d.data.constituents})`);\n    &lt;\/script&gt;\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>And create the file, \u201ceodhd_apis\/spgobal\/templates\/spglobal\/constituents.html\u201d.<\/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 has-link-color wp-elements-6de001b9f1b6aec26abb6e51c1b0e0de\"><code lang=\"python\" class=\"language-python\">&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n&lt;head&gt;\n    &lt;meta charset=\"UTF-8\"&gt;\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\"&gt;\n    &lt;title&gt;{{ general_info.Name }} Constituents&lt;\/title&gt;\n    \n    &lt;link href=\"https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.5.2\/css\/bootstrap.min.css\" rel=\"stylesheet\"&gt;\n    &lt;link rel=\"stylesheet\" href=\"https:\/\/cdn.datatables.net\/1.10.21\/css\/dataTables.bootstrap4.min.css\"&gt;\n    &lt;link rel=\"stylesheet\" href=\"https:\/\/cdn.datatables.net\/buttons\/1.7.1\/css\/buttons.bootstrap4.min.css\"&gt;\n\n\n    &lt;style&gt;\n        body {\n            background-color: #343a40;\n            color: #ffffff;\n        }\n        .table {\n            background-color: #212529;\n        }\n        .table th, .table td {\n            color: #ffffff;\n        }\n        .btn-dark {\n            background-color: #6c757d;\n            border-color: #6c757d;\n        }\n\n        a {\n            color: #ffffff !important;\n            text-decoration: none;\n            background-color: transparent;\n        }\n        a:hover {\n            color: #adb5bd !important;\n        }\n\n        .page-item.active .page-link {\n            z-index: 3;\n            color: #ffffff !important;\n            background-color: #495057 !important;\n            border-color: #495057 !important;\n        }\n\n        .page-link {\n            color: #ffffff !important;\n            background-color: #6c757d !important;\n            border-color: #343a40 !important;\n        }\n        .page-link:hover {\n            color: #adb5bd !important;\n            background-color: #5a6268 !important;\n            border-color: #343a40 !important;\n        }\n\n        .dataTables_wrapper .dataTables_paginate .paginate_button {\n            color: #ffffff !important;\n            background-color: #6c757d !important;\n            border: 1px solid #343a40 !important;\n        }\n        .dataTables_wrapper .dataTables_paginate .paginate_button:hover {\n            background-color: #5a6268 !important;\n            border: 1px solid #343a40 !important;\n        }\n        .dataTables_wrapper .dataTables_paginate .paginate_button.current {\n            color: #ffffff !important;\n            background-color: #495057 !important;\n            border: 1px solid #343a40 !important;\n        }\n        .dataTables_wrapper .dataTables_paginate .paginate_button.disabled,\n        .dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {\n            background-color: #6c757d !important;\n            color: #ffffff !important;\n        }\n    &lt;\/style&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;div class=\"container mt-5\"&gt;\n        &lt;h1 class=\"mb-4 text-light\"&gt;{{ general_info.Name }} ({{ general_info.Code }}) Constituents&lt;\/h1&gt;\n\n        &lt;table id=\"constituentsTable\" class=\"table table-dark table-striped table-bordered\"&gt;\n            &lt;thead class=\"thead-dark\"&gt;\n                &lt;tr&gt;\n                    &lt;th&gt;Code&lt;\/th&gt;\n                    &lt;th&gt;Name&lt;\/th&gt;\n                    &lt;th&gt;Sector&lt;\/th&gt;\n                    &lt;th&gt;Industry&lt;\/th&gt;\n                    &lt;th&gt;Weight&lt;\/th&gt;\n                &lt;\/tr&gt;\n            &lt;\/thead&gt;\n            &lt;tbody&gt;\n                {% for constituent in constituents %}\n                &lt;tr&gt;\n                    &lt;td&gt;{{ constituent.Code }}&lt;\/td&gt;\n                    &lt;td&gt;{{ constituent.Name }}&lt;\/td&gt;\n                    &lt;td&gt;{{ constituent.Sector }}&lt;\/td&gt;\n                    &lt;td&gt;{{ constituent.Industry }}&lt;\/td&gt;\n                    &lt;td&gt;{{ constituent.Weight }}&lt;\/td&gt;\n                &lt;\/tr&gt;\n                {% endfor %}\n            &lt;\/tbody&gt;\n        &lt;\/table&gt;\n\n        &lt;a href=\"{% url 'fetch_data' %}\" class=\"btn btn-dark mt-4\"&gt;Back to Index List&lt;\/a&gt;\n    &lt;\/div&gt;\n\n    <a href=\"https:\/\/code.jquery.com\/jquery-3.5.1.min.js\">https:\/\/code.jquery.com\/jquery-3.5.1.min.js<\/a>\n    <a href=\"https:\/\/cdn.jsdelivr.net\/npm\/@popperjs\/core@2.9.1\/dist\/umd\/popper.min.js\">https:\/\/cdn.jsdelivr.net\/npm\/@popperjs\/core@2.9.1\/dist\/umd\/popper.min.js<\/a>\n    <a href=\"https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.5.2\/js\/bootstrap.min.js\">https:\/\/stackpath.bootstrapcdn.com\/bootstrap\/4.5.2\/js\/bootstrap.min.js<\/a>\n    <a href=\"https:\/\/cdn.datatables.net\/1.10.21\/js\/jquery.dataTables.min.js\">https:\/\/cdn.datatables.net\/1.10.21\/js\/jquery.dataTables.min.js<\/a>\n    <a href=\"https:\/\/cdn.datatables.net\/1.10.21\/js\/dataTables.bootstrap4.min.js\">https:\/\/cdn.datatables.net\/1.10.21\/js\/dataTables.bootstrap4.min.js<\/a>\n    <a href=\"https:\/\/cdn.datatables.net\/buttons\/1.7.1\/js\/dataTables.buttons.min.js\">https:\/\/cdn.datatables.net\/buttons\/1.7.1\/js\/dataTables.buttons.min.js<\/a>\n    <a href=\"https:\/\/cdn.datatables.net\/buttons\/1.7.1\/js\/buttons.bootstrap4.min.js\">https:\/\/cdn.datatables.net\/buttons\/1.7.1\/js\/buttons.bootstrap4.min.js<\/a>\n    <a href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jszip\/3.1.3\/jszip.min.js\">https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/jszip\/3.1.3\/jszip.min.js<\/a>\n    <a href=\"https:\/\/cdn.datatables.net\/buttons\/1.7.1\/js\/buttons.html5.min.js\">https:\/\/cdn.datatables.net\/buttons\/1.7.1\/js\/buttons.html5.min.js<\/a>\n    <a href=\"https:\/\/cdn.datatables.net\/buttons\/1.7.1\/js\/buttons.print.min.js\">https:\/\/cdn.datatables.net\/buttons\/1.7.1\/js\/buttons.print.min.js<\/a>\n\n    &lt;script&gt;\n        $(document).ready(function() {\n            $('#constituentsTable').DataTable({\n                \"paging\": true,\n                \"searching\": true,\n                \"ordering\": true,\n                \"info\": true,\n                \"lengthMenu\": [10, 25, 50, 100],\n                \"order\": [[4, \"desc\"]],\n\n                dom: 'Bfrtip',\n                buttons: [\n                    {\n                        extend: 'excel',\n                        text: 'Export to Excel'\n                    }\n                ]\n            });\n        });\n    &lt;\/script&gt;\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<h2 class=\"wp-block-heading\" id=\"h-add-data-to-the-database\">Add Data to the Database<\/h2>\n\n\n\n<p>In \u201ceodhd_apis\/spglobal\/admin.py\u201d, register the <strong>SPGlobalIndex<\/strong> and <strong>IndexConstituent<\/strong> models so you can add index via Django\u2019s admin interface:<\/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 has-link-color wp-elements-4a85bf3eeeb762a1c2325641b964d43b\"><code lang=\"python\" class=\"language-python\">from django.contrib import admin\nfrom .models import SPGlobalIndex\n\nadmin.site.register(SPGlobalIndex)<\/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<h2 class=\"wp-block-heading\" id=\"h-now-run-the-server\">Now, run the server:<\/h2>\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 has-link-color wp-elements-29411b3b3311bf08e23bdb5cfb7533e2\"><code lang=\"python\" class=\"language-python\">(venv) eodhd_apis % python3 manage.py runserver\nWatching for file changes with StatReloader\nPerforming system checks...\n\nSystem check identified no issues (0 silenced).\nOctober 09, 2024 - 09:13:47\nDjango version 4.2.16, using settings 'eodhd_apis.settings'\nStarting development server at http:\/\/127.0.0.1:8000\/\nQuit the server with CONTROL-C.<\/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\">Summary:<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Main Page<\/strong> (<code>\/<\/code>): Displays the clickable treemap of people using D3.js.<\/li>\n\n\n\n<li><strong>Detail Page<\/strong> (<code>\/constituents\/&lt;id&gt;\/<\/code>): Displays additional information about the selected index.<\/li>\n<\/ul>\n\n\n\n<p>If everything is working as expected (so far), it should look like this&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"859\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-1024x859.png\" alt=\"\" class=\"wp-image-5971\" srcset=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-1024x859.png 1024w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-300x252.png 300w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-768x644.png 768w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-1536x1288.png 1536w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-2048x1717.png 2048w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-60x50.png 60w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15-150x126.png 150w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"728\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.37.01-1024x728.png\" alt=\"\" class=\"wp-image-5972\" srcset=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.37.01-1024x728.png 1024w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.37.01-300x213.png 300w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.37.01-768x546.png 768w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.37.01-1536x1091.png 1536w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.37.01-2048x1455.png 2048w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.37.01-60x43.png 60w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.37.01-150x107.png 150w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-admin-interface-optional\">Admin Interface (Optional)<\/h2>\n\n\n\n<p>We can either add the data manually through the admin interface or we can add it dynamically using an API call.<\/p>\n\n\n\n<p>In order to access the admin interface (http:\/\/127.0.0.1:8000\/admin), we will need to create a super user account.<\/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 has-link-color wp-elements-66f4ae0d1030cbb90b7f4c12fe6705c8\"><code lang=\"python\" class=\"language-python\">(venv) eodhd_apis $ <strong>python manage.py createsuperuser <\/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<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"647\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-02-at-20.07.00-1024x647.png\" alt=\"\" class=\"wp-image-5935\" srcset=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-02-at-20.07.00-1024x647.png 1024w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-02-at-20.07.00-300x190.png 300w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-02-at-20.07.00-768x485.png 768w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-02-at-20.07.00-60x38.png 60w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-02-at-20.07.00-150x95.png 150w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-02-at-20.07.00.png 1418w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"350\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.39.29-1024x350.png\" alt=\"\" class=\"wp-image-5973\" srcset=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.39.29-1024x350.png 1024w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.39.29-300x102.png 300w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.39.29-768x262.png 768w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.39.29-1536x524.png 1536w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.39.29-2048x699.png 2048w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.39.29-60x20.png 60w, https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.39.29-150x51.png 150w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>If you manually add the indices here and reload http:\/\/127.0.0.1:8000, you will see them. I&#8217;ve developed the app to automatically populate the data using API data from EODHD APIs.<\/p>\n\n\n\n<p>You will notice that I only registered \u201cSp global indices\u201d in the admin interface \u201ceodhd_apis\/spglobal\/admin.py\u201d. The reason for this is the index list is static as the app runs. The constituents however changes depending on what is being viewed. I initially was adding the data to the model, but it makes the app unnecessarily slow for no good reason. The API data is not coded to store to the model, and as the model is empty, it doesn&#8217;t make sense to see it in the admin interface.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2>\n\n\n\n<p>This Python Django application can be further enhanced to include many more EODHD APIs endpoints. The fundamentals data could be an interesting addition. It may also be interesting to be able to browse through historical data using a selectable timeframe.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python Django is a high-level framework designed to facilitate the rapid development of web applications. I frequently work with Python, and when I opt for a framework, I typically choose Flask due to its flexibility, which allows me to build solutions with fewer restrictions. In contrast, Django is more opinionated, promoting a highly structured approach [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":5971,"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":[30],"ready-to-go-solution":[],"qualification":[31],"financial-apis-category":[36],"financial-apis-manuals":[81],"class_list":["post-5915","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-building-stocks-apps-examples","coding-language-python","qualification-experienced","financial-apis-category-stock-market-prices","financial-apis-manuals-stock-market-screener","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>Build a Financial Trading Dashboard with Python Django | EODHD APIs Academy<\/title>\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\/build-a-financial-trading-dashboard-with-python-django\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Build a Financial Trading Dashboard with Python Django\" \/>\n<meta property=\"og:description\" content=\"Python Django is a high-level framework designed to facilitate the rapid development of web applications. I frequently work with Python, and when I opt for a framework, I typically choose Flask due to its flexibility, which allows me to build solutions with fewer restrictions. In contrast, Django is more opinionated, promoting a highly structured approach [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django\" \/>\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=\"2024-10-14T07:54:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-05T14:42:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2788\" \/>\n\t<meta property=\"og:image:height\" content=\"2338\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\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\/build-a-financial-trading-dashboard-with-python-django#article\",\"isPartOf\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django\"},\"author\":{\"name\":\"Michael Whittle\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/50784c270b6267df5969514d80d510ad\"},\"headline\":\"Build a Financial Trading Dashboard with Python Django\",\"datePublished\":\"2024-10-14T07:54:45+00:00\",\"dateModified\":\"2025-02-05T14:42:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django\"},\"wordCount\":1221,\"publisher\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#organization\"},\"image\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15.png\",\"articleSection\":[\"Building Stocks Apps Examples\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django\",\"name\":\"Build a Financial Trading Dashboard with Python Django | EODHD APIs Academy\",\"isPartOf\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django#primaryimage\"},\"image\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15.png\",\"datePublished\":\"2024-10-14T07:54:45+00:00\",\"dateModified\":\"2025-02-05T14:42:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django#primaryimage\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15.png\",\"contentUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15.png\",\"width\":2788,\"height\":2338},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/eodhd.com\/financial-academy\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build a Financial Trading Dashboard with Python Django\"}]},{\"@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":"Build a Financial Trading Dashboard with Python Django | EODHD APIs Academy","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\/build-a-financial-trading-dashboard-with-python-django","og_locale":"en_US","og_type":"article","og_title":"Build a Financial Trading Dashboard with Python Django","og_description":"Python Django is a high-level framework designed to facilitate the rapid development of web applications. I frequently work with Python, and when I opt for a framework, I typically choose Flask due to its flexibility, which allows me to build solutions with fewer restrictions. In contrast, Django is more opinionated, promoting a highly structured approach [&hellip;]","og_url":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django","og_site_name":"Financial Academy","article_publisher":"https:\/\/www.facebook.com\/eodhistoricaldata","article_published_time":"2024-10-14T07:54:45+00:00","article_modified_time":"2025-02-05T14:42:13+00:00","og_image":[{"width":2788,"height":2338,"url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15.png","type":"image\/png"}],"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\/build-a-financial-trading-dashboard-with-python-django#article","isPartOf":{"@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django"},"author":{"name":"Michael Whittle","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/50784c270b6267df5969514d80d510ad"},"headline":"Build a Financial Trading Dashboard with Python Django","datePublished":"2024-10-14T07:54:45+00:00","dateModified":"2025-02-05T14:42:13+00:00","mainEntityOfPage":{"@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django"},"wordCount":1221,"publisher":{"@id":"https:\/\/eodhd.com\/financial-academy\/#organization"},"image":{"@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django#primaryimage"},"thumbnailUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15.png","articleSection":["Building Stocks Apps Examples"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django","url":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django","name":"Build a Financial Trading Dashboard with Python Django | EODHD APIs Academy","isPartOf":{"@id":"https:\/\/eodhd.com\/financial-academy\/#website"},"primaryImageOfPage":{"@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django#primaryimage"},"image":{"@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django#primaryimage"},"thumbnailUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15.png","datePublished":"2024-10-14T07:54:45+00:00","dateModified":"2025-02-05T14:42:13+00:00","breadcrumb":{"@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django#primaryimage","url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15.png","contentUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/10\/Screenshot-2024-10-09-at-21.36.15.png","width":2788,"height":2338},{"@type":"BreadcrumbList","@id":"https:\/\/eodhd.com\/financial-academy\/building-stocks-apps-examples\/build-a-financial-trading-dashboard-with-python-django#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/eodhd.com\/financial-academy\/"},{"@type":"ListItem","position":2,"name":"Build a Financial Trading Dashboard with Python Django"}]},{"@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\/2024\/10\/Screenshot-2024-10-09-at-21.36.15.png","jetpack_shortlink":"https:\/\/wp.me\/pdOdVT-1xp","jetpack_sharing_enabled":true,"acf":[],"_links":{"self":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/5915","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=5915"}],"version-history":[{"count":46,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/5915\/revisions"}],"predecessor-version":[{"id":6329,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/5915\/revisions\/6329"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/media\/5971"}],"wp:attachment":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/media?parent=5915"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/categories?post=5915"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/tags?post=5915"},{"taxonomy":"coding-language","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/coding-language?post=5915"},{"taxonomy":"ready-to-go-solution","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/ready-to-go-solution?post=5915"},{"taxonomy":"qualification","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/qualification?post=5915"},{"taxonomy":"financial-apis-category","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/financial-apis-category?post=5915"},{"taxonomy":"financial-apis-manuals","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/financial-apis-manuals?post=5915"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}