- Python Algorithmic Trading Cookbook
- Pushpak Dagade
- 288字
- 2021-06-11 18:29:25
Circuit limits of a financial instrument
Each financial instrument has a well-defined price band. The instrument price is expected to be within this price band for the day. During the market hours, if the instrument price breaches the band on the upper or lower side, trading may be halted for the instrument by the exchange for a certain time or the entire day. This is done to prevent the sudden rise or fall in an instrument's price within a single day. The upper edge of the price band is known as the upper circuit limit and the lower edge of the price band is known as the lower circuit limit. This data is static, meaning it doesn't change during the day. However, it can significantly change from one day to another. This recipe helps find the circuit limits for a financial instrument.
Getting ready
Make sure the broker_connection and instrument1 objects are available in your Python namespace. Refer to the Technical requirements section of this chapter to set up broker_connection. Refer to the Attributes of a financial instrument recipe of this chapter to set up instrument1.
How to do it…
Fetch and print the lower and upper circuit limits of instrument1:
>>> lower_circuit_limit, upper_circuit_limit = \
broker_connection.get_circuit_limits(instrument1)
>>> print(f'Lower circuit limit: {lower_circuit_limit}')
>>> print(f'Upper circuit limit: {upper_circuit_limit}')
We get the following output (your output may differ):
Lower circuit limit: 315.9
Upper circuit limit: 386
How it works…
The get_circuit_limits() method of the BrokerConnectionZerodha class fetches the lower and upper circuit limits as a tuple for the given financial instrument. This method takes an object of the Instrument type as a parameter. We use instrument1 as the parameter here.
- 工業(yè)機(jī)器人產(chǎn)品應(yīng)用實(shí)戰(zhàn)
- Hadoop 2.x Administration Cookbook
- Dreamweaver 8中文版商業(yè)案例精粹
- 圖形圖像處理(Photoshop)
- 數(shù)據(jù)庫原理與應(yīng)用技術(shù)
- Apache Superset Quick Start Guide
- Implementing AWS:Design,Build,and Manage your Infrastructure
- 學(xué)會(huì)VBA,菜鳥也高飛!
- Visual FoxPro數(shù)據(jù)庫基礎(chǔ)及應(yīng)用
- 大數(shù)據(jù)驅(qū)動(dòng)的機(jī)械裝備智能運(yùn)維理論及應(yīng)用
- 單片機(jī)C語言應(yīng)用100例
- 計(jì)算機(jī)與信息技術(shù)基礎(chǔ)上機(jī)指導(dǎo)
- 與人共融機(jī)器人的關(guān)節(jié)力矩測(cè)量技術(shù)
- Hands-On Agile Software Development with JIRA
- Getting Started with Tableau 2019.2