Member-only story
Coding Time Compression Scanners: Zerodha API Basics II
Getting List of All FNO Stocks Using Python Zerodha API
Although We can use the oneliner fnolist() function from NSEPython API, Lets use Zerodha API to get list of all FNO stocks as a diversification. In case You want to see fnolist() function –
Downloading Entire Instruments List
First, let’s download the entire instrument list from Zerodha and save it as a portable database. We will use the pandas library for this task, making data manipulation seamless. The instrument list is available at https://api.kite.trade/instruments in CSV format. So, let’s declare a variable named “instrumentList” to harness the power of pandas in managing this crucial trading data.
import pandas as pd
instrumentList = pd.read_csv("https://api.kite.trade/instruments")
print(instrumentList)
The output will be –
Triggered at Count Stocks (new stocks are highlighted) Trigger Date Trigger Time
0 Fri Apr 21 2023, 10:07 am 1 APOLLOTYRE 2023-04-21 10:07:00
1 Fri Apr 21 2023, 9:58 am 1 ASIANPAINT 2023-04-21 09:58:00
2 Thu Apr 20 2023, 3:21 pm 1 TATACONSUM 2023-04-20 15:21:00
3 Thu Apr 20 2023, 2:16 pm 1 BAJAJ-AUTO 2023-04-20 14:16:00
4 Thu Apr 20 2023, 12:49 pm 1 CUB 2023-04-20 12:49:00
... ... ... ... ... ...
775 Tue Sep 13 2022, 10:03 am 3 DIXON 2022-09-13 10:03:00
776 Tue Sep 13 2022, 10:03 am 3 DRREDDY 2022-09-13…