An exchange is a marketplace where instruments are traded. Exchanges ensure that the trading process is fair and happens in an orderly fashion at all times. Usually, a broker supports multiple exchanges. This recipe demonstrates how to find the list of exchanges supported by the broker.
Getting ready
Make sure the instruments object is available in your Python namespace. Refer to the second recipe of this chapter to learn how to set up this object.
How to do it…
Display the exchanges supported by the broker:
>>> exchanges = instruments.exchange.unique()
>>> print(exchanges)
You will get the following output:
['BCD' 'BSE' 'NSE' 'CDS' 'MCX' 'NFO']
How it works…
instruments.exchange returns a pandas.Series object. Its unique() method returns a numpy.ndarray object consisting of unique exchanges supported by the broker.