官术网_书友最值得收藏!

Fetching the list of financial instruments

Financial instruments, also known as securities, are assets that can be traded in an exchange. In an exchange, there can be tens of thousands of financial instruments. The list of financial instruments is static in nature, as it doesn't change during the live trading hours. Financial instruments may change from time to time, but never within the same day. Having this data handy is the first step for algorithmic trading. This recipe shows how to fetch the list of financial instruments.

Getting ready

Make sure the broker_connection object is available in your Python namespace. Refer to the Technical requirements section of this chapter to set it up.

How to do it…

Fetch and display all the available financial instruments using broker_connection:

>>> instruments = broker_connection.get_all_instruments()
>>> instruments

We get the following output (your output may differ):

How it works…

This recipe fetches all the available financial instruments using the get_all_instruments() method of broker_connection, which returns a pandas.DataFrame object. This object is assigned to a new attribute, instruments, which is displayed in the output. This output may differ for you as new financial instruments are frequently added and existing ones expire regularly.

主站蜘蛛池模板: 鹤山市| 怀柔区| 英吉沙县| 宁化县| 防城港市| 武陟县| 上蔡县| 交城县| 余庆县| 密山市| 邢台县| 兴义市| 杨浦区| 九龙坡区| 营口市| 乐业县| 彩票| 连云港市| 拉萨市| 汪清县| 崇左市| 福贡县| 寿宁县| 连州市| 贵阳市| 靖州| 靖江市| 安乡县| 桑日县| 德安县| 永福县| 寿宁县| 昆山市| 海南省| 京山县| 光山县| 衡阳市| 泾阳县| 浦城县| 苍南县| 神池县|