Redirect output of kite.instruments() to a file

deadlock
Please share the command to redirect output of kite.instruments() to a file.
  • rakeshr
    @deadlock
    Instrument list returned from kite.instruments() is gzipped CSV dump, check this documentation.You can iterate over complete instrument dump and store required items(trading symbol, expiry, exchange, segment, etc).
  • deadlock
    @rakeshr
    Thank you for your reply. Since I am very new to python and KiteConnect, some follow-up questions on the kite.instruments() method and the curl command:

    Question 1: Python script
    Shouldn't the kite.instruments() call, download the instruments.gz file? Is the file name different and where is it downloaded?

    Question 2. curl command line
    curl "https://api.kite.trade/instruments" \
    -H "X-Kite-Version: 3" \
    -H "Authorization: token api_key:access_token"
    In this command, should token api_key and access_token be entered in single quotes, double quotes or no quotes?
  • rakeshr
    @deadlock
    Shouldn't the kite.instruments() call, download the instruments.gz file? Is the file name different and where is it downloaded?
    Python client complete instrument fetch(kite.instruments()) returns nested list data structure() converted from CSV dump.You can iterate over this nested list as required.You can look this part.
    curl "https://api.kite.trade/instruments" return CSV dump data.
    In this command, should token api_key and access_token be entered in single quotes, double quotes or no quotes?
    It should be without any quotes,as below:
    curl "https://api.kite.trade/instruments" \
    -H "X-Kite-Version: 3" \
    -H "Authorization: token XXXXXXXXX:YYYYYYY"
  • sagaranilganu
    Can you share a small sample of "List of Nested Dict" of instruments when below python api is used.
    Eg. :: instru_data = kite.instruments(exchange=kite.EXCHANGE_NSE)

    My understanding :: instru_data = [{}, {}, {}....]
Sign In or Register to comment.