Average Trading Volume refers to the number of shares of a particular stock that, on average, change hands during a single trading day. Significant deviations usually indicate greater or lesser buying or selling interest in the stock from large institutional investors.
These two functions return the Average Trading Volume and Avarage Trading Volume by Price on the Technical Indicator API. The average volume of a security over a longer period of time is the total amount traded in that period, divided by the length of the period.
- 1 Introduction
- 2 Accessing the EODHD API
- 3 Exploring the Average Volume and Average Volume by Price Data as part of the Technical Indicator API
- 4 Conclusion
Please note: before continuing to work with our APIs, make sure that you import and install all required libraries. More detailed information about Average Trading Volume and Average Trading Volume by Price function on Technical Indicator API can be found on our documentation web-page.
Accessing the EODHD API
To access the EODHD 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. In your application, you should use your registered API key.
api = APIClient("demo")
Please note that you can also specify the API key in a configuration file or as an environment variable, as 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:
AAPL.US | TSLA.US | VTI.US | AMZN.US | BTC-USD | EUR-USD
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 Average Volume and Average Volume by Price Data as part of the Technical Indicator API
After we are done with the API client, we can start requesting the Average Trading Volume and Average Trading Volume by Price data from the Technical Indicator API.
av = api.get_technical_indicator_data(ticker = "AAPL.US", function = "avgvol") # for average volume
avp = api.get_technical_indicator_data(ticker = "AAPL.US", function = "avgvolccy") # for average volume by price
The API response will be a single JSON structure.
Converting JSON Response to DataFrame
To convert JSON to DataFrame it is possible to use:
All data in DataFrame will contain information such as: “date” and “avgvol” or “avgvolccy” for stock symbol, which was used when we called API, in particular (“AAPL.US”)
c_av = pd.DataFrame(av) print(c_av) # for Average Volume
c_avp = pd.DataFrame(avp) print(c_avp) # for Average Volume by Price
Extended parameters of the Average Volume and Average Volume by Price functions from the Technical Indicator Data API
It is possible to use an additional parameter for the Average Trading Volume and Average Trading Volume by Price functions. The name of the parameter is period. Period is the number of data points used to calculate each average trading volume value.
av_extended = api.get_technical_indicator_data(ticker = "AAPL.US", function = "avgvol", period = 100) # for Average Volume
avp_extended = api.get_technical_indicator_data(ticker = "AAPL.US", function = "avgvolccy", period = 75) # for Average Volume by Price
The API response is a JSON array containing data for all the requested tickers. You can convert the resulting JSON array to a DataFrame for further analysis:
c_av_extended = pd.DataFrame(av_extended) print(c_av_extended) # for Average Volume
c_avp_extended = pd.DataFrame(avp_extended) print(c_avp_extended) # for Average Volume by Price
Understanding of Average Daily Trading Volume is a fundamental aspect of stock analysis. Our Technical Indicator API’s functions for Average Volume and Average Volume by Price empower you with accurate data to make informed decisions in the dynamic world of stock trading!