- Python Algorithmic Trading Cookbook
- Pushpak Dagade
- 155字
- 2021-06-11 18:29:23
Querying a list of segments
A segment is essentially a categorization of instruments based on their types. The various types of segments that are commonly found at exchanges include cash/equities, futures, options, commodities, and currency. Each segment may have a different operating time. Usually, a broker supports multiple segments within multiple exchanges. This recipe demonstrates how to find the list of segments 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 segments supported by the broker:
>>> segments = instruments.segment.unique()
>>> print(segments)
You will get the following output:
['BCD-FUT' 'BCD' 'BCD-OPT' 'BSE' 'INDICES' 'CDS-FUT' 'CDS-OPT' 'MCX-FUT' 'MCX-OPT' 'NFO-OPT' 'NFO-FUT' 'NSE']
How it works…
instruments.segment returns a pandas.Series object. Its unique method returns a numpy.ndarray object consisting of unique segments supported by the broker.
- 高性能混合信號ARM:ADuC7xxx原理與應用開發
- 教父母學會上網
- Windows XP中文版應用基礎
- 西門子S7-200 SMART PLC實例指導學與用
- RPA(機器人流程自動化)快速入門:基于Blue Prism
- 網絡安全與防護
- Statistics for Data Science
- LMMS:A Complete Guide to Dance Music Production Beginner's Guide
- 基于RPA技術財務機器人的應用與研究
- 工業機器人操作
- Cloudera Hadoop大數據平臺實戰指南
- 電氣控制及Micro800 PLC程序設計
- 算法設計與分析
- 計算機硬件技術基礎(第2版)
- SQL Server 2019 Administrator's Guide