zerodha / pykiteconnect

The official Python client library for the Kite Connect trading APIs
MIT License
965 stars 462 forks source link

Add thread name argument to KiteTicker.connect() #191

Open skazazes-work opened 5 months ago

skazazes-work commented 5 months ago

Hello,

I would like to be able to pass a thread name to the KiteTicker.connect() function in order to disambiguate output to the logging module when including thread names in log formatters. I am happy to make the changes myself, but would like to know if they could be merge in if I do.

Thanks!

skazazes-work commented 5 months ago

Another option, and arguably the better solution, would be to enable setting opts["installSignalHandlers"]=False when the function is called without threaded=True.

As of right now, you cannot call KiteTicker.connect() inside of a thread you have already spawned as a result of the signal handlers. Instead you have to call it with the threaded=True argument, causing two threads to be spawned when only on is really needed.