Stock Exchange API

The Stock Exchange API provides comprehensive information about over 100 markets around the world, including trading hours, location details, and number of listings.

/v1/stockexchange GET

https://api.api-ninjas.com/v1/stockexchange

Returns detailed information about stock exchanges matching the specified criteria. At least one parameter is required.

To get a list of all available stock exchanges, use the /v1/allstockexchanges endpoint.


Parameters

  • mic  optional

    Market Identifier Code (e.g., XNYS).

  • name  optional

    Stock exchange name (supports partial matching).

  • city  optional

    City where the exchange is located.

  • country  optional

    Country code in ISO2 format (e.g., US).

Headers

  • X-Api-Key  required

    API Key associated with your account.

Sample Request Live Demo!

mic
https://api.api-ninjas.com/v1/stockexchange?mic=XNYS

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 [ { "mic": "XNYS", "name": "New York Stock Exchange", "city": "New York City", "country": "United States", "iso2": "US", "description": "The largest stock exchange in the world by market capitalization, facilitating trading in a wide range of securities.", "address": "11 Wall Street, New York, NY 10005, USA", "website": "https://www.nyse.com", "founded": "1792-05-17", "num_listings": 2223, "market_cap_usd": 28330000000000, "currency": "USD", "timezone": "America/New_York", "market_open": "09:30", "market_close": "16:00" } ]

Code Examples

1 2 3 4 5 6 7 import requests api_url = 'https://api.api-ninjas.com/v1/stockexchange?mic=XNYS&country=US' response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'}) if response.status_code == requests.codes.ok: print(response.text) else: print("Error:", response.status_code, response.text)

If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.

/v1/allstockexchanges GETDeveloper and Business tier only

https://api.api-ninjas.com/v1/allstockexchanges

Returns a list of all available stock exchanges and their details.


Parameters

This endpoint does not accept any parameters.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Sample Request

1 https://api.api-ninjas.com/v1/allstockexchanges
JSON
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 [ { "mic": "XASX", "name": "Australian Securities Exchange", "city": "Sydney", "country": "Australia", "iso2": "AU", "description": "The primary securities exchange in Australia, offering a range of services including listings, trading, clearing, and settlement.", "address": "20 Bridge Street, Sydney NSW 2000, Australia", "website": "https://www.asx.com.au", "founded": "1987-04-01", "num_listings": 2187, "market_cap": 1868081480000, "currency": "AUD", "timezone": "Australia/Sydney", "market_open": "10:00", "market_close": "16:00" }, { "mic": "XNYS", "name": "New York Stock Exchange", "city": "New York City", "country": "United States", "iso2": "US", "description": "The largest stock exchange in the world by market capitalization, facilitating trading in a wide range of securities.", "address": "11 Wall Street, New York, NY 10005, USA", "website": "https://www.nyse.com", "founded": "1792-05-17", "num_listings": 2223, "market_cap_usd": 28330000000000, "currency": "USD", "timezone": "America/New_York", "market_open": "09:30", "market_close": "16:00" }, "..." ]