Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_quote(symbol_name): # Pass symbol name in this format [<exchange>:<symbol_name_1>, <exchange>:<symbol_name_2>, etc]
- limit_cnt = 0
- while limit_cnt < 10:
- try:
- x = kite.quote(symbol_name)
- # print(('prices', len(x), x))
- if len(x) == 0:
- limit_cnt += 1
- print('Error in get_quote()', 'Empty result')
- time.sleep(0.5)
- continue
- return x
- except:
- traceback.print_exc()
- limit_cnt += 1
- print('Error in get_quote()', sys.exc_info())
- time.sleep(0.5)
- continue
- print(get_quote(['NSE:TCS', 'NSE:INFY']))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement