Retrieving Exchange Listings with the Intelligent EOD Stock Market API

EOD Stock API Intelligent EOD Stock Market API is a powerful tool for accessing stock market data. In this tutorial, we will be using Python to retrieve exchange listings from the API.

Prerequisites

Before we get started, you'll need to ensure that you have Python 3.7+ installed on your system.

You'll also need to have the requests library installed. If you don't already have it installed, you can do so by running the following command:

pip install requests

Retrieving Exchange Listings

To retrieve exchange listings from the Intelligent EOD Stock Market API, we will be using the /exchanges endpoint. Here's an example of how you can use the requests library to make a GET request to this endpoint:

import requests

url = 'https://gateway.eod-stock-api.site/api/v1/exchanges'
headers = {
    'Content-Type': 'application/json'
}

params = {'api_key': 'API KEY HERE'}
response = requests.get(url, headers=headers, params=params)

print(response.json())

In this example, we first import the requests library, and then define the url, headers, and params variables. Note that you will need to replace API KEY HERE with your actual API key.

We then make a GET request to the /exchanges endpoint using the requests.get() method, passing in the url, headers, and params variables as arguments.

Finally, we print the response from the API using the response.json() method.

When you run this code, you should see a response that looks something like this:

{
    "message": "Exchange listings returned",
    "payload": [
        {
            "code": "BA",
            "country": "Argentina",
            "currency_symbol": "ARS",
            "exchange_id": "RP5zfbmYel63f0Wc",
            "name": "Buenos Aires Exchange",
            "operating_mic": "XBUE"
        },
        {
            "code": "AU",
            "country": "Australia",
            "currency_symbol": "AUD",
            "exchange_id": "Tl2hlbpejIQflm94",
            "name": "Australia Exchange",
            "operating_mic": "XASX"
        },
        ...
    ],
    "status": true
}

The payload field in the response contains a list of exchange listings, with each listing represented as a dictionary. Each dictionary contains information about the exchange, such as its name, country, and currency_symbol.

Conclusion

In this tutorial, we've learned how to use Python and the Intelligent EOD Stock Market API to retrieve exchange listings. Armed with this knowledge, you can now start exploring the API further to retrieve other types of stock market data.

Developer Guide Articles

Related Articles & Resources