onOrderUpdate function

trading_hero
trading_hero edited July 2023 in Go client
onOrderUpdate function, will this function will receive as soon order got fulfilled / cancelled ?
I am planning to write some code like below for e.g:





// is it like once the order is executed, the order update is triggered & will receive the order details per below
func onOrderUpdate(order kiteconnect.Order) {
fmt.Printf("Order: %s", order.OrderID)
if order.Status == "CANCELLED" && order.TransactionType == "BUY" {

// do something
}
if order.Status == "COMPLETE" && order.TransactionType == "BUY" {
// do something
}
if order.Status == "COMPLETE" && order.TransactionType == "SELL" {
// do something
}

}


BCoz when i ran above code in real market , the onOrderUpdate function didn't call.
I am confused.









  • trading_hero
    any suggestion or thoughts ?
  • rakeshr
    onOrderUpdate function, will this function will receive as soon order got fulfilled / cancelled ?
    Yes.
    BCoz when I ran above code in real market , the onOrderUpdate function didn't call.
    Make sure, you are assigning calling back for onOrderUpdate properly. Go through the nodejs websocket example here.
  • trading_hero
    thank you @rakeshr , I got it the issue, issue was my fn wasn't being call. Thanks for the revert.
This discussion has been closed.