It looks like you're new here. If you want to get involved, click one of these buttons!
kite.quote
multiple times in a loop, fetching 500 instruments at a time as limited per the API docs. The code also waits 2 seconds in-between each call to kite.quote
to ensure that the app doesn't breach the limit of 1 request / second for obtaining quotes (I found an answer in another forum discussion indicating the 1r / s limitation). The expectation is that it will take about 2.5-3 minutes to fetch quotes for all NFO instruments using this loop.
raise ex.DataException("Unknown Content-Type ({content_type}) with response: ({content})".format(
kiteconnect.exceptions.DataException: Unknown Content-Type (text/html) with response: (b'<html><body><h1>400 Bad request</h1>\nYour browser sent an invalid request.\n</body></html>\n')
Traceback (most recent call last):
File "manage.py", line 25, in <module>
main()
File "manage.py", line 21, in main
execute_from_command_line(sys.argv)
File "/Users/dhwanit/.pyenv/versions/3.8.6/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/Users/dhwanit/.pyenv/versions/3.8.6/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/dhwanit/.pyenv/versions/3.8.6/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/dhwanit/.pyenv/versions/3.8.6/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/Users/dhwanit/.pyenv/versions/3.8.6/lib/python3.8/site-packages/django/core/management/commands/shell.py", line 93, in handle
exec(sys.stdin.read())
File "<string>", line 4, in <module>
File "/Users/dhwanit/projects/marketbots/tracker/libs/tracker.py", line 220, in nfo_universe
quotes = kw.get_quote(instrument_subset_list)
File "/Users/dhwanit/projects/marketbots/tracker/libs/kitewrapper.py", line 33, in get_quote
quotes = kite.quote(instruments)
File "/Users/dhwanit/.pyenv/versions/3.8.6/lib/python3.8/site-packages/kiteconnect/connect.py", line 570, in quote
data = self._get("market.quote", params={"i": ins})
File "/Users/dhwanit/.pyenv/versions/3.8.6/lib/python3.8/site-packages/kiteconnect/connect.py", line 822, in _get
return self._request(route, "GET", url_args=url_args, params=params, is_json=is_json)
File "/Users/dhwanit/.pyenv/versions/3.8.6/lib/python3.8/site-packages/kiteconnect/connect.py", line 900, in _request
raise ex.DataException("Unknown Content-Type ({content_type}) with response: ({content})".format(
kiteconnect.exceptions.DataException: Unknown Content-Type (text/html) with response: (b'<html><body><h1>400 Bad request</h1>\nYour browser sent an invalid request.\n</body></html>\n')
You will have to reduce the number of instrument tokens in one go.