You asked such a general question like "How will I recieve sunlight in my home?" But then blaming @sujith for your vagueness instead of explaining it furthur.
You really wanted to ask a question, or just wanted that someone provide you the code and spoon feed you?
1 - I was using Django to send triggers on UI after doing certain checks but when I am pulling data from a queue in Python it gets lost (as it is a normal behavior). Here I am using two threads 1st is to receive the data continuously and 2nd one to process the received data from a queue in Python and do certain checks. In a second thread where I am using the process tick function I want to do a synchronization say, We should not process other sets of ticks until the old ticks are processed or checked.
The approach which I have with me is -
1 - use Kafka and other queues 2 - manage this through a flag in data frame instead of a queue.
When posting a thread, you forgot to specify the actual problem. At its core, this forum is for developers who are familiar with APIs and algorithmic trading. Kite API does not provide code rewriting code or assistance in developing a strategy or logic. This forum only handles API issues, not code or logic issues. If you want help, you must make specific enquiries, so you will only receive assistance if someone is willing to help.
The problem is that everyone is overly expecting API support or Algo trading. The fact that you won't get this much support from any other API service or that they don't have a forum like this for 2000 rupees. The folks here are not for writing codes or helping build trading strategies. No one is obligated to do so.
Almost all information on issues is already in the forum. Anyone can easily search for old threads, but everyone wants to get quick support and doesn't want to put in hard work to learn new stuff.
I asked a general question I agree. But someone who is a professional should have simply asked "Can you please elaborate more about your problem? "
He is not a machine. you can check other threads. There are a lot of people asking this kind of question every day. So sometimes a person can't reply or respond properly, and that is not because of a lack of professionalism; he may have already been frustrated by irrelevant threads.
I suggest instead of using queue, use redis instead where your key would be token id. It also allow to debug the problems of your program more efficiently. If that works, then move to kafka.
Hello Ankur, Can you provide a better context?
I agree that I did make a mistake asking this question in hurry.
You really wanted to ask a question, or just wanted that someone provide you the code and spoon feed you?
Seeing the support provided for tests/documentation I don't expect more than correct API's and data.
1 - I was using Django to send triggers on UI after doing certain checks but when I am pulling data from a queue in Python it gets lost (as it is a normal behavior). Here I am using two threads
1st is to receive the data continuously and 2nd one to process the received data from a queue in Python and do certain checks. In a second thread where I am using the process tick function I want to do a synchronization say, We should not process other sets of ticks until the old ticks are processed or checked.
The approach which I have with me is -
1 - use Kafka and other queues
2 - manage this through a flag in data frame instead of a queue.
Is there another approach I can use.
class KiteCons(AsyncWebsocketConsumer):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# self.list_data = Queue()
async my_connect():
await self.accept() # accepting the UI connection
#other processing and db operations
def on_ticks(self, ws, ticks):
# Add ticks to the queue
self.list_data.put(ticks)
def on_connect(self, ws, response):
# Subscribe to desired instrument tokens
ws.subscribe([4451329, 415745, 1427969, 7982337, 1195009])
print("Subscribed to instrument tokens")
def on_close(self, ws, code, reason):
print(f"WebSocket closed: {code}, {reason}")
self.kite_ticker.on_ticks = self.on_ticks
self.kite_ticker.on_connect = self.on_connect
self.kite_ticker.on_close = self.on_close
self.kite_ticker.connect(threaded=True)
self.loop = asyncio.get_event_loop()
self.processing_thread = threading.Thread(target=self.process_ticks, args=(self.loop,))
self.processing_thread.start()
print("Processing thread started")
async def disconnect(self, code):
print('Disconnecting...')
self.stop_event.set()
# Close the KiteTicker WebSocket connection
if self.kite_ticker:
self.kite_ticker.close()
# Stop the processing thread
self.processing_thread.join()
def process_ticks(self, loop):
#fetching data here from the queue and doing the process
The problem is that everyone is overly expecting API support or Algo trading. The fact that you won't get this much support from any other API service or that they don't have a forum like this for 2000 rupees. The folks here are not for writing codes or helping build trading strategies. No one is obligated to do so.
Almost all information on issues is already in the forum. Anyone can easily search for old threads, but everyone wants to get quick support and doesn't want to put in hard work to learn new stuff. He is not a machine. you can check other threads. There are a lot of people asking this kind of question every day. So sometimes a person can't reply or respond properly, and that is not because of a lack of professionalism; he may have already been frustrated by irrelevant threads.