Getting exception "error:InputException: Invalid quantity" for SLL order placement

abhi_shah
This error is coming for multiple Zerodha clients. The orders getting placed but the exception is being returned
  • rakeshr
    Can you paste here the complete order placement params?
  • abhi_shah
    Have shared more details with Sujith on DM
  • santhanakrishnan25
    I also got the same today
    2024-02-26 09:18:00,285 - INFO - zerodha: Going to modify order with params newPrice=94.6, newTriggerPrice=94.5, newQty=0, newOrderType=None - 63
    2024-02-26 09:18:00,396 - INFO - zerodha Order modify failed: Invalid `quantity`. - 81
  • sujith
    Can you check if you are sending quantity as 0? If that is the case then it needs to be changed.
  • santhanakrishnan25
    No the quantity will be None. This code worked till Friday!!
    orderId = kite.modify_order(
    variety=kite.VARIETY_REGULAR,
    order_id=order.orderId,
    quantity=orderModifyParams.newQty if orderModifyParams.newQty > 0 else None,
    price=orderModifyParams.newPrice if orderModifyParams.newPrice > 0 else None,
    trigger_price=orderModifyParams.newTriggerPrice if orderModifyParams.newTriggerPrice > 0 else None,
    order_type=orderModifyParams.newOrderType if orderModifyParams.newOrderType != None else None)
  • sujith
    None is also an Invalid quantity know.
  • sujith
    I have asked the concerned team to investigate this.
  • prabhatmittal20
    There are two problems with this change here:

    1. Any change should be notified on your documentation page and GitHub, so that users can make that change.
    2. Sending quantity will cause an issue if part quantity is executed for a limit order while modifying the order.
  • KamalChhirang
    Exactly, I agree @prabhatmittal20 . Kite Team just makes the changes overnight without any announcement. It would be great, If you notify the users at least 24 hours before making the changes. 1 week would be better, but 24 hours is at least required!

    Last time they changed the requests limit per IP without any notification and It caused a lot of problems for me.
  • abhishek26
    +1 facing the same issue. Such changes should be informed beforehand
  • propTrader
    this is so dumb, changing api without any advance notice. absolutely no thought given to end user
  • sodha_rakesh
    sodha_rakesh edited February 26
    +1
    Quantity was optional parameter for Modify Error and was accepting 'None' but getting the 'Invalid Quantity Error' since morning
  • Cassius
    Same error for me as well. Code was working since ages and this happened today only.

    This is absolutely unacceptable to change something without due communication.
  • Matti
    Kite Team just makes the changes overnight without any announcement. It would be great, If you notify the users at least 24 hours before making the changes. 1 week would be better, but 24 hours is at least required!
    You're right that we're expected to give prior notice for breaking changes to the API. However, this wasn't supposed to be a breaking change. The current issue with order modifications is an unforeseen bug. Outside of that, this wasn't supposed to be a breaking change and hence no prior notice.
  • prabhatmittal20
    @Matti change was breaking from user perspective :) . Though it it was not a expected change and rather a bug, that is understable. Though you might need to beef up your testing team capacity :wink:
  • santhanakrishnan25
    Sent quantity and things were fine. But if i send the same orderType it throws the error. Sending the order type as none now. Hope SL LIMIT to MARKET order conversion works fine @sujith
    2024-02-26 13:27:36,890 - INFO - zerodha Order modify failed: Invalid order_type. - 81
    2024-02-26 13:27:36,890 - ERROR - TradeManager: Failed to update SL for tradeID cf09091a-8513-4559-a95e-8cd9a202cbe9 orderId 240226502256281: Error => Invalid order_type. - 702
    2024-02-26 13:27:38,077 - INFO - zerodha: Going to modify order with params newPrice=50.9, newTriggerPrice=50.8, newQty=75, newOrderType=SL_LIMIT - 63
    2024-02-26 13:27:38,090 - INFO - rb1 Min PNL -7
  • santhanakrishnan25
    santhanakrishnan25 edited February 26
    2024-02-26 13:46:45,212 - INFO - zerodha: Going to modify order to MARKET - 85
    2024-02-26 13:46:45,308 - INFO - zerodha Order modify to market failed: Invalid quantity. - 100
    2024-02-26 13:46:45,308 - ERROR - TradeManager: Modify SL Order to market failed for tradeID 4d3ced0d-37db-4e4d-b7dd-5a1048a67d9d: Error => Invalid quantity. - 756

    Damn issues are here as well @sujith @rakeshr
  • prabhatmittal20
    @santhanakrishnan25 send quantity when modifying order whether to change SLL price or changing the order type. While changing SLL price, you can send the order type as NONE and while squaring off the position change order type to MARKET.
  • chachaji
    Sending the last two additional parameters fixed the error for me while modifying stop loss orders. The parameters are set to whatever the original SL had.

    return self.modify_order(order.variety, order.kite_order_id, trigger_price=trigger_price, quantity=order.quantity, order_type=order.order_type)
  • AkashRam
    @Matti @sujith Should we start passing quantity as a param henceforth for modifying orders? Thanks.
  • Matti
    We'll revert the changes made to the modification flow after markets close today.
  • ravitandur
    Any idea why u started validating the quantity parameter which was optional to modify_order?
    These kind of sudden change will have major impact on all algos, why can't you publish the breakable changes in advance?
  • prabhatmittal20
    prabhatmittal20 edited February 26
    ##
  • Matti
    Any idea why u started validating the quantity parameter which was optional to modify_order?
    This change was meant for order placements. The validation on order_modify was an unintended side-effect.
  • sodha_rakesh
    We'll revert the changes made to the modification flow after markets close today.
    Thank you for the quick action @Matti
  • ravitandur
    @Matti Thank you. Please revert in this group once changes are reverted.
    Hope, no changes required at client side,
  • pseudo
    I also faced the same issue, all my trailing SLs failed and I incurred losses due to U turns in the market. The same code worked perfectly till Friday with quantity being sent as None, but today it failed! Zerodha needs to notify each user for any such changes proactively, and take responsibility of our losses because of such issues!
  • DaneshBansal
    @Matti, pls confirm if this issue has been resolved
  • kishorsandage
    kishorsandage edited February 26
    @sujith @rakeshr @sodha_rakesh , Pl confirm if the issue is resolved or still it is there. Or inform What kind of changes made at your end so that We can modify our programs.
  • Matti
    The fix is deployed. While order placement quantity will continue to require non-zero values, order modification requests won't need it anymore.
  • abhi_shah
    Thanks for the confirmation
  • kishorsandage
    @Matti Thanks for your quick action.
Sign In or Register to comment.