modify_order() giving error - UnboundLocalError("local variable 'response' referenced before assignment

hi

Code is like this

response = None

try:

# sequence taken from fyers API documantation

#Parameters:

# id (str): ID of the pending order to be modified.

# limitPrice (float, optional): New limit price for the order.

# Mandatory for Limit/Stoplimit orders.

# stopPrice (float, optional): New stop price for the order.

# Mandatory for Stop/Stoplimit orders.

# qty (int, optional): New quantity for the order.

# type (int, optional): New order type for the order.

modifyparams = {

"id": ordid, #string

"type":ordertype,

"limitPrice": price,

"stopPrice": stoplossprice,

"qty":quan

}

# this PRINT function is needed

PRINT("fyers_modify_simple_order_to_sl() modifyparams below")

PRINT(modifyparams)

response = broker.modify_order(modifyparams)

PRINT("fyers_modify_simple_order_to_sl() response " , response)

except Exception as e:

PRINT("exception fyers_modify_simple_order_to_sl ",{e})

common.print_exception_info()

return (status,orderid)

The below line always howing error

response = broker.modify_order(modifyparams)

UnboundLocalError("local variable 'response' referenced before assignment

Can anyone help on this ?

The modifyparams value is below

('fyers_modify_simple_order_to_sl() modifyparams below',)

({'id': '24042900032509', 'type': 3, 'limitPrice': Decimal('22596.75'), 'stopPrice': Decimal('22595.75'), 'qty': 25},),

4 replies