I am running the below code and all order updates are flowing in as LIMIT price instruction in on_order_update() and tried modifying a limit order to market and also sending a new market order from kite but it just shows both as limit order type.
import mysql.connector import time import logging import KiteConnect from KiteConnect import KiteTicker from home import *
# Callback for tick reception. def on_ticks(ws, ticks): if len(ticks) > 0: logging.info("Current mode: {}".format(ticks[0]["mode"]))
# Callback for successful connection. def on_connect(ws, response): logging.info("Successfully connected. Response: {}".format(response)) # RELIANCE BSE tokens = [738561] ws.subscribe(tokens) ws.set_mode(ws.MODE_LTP, tokens) logging.info("Subscribe to tokens in Full mode: {}".format(tokens)) logging.debug('test tsest.,mv?LDfeqalfgl')
# Callback when current connection is closed. def on_close(ws, code, reason): logging.info("Connection closed: {code} - {reason}".format(code=code, reason=reason))
# Callback when connection closed with error. def on_error(ws, code, reason): logging.info("Connection error: {code} - {reason}".format(code=code, reason=reason))
# Callback when reconnect is on progress def on_reconnect(ws, attempts_count): logging.info("Reconnecting: {}".format(attempts_count))
# Callback when all reconnect failed (exhausted max retries) def on_noreconnect(ws): logging.info("Reconnect failed.")
# Infinite loop on the main thread. Nothing after this will run. # You have to use the pre-defined callbacks to manage subscriptions. kws.connect(threaded=True)
while True: if kws.is_connected(): logging.info('Session is active') time.sleep(5)
You need to use order_update as the event for fetching orderbook and checking the latest status and other fields. They are asynchronous messages pushed by OMS and we just relay and they are out of orders in some cases.
They are asynchronous messages pushed by OMS and we just relay and they are out of orders in some cases.