- 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.
- Ansible Configuration Management
- ArchiCAD 19:The Definitive Guide
- R Data Mining
- JMAG電機電磁仿真分析與實例解析
- 大數據技術入門(第2版)
- INSTANT Varnish Cache How-to
- RPA:流程自動化引領數字勞動力革命
- 80x86/Pentium微型計算機原理及應用
- AWS Administration Cookbook
- 統計策略搜索強化學習方法及應用
- Learning C for Arduino
- 基于企業網站的顧客感知服務質量評價理論模型與實證研究
- Visual FoxPro程序設計
- Photoshop CS5圖像處理入門、進階與提高
- INSTANT VMware vCloud Starter