Before we will start talking about Simple Moving Average, Weighted Moving Average and Exponential Moving Average (SMA, WMA and EMA), we need to understand what a moving average exactly is. The moving average is a calculation to analyze data points by creating a series of averages of different selections of the full data set. 

SMA is normally taken from an equal number of data on either side of a central value. This ensures that variations in the mean are aligned with the variations in the data rather than being shifted in time.

WMA is an average that has multiplying factors to give different weights to data at different positions in the sample window. 

EMA is a first-order infinite impulse response filter that applies weighting factors which decrease exponentially. The weights for older dates decrease exponentially, never reaching zero. 

Register & Get Data

Please note: before continuing to work with our APIs, make sure that you import and install all required libraries. A more detailed information about the functions of SMA, WMA and EMA of the Technical Indicators API can be found on our documentation web-page.

Accessing the EODHD API

To access the API, we need to create an instance of the “APIClient” class and pass to it our API key. In this example, we will use the demo API key provided by EODHD, but in your real application, you should use your registered API key.

api = APIClient("demo")

You can also specify the API key in a configuration file as it described in the library documentation here.

1. Use the “DEMO” API key to test our data from a limited set of the tickers without registering:
Real-Time Data and All of the APIs (except Bulk) are included without limitations on API calls.
2. Register to get your free API key (limitated by 20 API calls per day) with access to:
End-Of-Day Historical Data with only past year for any ticker and List of tickers per Exchange.
3. To unlock your API key we recommend to choose subscription which covers your needs.

Exploring the moving averages of the Technical Indicators API

The next step is to start requesting SMA, WMA and EMA data from the Technical Indicators API.

simple_ma = api.get_technical_indicator_data(ticker = "AAPL.US", function = "sma") # for SMA
weighted_ma = api.get_technical_indicator_data(ticker = "AAPL.US", function = "wma") # for WMA
exponential_ma = api.get_technical_indicator_data(ticker = "AAPL.US", function = "ema") # for EMA

The API response will be a single JSON structure.

Converting the JSON Response to a DataFrame

To convert JSON to DataFrame, it is possible to use the following code. All data in the DataFrame will contain information such as date and the column corresponding to the parameter that you call in the function. All given information will be available for stock symbol, which was used when we called API, in particular (“AAPL.US”).

sma = pd.DataFrame(simple_ma)
print(sma) # for SMA
wma = pd.DataFrame(weighted_ma)
print(wma) # for WMA
ema = pd.DataFrame(exponential_ma)
print(ema) # for EMA

Extended parameters

For a more accurate research, it is possible to use parameters that lays in Moving Average functions. For all three function is available one parameter, named period. It is the number of data points used to calculate each simple moving average value. Valid range from 2 to 100000 with the default value – 50.

sma_extended = api.get_technical_indicator_data(ticker = "AAPL.US", function = "sma", period = 100)
sma_e = pd.DataFrame(sma_extended)


We’ve explored the essential concepts of SMA, WMA, and EMA as integral components of our Technical Indicators API. These moving averages provide unique methods of analyzing stock data, and we’ve discussed how to access and utilize this information. Now you have the flexibility to fine-tune your analysis for a more accurate research in the dynamic world of stock trading.

Register & Get Data