-
Notifications
You must be signed in to change notification settings - Fork 0
Exchanges
The Exchanges endpoint provides information about the stock exchanges supported by the Marketstack API. You can retrieve a list of all exchanges, search for specific ones, or get details for a particular exchange using its MIC code.
Use the exchanges() method on the Marketstack facade to access the Exchanges endpoint.
To get a list of all supported exchanges, you can make a simple call. Use limit() to control the number of results returned.
use Tigusigalpa\Marketstack\Facades\Marketstack;
$exchanges = Marketstack::exchanges()
->limit(50)
->collect();You can search for exchanges by name or other keywords using the search() method:
$searchResults = Marketstack::exchanges()
->search("NASDAQ")
->collect();To retrieve details for a specific exchange, use the mic() method with the exchange's Market Identifier Code (MIC):
$exchange = Marketstack::exchanges()
->mic("XNAS")
->dto();
echo "Name: {$exchange->name}\n";
echo "Country: {$exchange->country}\n";
echo "Website: {$exchange->website}";You can also retrieve all tickers for a specific exchange by chaining the tickers() method:
$tickers = Marketstack::exchanges()
->mic("XNAS")
->tickers()
->limit(100)
->collect();The following methods are available for the Exchanges endpoint:
| Method | Description |
|---|---|
search(string $search) |
Search for exchanges by a keyword. |
mic(string $mic) |
Get information for a specific exchange by its MIC code. |
tickers() |
Get all tickers for the specified exchange. |
limit(int $limit) |
The number of results to return. |
offset(int $offset) |
The pagination offset. |
For more information on response formats, see the Response Formats page.