- Python Algorithmic Trading Cookbook
- Pushpak Dagade
- 149字
- 2021-06-11 18:29:22
Fetching an instrument
Instruments, also known as financial instruments or securities, are assets that can be traded in an exchange. In an exchange, there can easily be tens of thousands of instruments. This recipe demonstrates how to fetch an instrument based on its exchange and trading symbol.
Getting ready
Make sure the broker_connection object is available in your Python namespace. Refer to the first recipe in this chapter to set up this object.
How to do it…
Fetch an instrument for a specific trading symbol and exchange:
>>> broker_connection.get_instrument(segment='NSE', tradingsymbol='TATASTEEL')
You'll get the following output:
segment: NSE
exchange: NSE
tradingsymbol: TATASTEEL
broker_token: 895745
tick_size: 0.05
lot_size: 1
expiry:
strike_price: 0.0
How it works…
The broker_connection object provides a handy method, get_instrument, for fetching any financial instrument. It takes segment and tradingsymbol as attributes before returning an instrument. The return object is an instance of the Instrument class.
- Hands-On Internet of Things with MQTT
- 過程控制工程及仿真
- Hands-On Machine Learning on Google Cloud Platform
- 數(shù)據(jù)庫原理與應(yīng)用技術(shù)
- 21天學(xué)通Visual Basic
- 精通數(shù)據(jù)科學(xué)算法
- 單片機C語言程序設(shè)計完全自學(xué)手冊
- 網(wǎng)絡(luò)管理工具實用詳解
- 統(tǒng)計挖掘與機器學(xué)習(xí):大數(shù)據(jù)預(yù)測建模和分析技術(shù)(原書第3版)
- 強化學(xué)習(xí)
- 手把手教你學(xué)Flash CS3
- 伺服與運動控制系統(tǒng)設(shè)計
- MySQL Management and Administration with Navicat
- 系統(tǒng)建模與控制導(dǎo)論
- 玩轉(zhuǎn)機器人:基于Proteus的電路原理仿真(移動視頻版)