{"id":5228,"date":"2024-03-20T15:21:50","date_gmt":"2024-03-20T15:21:50","guid":{"rendered":"https:\/\/eodhd.com\/financial-academy\/?p=5228"},"modified":"2025-02-05T12:50:56","modified_gmt":"2025-02-05T12:50:56","slug":"using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python","status":"publish","type":"post","link":"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python","title":{"rendered":"Using Delisted Stocks for Backtesting a 3-EMA Strategy with Python"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"400\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/Backtesting_the_3_EMA_Strategy_on_Delisted_Stocks_with_Python-1.jpg\" alt=\"\" class=\"wp-image-5230\" style=\"width:837px;height:auto\"\/><\/figure>\n<\/div>\n\n\n<p>The Exponential Moving Average (EMA) is one of the most widely used technical indicators in the trading world, yet in most cases, it is not used to its full potential. People are still using generic strategies like the EMA 50 &amp; 200 crossover which is not a bad thing but since it&#8217;s overused by a lot of traders, its commonality has deteriorated the strategy&#8217;s efficiency. Today, we are going to explore a new EMA crossover strategy and check if it beats the market by outperforming the results of the buy\/hold strategy. <\/p>\n\n\n\n<p>But there&#8217;s a catch. We&#8217;re going to backtest the strategy on delisted stocks. Why? Because the price movements of delisted stocks are more volatile than of listed stocks, giving us an opportunity to test our strategy in all types of market scenarios.<\/p>\n\n\n\n<p>In this article, we will first extract the historical data of delisted stocks using <a href=\"https:\/\/eodhd.com\/financial-apis\/api-for-historical-data-and-volumes\/\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD&#8217;s end-of-day data API endpoint<\/a>, then we&#8217;ll extract the EMA data using <a href=\"https:\/\/eodhd.com\/financial-apis\/technical-indicators-api\/\">EODHD&#8217;s technical indicator API<\/a>, and followed by that, we&#8217;ll construct the trading strategy and backtest it on a delisted stock. We will also compare the results of our EMA crossover strategy with that of the buy\/hold strategy for validation.<\/p>\n\n\n\n<p>With that said, let&#8217;s dive into the article!<\/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-the-trading-strategy\">The Trading Strategy <\/h2>\n\n\n\n<p>Before actually moving on to coding the trading strategy, it&#8217;s very essential to gain some background on our EMA crossover trading strategy. Our strategy consists of three EMAs with different lookback periods, and it generates signals based on certain crossover criteria.<\/p>\n\n\n\n<p>The following are the mechanics of our strategy:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>We enter the market if: <\/strong>EMA 10 crosses above EMA 30 and EMA 10 is greater than EMA 50<\/li>\n\n\n\n<li><strong>We exit the market if: <\/strong>EMA 10 crosses below EMA 30 and EMA 9 is lower than EMA 50<\/li>\n<\/ol>\n\n\n\n<p id=\"a07c\">This is a simple yet effective crossover strategy that helps in capturing the direction of the price movements and provides trading signals accordingly. <\/p>\n\n\n\n<p id=\"a07c\">Now that we have a good background of the trading strategy that we\u2019re going to implement, let\u2019s move on to the coding part to transform this idea into an actual useful strategy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"dce9\">Importing Packages<\/h2>\n\n\n\n<p id=\"730e\">The first and foremost step is to import all the required packages into our Python environment. In this article, we\u2019ll be using four packages which are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Pandas \u2014 for data formatting, clearing, manipulating, and other related purposes<\/li>\n\n\n\n<li>Matplotlib \u2014 for creating charts and different kinds of visualizations<\/li>\n\n\n\n<li>eodhd \u2014 for extracting historical and technical indicator data<\/li>\n\n\n\n<li>Termcolor \u2014 to customize the standard output shown in Jupyter notebook<\/li>\n\n\n\n<li>Math \u2014 for various mathematical functions and operations<\/li>\n<\/ul>\n\n\n\n<p id=\"cca1\">The following code imports all the above-mentioned packages into our Python environment:<\/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-58a72b42018378ffa3a0335a97aa46d5\"><code lang=\"python\" class=\"language-python\"># IMPORTING PACKAGES\n\nimport pandas as pd\nfrom eodhd import APIClient\nimport math\nfrom termcolor import colored as cl\nimport matplotlib.pyplot as plt\n\nplt.rcParams['figure.figsize'] = (20,10)\nplt.style.use('fivethirtyeight')<\/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 id=\"ff74\">If you haven\u2019t installed any of the imported packages, make sure to do so using the&nbsp;pip&nbsp;command in your terminal.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-api-key-activation\">API Key Activation<\/h2>\n\n\n\n<p id=\"c710\">The second step in this process of using the stock screener API to build custom screeners is API key activation. Screener API is included in two of our <a href=\"https:\/\/eodhd.com\/pricing\">plans<\/a>:  <strong>All-in-one<\/strong> and <strong>EOD+Intraday<\/strong>.<\/p>\n\n\n\n<p id=\"c710\">If you don\u2019t have an EODHD API key, head over to our <a href=\"https:\/\/eodhd.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">website<\/a> and finish the&nbsp;<a href=\"https:\/\/eodhd.com\/register\" target=\"_blank\" rel=\"noreferrer noopener\">registration<\/a>&nbsp;process to create an EODHD account, and finally, navigate to the \u2018<a href=\"https:\/\/eodhd.com\/cp\/settings\" target=\"_blank\" rel=\"noreferrer noopener\">Settings<\/a>\u2019 page where you can find your secret EODHD API key. It is important to ensure that this secret API key is not revealed to anyone. <\/p>\n\n\n\n<p id=\"c710\">You can activate the API key by following this code:<\/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-9c34329c608cf1cc711952b292a68edb\"><code lang=\"python\" class=\"language-python\"># API KEY ACTIVATION\n\napi_key = '&lt;YOUR API KEY&gt;'\nclient = APIClient(api_key)<\/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 id=\"fd3d\">The code is pretty simple. In the first line, we are storing the secret EODHD API key in the&nbsp;api_key variable,&nbsp;and then in the second line, we are using the&nbsp;APIClient&nbsp;class provided by the&nbsp;eodhd&nbsp;package to activate the API key and stored the response in the&nbsp;client&nbsp;variable.<\/p>\n\n\n\n<p id=\"4634\">Note that you need to replace&nbsp;&lt;YOUR API KEY&gt;&nbsp;with your secret EODHD API key. Apart from directly storing the API key with text, there are other ways for better security such as utilizing environmental variables, and so on.<\/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<h2 class=\"wp-block-heading\" id=\"h-getting-the-list-of-delisted-stocks\">Getting the list of Delisted Stocks<\/h2>\n\n\n\n<p>Now let&#8217;s extract the list of available delisted stocks on EODHD. In order to do that, we can utilize the &#8220;get_list_of_tickers&#8221; function provided by the eodhd package. The following code extracts the list of delisted stocks:<\/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-2ebccb79dbde5e2fefafaa3b2cdd3935\"><code lang=\"python\" class=\"language-python\"># GETTING LIST OF DELISTED STOCKS\n\ntickers = client.get_list_of_tickers(delisted = 1, code = 'NASDAQ')\ntickers_df = pd.DataFrame(tickers)\n\ntickers_df = tickers_df.fillna('None')\ntickers_df = tickers_df[tickers_df.Isin != 'None']\ntickers_df<\/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>The function &#8220;get_list_of_tickers&#8221; has two parameters. First is &#8220;delisted&#8221; which is 1 if we want the delisted stocks or 0 if we want listed stocks. The next parameter is &#8220;code&#8221; where we should specify the exchange we&#8217;re interested in.<\/p>\n\n\n\n<p>After extracting the list of tickers, we convert the response into a Pandas dataframe. This is the final output after performing some data manipulations:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1529\" height=\"689\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/tickers_list.png\" alt=\"\" class=\"wp-image-5252\"\/><\/figure>\n\n\n\n<p>One thing that I truly love about this function is that it not only gives out the list of tickers but also some additional information like the stock&#8217;s name, exchange, current, type, etc. which can come really handy in a lot of cases.<\/p>\n\n\n<subscribe-form>\n    <form class=\"subscribeForm\" action=\"\/academy-subscribe\" method=\"post\">\n        <div class=\"subscribeForm__text\" for=\"subscribeEmail\">\n            <span class=\"subscribeForm__h\">\n                Do you enjoy our articles?\n            <\/span>\n            <p class=\"subscribeForm__p\">\n                We can send new ones right to your email box\n            <\/p>\n        <\/div>\n        <div class=\"subscribe__fields\">\n            <label class=\"subscribeForm__inputLabel\">\n                <input class=\"subscribeForm__input\" name=\"email\" type=\"email\" placeholder=\"Email\" required>\n                <p class=\"subscribe__error\"><\/p>\n            <\/label>\n            <button class=\"orange subscribeForm__btn\">Subscribe<\/button>\n        <\/div>\n        <div class=\"subscribe__success\">\n            You are subscribed!\n        <\/div>\n    <\/form>\n<\/subscribe-form>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-extracting-historical-data\">Extracting Historical Data<\/h2>\n\n\n\n<p>The delisted stock that we&#8217;re going to focus on here for backtesting our strategy is AveXis, currently known as Novartis Gene Therapies. It was a biotechnology company based in Dallas, Texas. It was founded in 2012 and acquired by Novartis in 2018. The following code uses <a href=\"https:\/\/eodhd.com\/financial-apis\/api-for-historical-data-and-volumes\/\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD&#8217;s end-of-day data API endpoint<\/a> to extract the historical data of AveXis:<\/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-4c1866c79f8ebecc4ae9c47dfeafe73f\"><code lang=\"python\" class=\"language-python\"># EXTRACTING HISTORICAL DATA\n\nhist_json = client.get_eod_historical_stock_market_data(symbol = 'AVXS.US', period = 'd')\ndf = pd.DataFrame(hist_json)\ndf = df.set_index('date')\n\ndf<\/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>There is nothing complicated going on with this code. In the first line, we are using the &#8220;get_eod_historical_stock_market_data&#8221; function provided by the eodhd package to extract the historical data of AveXis from 2016 (the year it went public).<\/p>\n\n\n\n<p>In the following lines, we are converting the JSON response into a Pandas dataframe along with some data preprocessing. This is the final output of the code:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1133\" height=\"649\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/avexis_historical_df.png\" alt=\"\" class=\"wp-image-5256\"\/><\/figure>\n\n\n\n<p>The data spans just over two years which is because of the fact that the stock was traded only for a short period of time before it was acquired.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-extracting-ema-values\">Extracting EMA Values<\/h2>\n\n\n\n<p>While some people prefer to calculate the EMA values by hard-coding the mathematical formulas, we&#8217;re going to follow another route of obtaining the EMA values through APIs. In order to do that, we&#8217;re going to use <a href=\"https:\/\/eodhd.com\/financial-apis\/technical-indicators-api\/\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD&#8217;s technical indicator API endpoint<\/a>. The following code uses this specific endpoint to get the EMA values of AveXis:<\/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-3a0fd73d67cc61d0c1a4c698a3d6880e\"><code lang=\"python\" class=\"language-python\"># EXTRACTING EMA DATA\n\nema10 = pd.DataFrame(client.get_technical_indicator_data(ticker = 'AVXS.US', function = 'ema', period = 10)).set_index('date').rename(columns = {'ema':'ema10'})\nema30 = pd.DataFrame(client.get_technical_indicator_data(ticker = 'AVXS.US', function = 'ema', period = 30)).set_index('date').rename(columns = {'ema':'ema30'})\nema50 = pd.DataFrame(client.get_technical_indicator_data(ticker = 'AVXS.US', function = 'ema', period = 50)).set_index('date').rename(columns = {'ema':'ema50'})\nadj_close = df[['adjusted_close']]\n\navxs_df = ema50.join([ema10, ema30, adj_close])\navxs_df.index = pd.to_datetime(avxs_df.index)\n\navxs_df.tail()<\/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>The code might look a little fuzzy, but it&#8217;s quite simple. In the first three lines, we are extracting the EMA values with different lookback periods. Each is stored in three different dataframes and finally, we combine all of them along with the stock&#8217;s adjusted close into a single dataframe and this is the final output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1399\" height=\"581\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/avexis_ema_df.png\" alt=\"\" class=\"wp-image-5258\"\/><\/figure>\n\n\n\n<p>Now that we have all the required data, let&#8217;s move on to constructing and backtesting our 3-EMA crossover trading strategy. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-backtesting-the-strategy\">Backtesting the Strategy<\/h2>\n\n\n\n<p id=\"8298\">Here comes the most important and interesting part of the article, the backtesting of our trading strategy. The following code implements a very simple backtesting system and reveals the results of our trading strategy:<\/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-789d03fad7af22253b49c1b9a5c2788e\"><code lang=\"python\" class=\"language-python\"># BACKTESTING THE STRATEGY\n\ndef implement_strategy(df, investment):\n    \n    in_position = False\n    equity = investment\n    \n    for i in range(1, len(df)):\n        if df['ema10'][i-1] &lt; df['ema30'][i-1] and df['ema10'][i] &gt; df['ema30'][i] and df['ema10'][i] &gt; df['ema50'][i] and in_position == False:\n            no_of_shares = math.floor(equity\/df.adjusted_close[i])\n            equity -= (no_of_shares * df.adjusted_close[i])\n            in_position = True\n            print(cl('BUY: ', color = 'green', attrs = ['bold']), f'{no_of_shares} Shares are bought at ${df.adjusted_close[i]} on {str(df.index[i])[:10]}')\n        elif df['ema10'][i-1] &gt; df['ema30'][i-1] and df['ema10'][i] &lt; df['ema30'][i] and df['ema10'][i] &lt; df['ema50'][i] and in_position == True:\n            equity += (no_of_shares * df.adjusted_close[i])\n            in_position = False\n            print(cl('SELL: ', color = 'red', attrs = ['bold']), f'{no_of_shares} Shares are bought at ${df.adjusted_close[i]} on {str(df.index[i])[:10]}')\n    if in_position == True:\n        equity += (no_of_shares * df.adjusted_close[i])\n        print(cl(f'\\nClosing position at {df.adjusted_close[i]} on {str(df.index[i])[:10]}', attrs = ['bold']))\n        in_position = False\n\n    earning = round(equity - investment, 2)\n    roi = round(earning \/ investment * 100, 2)\n    \n    print('')\n    print(cl(f'EARNING: ${earning} ; ROI: {roi}%', attrs = ['bold']))\n    \nimplement_strategy(avxs_df, 100000)<\/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 id=\"d437\">I\u2019m not going to dive deep into the dynamics of this code as it will take some time to explain it. Basically, the program executes the trades based on the conditions that are satisfied. It enters the market when our entry condition is satisfied and exits when the exit condition is satisfied. These are the trades executed by our program followed by the backtesting results:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1432\" height=\"423\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/strategy_trades.png\" alt=\"\" class=\"wp-image-5260\" style=\"width:840px;height:auto\"\/><\/figure>\n\n\n\n<p>The results are pretty interesting. Over the course of two years, our program executed only three trades in total. This is both a good thing as well as a bad thing. But it all comes down to the returns of our strategy. Our 3-EMA trading strategy generated $664K with an ROI of 664.83%. This is some great news!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-buy-hold-returns-comparison\">Buy\/Hold Returns Comparison<\/h2>\n\n\n\n<p id=\"0126\">A good trading strategy should not just be able to generate profitable returns but must be efficient enough to outperform the buy\/hold strategy. To those who don\u2019t know what the buy\/hold strategy is, it\u2019s a strategy where the trader buys and holds the stock no matter what the circumstance is for a longer period.<\/p>\n\n\n\n<p id=\"5fd2\">If our strategy beats the buy\/hold strategy, we can confidently say that we came up with a good trading strategy that is almost ready to be deployed in the real world. Whereas, if it fails to do so, we either have to make some pretty good amount of changes to the strategy or scrap it entirely. So basically, this step is going to decide if we should move further with our strategy or not.<\/p>\n\n\n\n<p id=\"1fbf\">The following code implements the buy\/hold strategy and calculates the returns:<\/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-2e57154dee8c375d0e0e540972d78541\"><code lang=\"python\" class=\"language-python\"># BUY\/HOLD STRATEGY RETURNS\n\nbh_roi = round(list(avxs_df['adjusted_close'].pct_change().cumsum())[-1],4)*100\nprint(cl(f'BUY\/HOLD STRATEGY ROI: {round(bh_roi,2)}%', attrs = ['bold']))<\/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 id=\"00cd\">The code follows the simple mathematics behind calculating the stock returns for the given data and this is the output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"796\" height=\"94\" src=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/bh_strat_returns.png\" alt=\"\" class=\"wp-image-5262\"\/><\/figure>\n\n\n\n<p id=\"18e0\">After comparing the results of the buy\/hold strategy and our 3-EMA strategy, we outperformed the former with a difference of 381% in terms of ROI. That\u2019s amazing! It\u2019s almost 2.3x the returns of the buy\/hold strategy. Now it\u2019s pretty confident to say that we have indeed made a good solid trading strategy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2>\n\n\n\n<p>To summarize, we started off by extracting the list of delisted stocks provided by EODHD and chose a stock to backtest our trading strategy. Then we obtained the historical data and the EMA values with different lookback periods of that stock using <a href=\"https:\/\/eodhd.com\/financial-apis\/api-for-historical-data-and-volumes\/\" target=\"_blank\" rel=\"noreferrer noopener\">EODHD&#8217;s end-of-day API endpoint<\/a> and <a href=\"https:\/\/eodhd.com\/financial-apis\/technical-indicators-api\/\" target=\"_blank\" rel=\"noreferrer noopener\">technical indicator API endpoint<\/a> respectively. After acquiring the required data, we proceeded with constructing and backtesting our 3-EMA trading strategy. Finally, we compared the results of our trading strategy with that of the buy\/hold strategy to validate its efficiency.<\/p>\n\n\n\n<p>There is still a lot of scope for improvement which is not touched upon in this article. For example, a proper risk management system can be put in place for a more systematic trading approach. Another example would be using ML models to tune the parameters of the strategy and find the most optimal ones. Even though these are not practically explained in this article, it is very much recommended to check them out. If you want to deploy the strategy, these things can become mandatory.<\/p>\n\n\n\n<p>With that said, you&#8217;ve reached the end of the article. Hope you learned something new and useful today. Thank you very much for your time.<\/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<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Exponential Moving Average (EMA) is one of the most widely used technical indicators in the trading world, yet in most cases, it is not used to its full potential. People are still using generic strategies like the EMA 50 &amp; 200 crossover which is not a bad thing but since it&#8217;s overused by a [&hellip;]<\/p>\n","protected":false},"author":18,"featured_media":5230,"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":[65],"tags":[86,89,88,90],"coding-language":[30],"ready-to-go-solution":[56],"qualification":[31,32],"financial-apis-category":[36],"financial-apis-manuals":[39,47],"class_list":["post-5228","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-backtesting-strategies-examples","tag-delisted-stocks","tag-eod-delisted-stocks-data","tag-historical-prices-delisted","tag-trading-strategy","coding-language-python","ready-to-go-solution-eodhd-python-financial-library","qualification-experienced","qualification-guru","financial-apis-category-stock-market-prices","financial-apis-manuals-end-of-day","financial-apis-manuals-exchanges-data","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>Using Delisted Stocks for Backtesting a 3-EMA Strategy with Python | EODHD APIs Academy<\/title>\n<meta name=\"description\" content=\"A comprehensive study on backtesting a powerful EMA strategy on delisted stocks and validating its performance through comparative analysis\" \/>\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\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Delisted Stocks for Backtesting a 3-EMA Strategy with Python\" \/>\n<meta property=\"og:description\" content=\"A comprehensive study on backtesting a powerful EMA strategy on delisted stocks and validating its performance through comparative analysis\" \/>\n<meta property=\"og:url\" content=\"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-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=\"2024-03-20T15:21:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-05T12:50:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/Backtesting_the_3_EMA_Strategy_on_Delisted_Stocks_with_Python-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Nikhil Adithyan\" \/>\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=\"Nikhil Adithyan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python#article\",\"isPartOf\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python\"},\"author\":{\"name\":\"Nikhil Adithyan\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/67681e71050cf7d8d0efb91fee5f0402\"},\"headline\":\"Using Delisted Stocks for Backtesting a 3-EMA Strategy with Python\",\"datePublished\":\"2024-03-20T15:21:50+00:00\",\"dateModified\":\"2025-02-05T12:50:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python\"},\"wordCount\":1738,\"publisher\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#organization\"},\"image\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/Backtesting_the_3_EMA_Strategy_on_Delisted_Stocks_with_Python-1.jpg\",\"keywords\":[\"Delisted stocks\",\"EOD delisted stocks data\",\"Historical prices delisted\",\"Trading strategy\"],\"articleSection\":[\"Backtesting Strategies Examples\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python\",\"name\":\"Using Delisted Stocks for Backtesting a 3-EMA Strategy with Python | EODHD APIs Academy\",\"isPartOf\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python#primaryimage\"},\"image\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/Backtesting_the_3_EMA_Strategy_on_Delisted_Stocks_with_Python-1.jpg\",\"datePublished\":\"2024-03-20T15:21:50+00:00\",\"dateModified\":\"2025-02-05T12:50:56+00:00\",\"description\":\"A comprehensive study on backtesting a powerful EMA strategy on delisted stocks and validating its performance through comparative analysis\",\"breadcrumb\":{\"@id\":\"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python#primaryimage\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/Backtesting_the_3_EMA_Strategy_on_Delisted_Stocks_with_Python-1.jpg\",\"contentUrl\":\"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/Backtesting_the_3_EMA_Strategy_on_Delisted_Stocks_with_Python-1.jpg\",\"width\":600,\"height\":400,\"caption\":\"Backtesting the 3-EMA Strategy on Delisted Stocks with Python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/eodhd.com\/financial-academy\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Delisted Stocks for Backtesting a 3-EMA Strategy 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\/67681e71050cf7d8d0efb91fee5f0402\",\"name\":\"Nikhil Adithyan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/eb53ce41bde412555cee22b8b4c09c2ff51625fff05ba3696b20cac7a7c0d938?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/eb53ce41bde412555cee22b8b4c09c2ff51625fff05ba3696b20cac7a7c0d938?s=96&d=mm&r=g\",\"caption\":\"Nikhil Adithyan\"},\"description\":\"Founder at BacktestZone | Streamlit Student Ambassador | FinTech &amp; Quantitative Finance enthusiast\",\"url\":\"https:\/\/eodhd.com\/financial-academy\/author\/nikhiladithyan\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Using Delisted Stocks for Backtesting a 3-EMA Strategy with Python | EODHD APIs Academy","description":"A comprehensive study on backtesting a powerful EMA strategy on delisted stocks and validating its performance through comparative analysis","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\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python","og_locale":"en_US","og_type":"article","og_title":"Using Delisted Stocks for Backtesting a 3-EMA Strategy with Python","og_description":"A comprehensive study on backtesting a powerful EMA strategy on delisted stocks and validating its performance through comparative analysis","og_url":"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python","og_site_name":"Financial Academy","article_publisher":"https:\/\/www.facebook.com\/eodhistoricaldata","article_published_time":"2024-03-20T15:21:50+00:00","article_modified_time":"2025-02-05T12:50:56+00:00","og_image":[{"width":600,"height":400,"url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/Backtesting_the_3_EMA_Strategy_on_Delisted_Stocks_with_Python-1.jpg","type":"image\/png"}],"author":"Nikhil Adithyan","twitter_card":"summary_large_image","twitter_creator":"@EOD_data","twitter_site":"@EOD_data","twitter_misc":{"Written by":"Nikhil Adithyan","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python#article","isPartOf":{"@id":"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python"},"author":{"name":"Nikhil Adithyan","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/67681e71050cf7d8d0efb91fee5f0402"},"headline":"Using Delisted Stocks for Backtesting a 3-EMA Strategy with Python","datePublished":"2024-03-20T15:21:50+00:00","dateModified":"2025-02-05T12:50:56+00:00","mainEntityOfPage":{"@id":"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python"},"wordCount":1738,"publisher":{"@id":"https:\/\/eodhd.com\/financial-academy\/#organization"},"image":{"@id":"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python#primaryimage"},"thumbnailUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/Backtesting_the_3_EMA_Strategy_on_Delisted_Stocks_with_Python-1.jpg","keywords":["Delisted stocks","EOD delisted stocks data","Historical prices delisted","Trading strategy"],"articleSection":["Backtesting Strategies Examples"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python","url":"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python","name":"Using Delisted Stocks for Backtesting a 3-EMA Strategy with Python | EODHD APIs Academy","isPartOf":{"@id":"https:\/\/eodhd.com\/financial-academy\/#website"},"primaryImageOfPage":{"@id":"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python#primaryimage"},"image":{"@id":"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python#primaryimage"},"thumbnailUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/Backtesting_the_3_EMA_Strategy_on_Delisted_Stocks_with_Python-1.jpg","datePublished":"2024-03-20T15:21:50+00:00","dateModified":"2025-02-05T12:50:56+00:00","description":"A comprehensive study on backtesting a powerful EMA strategy on delisted stocks and validating its performance through comparative analysis","breadcrumb":{"@id":"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python#primaryimage","url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/Backtesting_the_3_EMA_Strategy_on_Delisted_Stocks_with_Python-1.jpg","contentUrl":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/Backtesting_the_3_EMA_Strategy_on_Delisted_Stocks_with_Python-1.jpg","width":600,"height":400,"caption":"Backtesting the 3-EMA Strategy on Delisted Stocks with Python"},{"@type":"BreadcrumbList","@id":"https:\/\/eodhd.com\/financial-academy\/backtesting-strategies-examples\/using-delisted-stocks-for-backtesting-a-3-ema-strategy-with-python#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/eodhd.com\/financial-academy\/"},{"@type":"ListItem","position":2,"name":"Using Delisted Stocks for Backtesting a 3-EMA Strategy 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\/67681e71050cf7d8d0efb91fee5f0402","name":"Nikhil Adithyan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eodhd.com\/financial-academy\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/eb53ce41bde412555cee22b8b4c09c2ff51625fff05ba3696b20cac7a7c0d938?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/eb53ce41bde412555cee22b8b4c09c2ff51625fff05ba3696b20cac7a7c0d938?s=96&d=mm&r=g","caption":"Nikhil Adithyan"},"description":"Founder at BacktestZone | Streamlit Student Ambassador | FinTech &amp; Quantitative Finance enthusiast","url":"https:\/\/eodhd.com\/financial-academy\/author\/nikhiladithyan"}]}},"jetpack_featured_media_url":"https:\/\/eodhd.com\/financial-academy\/wp-content\/uploads\/2024\/03\/Backtesting_the_3_EMA_Strategy_on_Delisted_Stocks_with_Python-1.jpg","jetpack_shortlink":"https:\/\/wp.me\/pdOdVT-1mk","jetpack_sharing_enabled":true,"acf":[],"_links":{"self":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/5228","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\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/comments?post=5228"}],"version-history":[{"count":19,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/5228\/revisions"}],"predecessor-version":[{"id":6269,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/posts\/5228\/revisions\/6269"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/media\/5230"}],"wp:attachment":[{"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/media?parent=5228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/categories?post=5228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/tags?post=5228"},{"taxonomy":"coding-language","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/coding-language?post=5228"},{"taxonomy":"ready-to-go-solution","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/ready-to-go-solution?post=5228"},{"taxonomy":"qualification","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/qualification?post=5228"},{"taxonomy":"financial-apis-category","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/financial-apis-category?post=5228"},{"taxonomy":"financial-apis-manuals","embeddable":true,"href":"https:\/\/eodhd.com\/financial-academy\/wp-json\/wp\/v2\/financial-apis-manuals?post=5228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}