It looks like you're new here. If you want to get involved, click one of these buttons!
#!python
from pprint import pprint
from kiteconnect import KiteTicker
kws = KiteTicker("API_KEY", "ACCESS_TOKEN")
def on_ticks(ws, ticks):
# Callback to receive ticks.
# logging.debug("Ticks: {}".format(ticks))
pprint(ticks)
# print(ticks)
print("\n")
def on_connect(ws, response):
# Callback on successful connect.
# Subscribe to a list of instrument_tokens (RELIANCE ad ACC here).
ws.subscribe([3050241, 177665])
# Set RELIANCE to tick in `full` mode.
ws.set_mode(ws.MODE_FULL, [3050241, 177665])
# Assign the callbacks.
kws.on_ticks = on_ticks
kws.on_connect = on_connect
# Infinite loop on the main thread. Nothing after this will run.
# You have to use the pre-defined callbacks to manage subscriptions.
kws.connect()
I am getting following error
File "/Applications/MAMP/htdocs/laptop/algoTradedt/Training Program files/kiteconnect series/lecture 2 get data/get data.py", line 63, in <module>
kws.connect()
File "/Users/Apple/opt/anaconda3/lib/python3.7/site-packages/kiteconnect/ticker.py", line 532, in connect
reactor.run(**opts)
File "/Users/Apple/opt/anaconda3/lib/python3.7/site-packages/twisted/internet/base.py", line 1282, in run
self.startRunning(installSignalHandlers=installSignalHandlers)
File "/Users/Apple/opt/anaconda3/lib/python3.7/site-packages/twisted/internet/base.py", line 1262, in startRunning
ReactorBase.startRunning(self)
File "/Users/Apple/opt/anaconda3/lib/python3.7/site-packages/twisted/internet/base.py", line 765, in startRunning
raise error.ReactorNotRestartable()
ReactorNotRestartable
I am using MacOsX. I have installed scrapy, twisted, kiteconnect.
You can go through this thread.
And i am getting following errors So i go through https://pypi.python.org/pypi/service_identity this link
and installed service_identity, which was already installed
Here is what i got in terminal
Requirement already satisfied: pycparser in /Users/Apple/opt/anaconda3/lib/python3.7/site-packages (from cffi!=1.11.3,>=1.8->cryptography->service_identity) (2.19)
Then i executed code again and getting same error.
The thread you suggested not helping much.
I have checked instrument token too. It's correct token.
I have executed same code in spyder.
It worked for once. I tried second time and got same error
ReactorNotRestartable()
.Is there anything that i need to install separately for Anaconda?
So, until library resolves this issue, you may use the default python setup.