You can run pykiteconnect with debug logs on and check what exactly you are sending. If you don't understand then please post the complete stack trace here by removing the app tokens, we will check and get back to you.
If you want to fetch quote for a list of instruments, you just need to send a list of instruments with their respective exchange. You don't have to double mention exchange "NSE:x" here. It should be:
I tried the quotes api and PFA the code:
from kiteconnect import KiteConnect
import os
cwd = os.chdir("C:\\Users\\Administrator\\Desktop\\Zerodha")
#generate trading session
access_token = open("access_token.txt",'r').read()
key_secret = open("api_key.txt",'r').read().split()
kite = KiteConnect(api_key=key_secret[0])
kite.set_access_token(access_token)
x=['NSE:ARVIND', 'NSE:CIPLA', 'NSE:TATAPOWER', 'NSE:HEROMOTOCO', 'NSE:ZEEL', 'NSE:LT', 'NSE:BEL', 'NSE:COALINDIA', 'NSE:SPARC', 'NSE:ADANIPORTS', 'NSE:GAIL', 'NSE:INDUSINDBK', 'NSE:MOTHERSUMI', 'NSE:TITAN', 'NSE:HINDALCO', 'NSE:LUPIN', 'NSE:YESBANK', 'NSE:RELIANCE', 'NSE:ITC', 'NSE:AUROPHARMA', 'NSE:HINDPETRO']# Fetch quote details
for instrument in kite.instruments():
quote = kite.quote("NSE:x")
The issue being that after running the code it gives me an empty quote dictionary as shown:
If you don't understand then please post the complete stack trace here by removing the app tokens, we will check and get back to you.
I read the discussion here: https://kite.trade/forum/discussion/7225/enable-logging
This does not cater to my needs as i am using a python client
As suggested I tried to run the pykiteconnect with debug logs as shown:
from kiteconnect import KiteConnect
import os
import logging
cwd = os.chdir("C:\\Users\\Administrator\\Desktop\\Zerodha")
#generate trading session
access_token = open("access_token.txt",'r').read()
key_secret = open("api_key.txt",'r').read().split()
kite = KiteConnect(api_key=key_secret[0])
kite.set_access_token(access_token)
logging.basicConfig(level=logging.DEBUG)
#x=['NSE:ARVIND', 'NSE:CIPLA', 'NSE:TATAPOWER', 'NSE:HEROMOTOCO', 'NSE:ZEEL', 'NSE:LT', 'NSE:BEL', 'NSE:COALINDIA', 'NSE:SPARC', 'NSE:ADANIPORTS', 'NSE:GAIL', 'NSE:INDUSINDBK', 'NSE:MOTHERSUMI', 'NSE:TITAN', 'NSE:HINDALCO', 'NSE:LUPIN', 'NSE:YESBANK', 'NSE:RELIANCE', 'NSE:ITC', 'NSE:AUROPHARMA', 'NSE:HINDPETRO']# Fetch quote details
try:
#quote = kite.quote("NSE:TATACHEM")
quote = kite.quote("NSE:x")
logging.info("Order placed. ID is: {}".format(quote))
except Exception as e:
logging.info("Order placement failed: {}".format(e))
The issue is as shown in screenshot it does not print any logs the code runs without error giving a blank dictionary.
If I run for singular element like this:
quote = kite.quote("NSE:INFY")
It gives me a dictionary giving the quotes of INFY as shown:
"NSE:x"
here. It should be:Thanks, This solves the issue but how to run the pykiteconnect with debug logs?
I tried to run as shown above but it does not yield the logs
You can check out pykiteconnect docs here to know more.