pykiteconnect icon indicating copy to clipboard operation
pykiteconnect copied to clipboard

Can the kite API be made faster?

Open tkanhe opened this issue 3 years ago • 2 comments

The following images show the comparison between pykiteconnect and Kiteconnect REST-API for 15000 F&O instruments.

Current python client:

Capture1

Creating requests session object:

Capture2

Asynchronous execution:

Capture3

Let me know if it can be improved further.

tkanhe avatar Feb 23 '22 08:02 tkanhe

hm, in your first example, you're making 15,000 HTTP requests, one for each instrument?

knadh avatar Feb 23 '22 08:02 knadh

@knadh no, list (var_name: "opl") of about 490 instruments as there is a limit of 500. var: "op_list" is a list of list of 490x31 instruments, which is being passed to all three examples.

tkanhe avatar Feb 23 '22 10:02 tkanhe

Create requests session by default for connection reuse is available in a new release v4.2.0.

ranjanrak avatar Jan 10 '23 05:01 ranjanrak

Does using the pool make API requests fasters?

vijaykz avatar Jan 10 '23 09:01 vijaykz

@vijaykz Ideally yes since there is no overhead to create new connections, do note that if you face any issues then configure pool config - https://github.com/zerodha/pykiteconnect/blob/master/kiteconnect/connect.py#L194

vividvilla avatar Jan 10 '23 13:01 vividvilla