Getting positions via ticker

visasimbu
As like XTS ticker for positions,trade or orders in interactive API, Is zerodha kite connect python client has implementation of ticker to get positions when there is a change in position? Please be aware that I have done implementation by myself using kite.positions() and it was running in seperate thread to poll my position every second. Instead of this if there is a websocket implementation to get position change, it ll be quick and easy to implement.
Tagged:
  • ANL
    ANL edited April 16
    Yes. You can use WebSocket to get order updates. It is not like polling using kite.positions()
    You can use on_order_update() and it is an event driven asyncrounous call. You will get order updates as updates are out of order. you have to do at your end.

    So, if you have multiple positions to place at a time, then you must use on_order_update()
    If you want to get positions faster, you should use WebSocket on_order_update(), which has no polling limit as it is using WebSocket calls.


    You can refer more about WebSocket order status: https://kite.trade/docs/connect/v3/websocket/#postbacks-and-non-binary-updates & https://github.com/zerodha/pykiteconnect/blob/a6be72a05edcb22f4461a350056639fab53e4983/examples/ticker.py
  • MAG
    MAG edited April 16
    Please do not give wrong answers. The most important part of @visasimbus post is the following line

    Is zerodha kite connect python client has implementation of ticker to get positions when there is a change in position?

    And the answer to that is a BIG NO. Ticker api/Websocket api does not have have the functionality to show change in positions. It just streams tickdata and one needs to write their own code and build their own functionality if they want to monitor real time change in positions as is shown in the positions page
    He did not ask about change in order status. Understand the question before answering.
  • visasimbu
    Thanks @MAG . Agree. After research I found that there is NOwebsocket to get positions change from Zeodha.
  • visasimbu
    I was trying to design copy trade for zerodha to zerodha account. Is that only way to pull from kite.positions() on every second and replicate in other account ? Is there any better way to do this ?
  • ketansp
    @visasimbu perhaps you might want to approach this in an even driven manner. Instead of replicating positions, you can try to replicate orders. Just poll for order updates and replicate those.
Sign In or Register to comment.