Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    Unable to place market order

    Test
    0
    16
    47
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      pkrawat1 last edited by

      Market order is being rejected due to zero price, but price was sent correctly

      Request

      %{
        exchange: "NSE",
        symbol_token: "15313",
        trading_symbol: "IRB-EQ",
        transaction_type: "BUY",
        variety: "NORMAL",
        quantity: "2",
        product_type: "DELIVERY",
        price: "45.65",
        order_type: "MARKET"
      }
      

      Order status response

      %{
         "updatetime" => "10-Jan-2024 14:41:12",
         "symboltoken" => "17520",
         "filledshares" => "0",
         "lotsize" => "1",
         "producttype" => "DELIVERY",
         "status" => "open",
         "ordertag" => "",
         "quantity" => "1",
         "exchange" => "NSE",
         "uniqueorderid" => "18f1ad44-8419-4bb9-a934-1547d02c0959",
         "trailingstoploss" => 0.0,
         "parentorderid" => "",
         "orderid" => "240110001320140",
         "expirydate" => "",
         "stoploss" => 0.0,
         "duration" => "DAY",
         "exchtime" => "",
         "exchorderupdatetime" => "",
         "variety" => "NORMAL",
         "text" => "",
         "orderstatus" => "",
         "fillid" => "",
         "optiontype" => "",
         "transactiontype" => "BUY",
         "disclosedquantity" => "0",
         "price" => 11.4,
         "unfilledshares" => "1",
         "tradingsymbol" => "RTNPOWER-EQ",
         "averageprice" => 0.0,
         "filltime" => "",
         "instrumenttype" => "",
         "triggerprice" => 0.0,
         "strikeprice" => -1.0,
         "cancelsize" => "0",
         "ordertype" => "MARKET",
         "squareoff" => 0.0
       }}
      
      1 Reply Last reply Reply Quote 1
      • M
        Moderator_1 last edited by

        Hello @pkrawat1,

        This looks like a parsing error. Please enclose the keys in the request body inside "" so that it can be interpreted as a String, i.e. "exchange" instead of exchange.

        If you still have any issue, please let us know.

        Thank you.

        Regards
        SmartAPI Team

        P 5 Replies Last reply Reply Quote 0
        • P
          pkrawat1 @Moderator_1 last edited by

          @Moderator_1
          This is elixir language code, It automatically converts this to json.
          This same code is working for placing limit orders. But only fails in case of MARKET order.

          1 Reply Last reply Reply Quote 0
          • P
            pkrawat1 last edited by

            @Moderator_1
            You can check that in response, all the fields are correct. Still it got rejected with no error in "text" field

            M 1 Reply Last reply Reply Quote 0
            • P
              pkrawat1 @Moderator_1 last edited by

              @Moderator_1 Here is the code open sourced https://github.com/pkrawat1/angel-trading/blob/master/lib/angel_trading/api.ex#L83

              The place order works for limit order but not market order

              1 Reply Last reply Reply Quote 0
              • P
                pkrawat1 @Moderator_1 last edited by

                @Moderator_1
                This my own elixir sdk I created which helps calling the api
                https://github.com/pkrawat1/trade_galleon/blob/36d0f9918a27008d563f79d6ff196b83516d29c9/lib/trade_galleon/brokers/angel_one.ex#L107

                1 Reply Last reply Reply Quote 1
                • P
                  pkrawat1 @Moderator_1 last edited by

                  @Moderator_1 Does it have to do with upper circuit ?? The stock was on upper circuit limit

                  1 Reply Last reply Reply Quote 0
                  • P
                    pkrawat1 @Moderator_1 last edited by

                    @Moderator_1
                    a0e2fad4-a9d7-4aee-b927-bf6956c34537-image.png

                    1 Reply Last reply Reply Quote 1
                    • M
                      Moderator_1 @pkrawat1 last edited by

                      Hello @pkrawat1,

                      I'll get it checked tomorrow with our tech team. Thanks for reporting this issue.

                      Thank you.

                      Regards
                      SmartAPI Team

                      P 1 Reply Last reply Reply Quote 0
                      • P
                        pkrawat1 @Moderator_1 last edited by

                        @Moderator_1 Any update for this ? Thanks

                        M 2 Replies Last reply Reply Quote 0
                        • M
                          Moderator_1 @pkrawat1 last edited by

                          This post is deleted!
                          1 Reply Last reply Reply Quote 0
                          • M
                            Moderator_1 @pkrawat1 last edited by

                            Hello @pkrawat1,
                            This is because of Upper Circuit. On checking our logs we found out that the order with

                            "orderid" => "240110001320140",
                            

                            was successfully executed at backend but could not be placed because of the Upper Circuit.

                            We thank you for being an active user and reporting issues to help us serve you better.

                            Thank you
                            Regards
                            SmartAPI Team

                            P 1 Reply Last reply Reply Quote 0
                            • P
                              pkrawat1 @Moderator_1 last edited by

                              @Moderator_1 But the same when I tried using the AngelOne mobile app. It went into open order. But with api it always went to rejected. 🤔

                              1 Reply Last reply Reply Quote 0
                              • P
                                pkrawat1 last edited by

                                @Moderator_2 @administrators I had same issue for another order, which was not in upper circuit limit.

                                Request

                                {
                                   "duration": "DAY",
                                   "exchange": "NSE",
                                   "ordertype": "MARKET",
                                   "price": "523.05",
                                   "producttype": "DELIVERY",
                                   "quantity": "1",
                                   "symboltoken": "10793",
                                   "tradingsymbol": "SYRMA-EQ",
                                   "transactiontype": "BUY",
                                   "variety": "NORMAL"
                                }
                                

                                Response

                                {
                                   "updatetime": "07-Feb-2024 11:07:29",
                                   "symboltoken": "10793",
                                   "filledshares": "0",
                                   "lotsize": "1",
                                   "producttype": "DELIVERY",
                                   "status": "rejected",
                                   "ordertag": "",
                                   "quantity": "1",
                                   "exchange": "NSE",
                                   "uniqueorderid": "58260661-00dd-40a0-b7cf-98986d594c3c",
                                   "trailingstoploss": 0,
                                   "parentorderid": "",
                                   "orderid": "240207000587714",
                                   "expirydate": "",
                                   "stoploss": 0,
                                   "duration": "DAY",
                                   "exchtime": "",
                                   "exchorderupdatetime": "",
                                   "variety": "NORMAL",
                                   "text": "Market orders with non zero price not allowed",
                                   "orderstatus": "rejected",
                                   "fillid": "",
                                   "optiontype": "",
                                   "transactiontype": "BUY",
                                   "disclosedquantity": "0",
                                   "price": 523.05,
                                   "unfilledshares": "1",
                                   "tradingsymbol": "SYRMA-EQ",
                                   "averageprice": 0,
                                   "filltime": "",
                                   "instrumenttype": "",
                                   "triggerprice": 0,
                                   "strikeprice": -1,
                                   "cancelsize": "0",
                                   "ordertype": "MARKET",
                                   "squareoff": 0
                                }
                                
                                P 1 Reply Last reply Reply Quote 0
                                • P
                                  pkrawat1 @pkrawat1 last edited by

                                  @Moderator_2 @administrators
                                  If I don't send the the order with price for market order. Then too got the issue.

                                  {
                                     "duration": "DAY",
                                     "exchange": "NSE",
                                     "ordertype": "MARKET",
                                     "price": "519.8",
                                     "producttype": "DELIVERY",
                                     "quantity": "1",
                                     "symboltoken": "10793",
                                     "tradingsymbol": "SYRMA-EQ",
                                     "transactiontype": "BUY",
                                     "variety": "NORMAL"
                                  }
                                  

                                  response

                                  {
                                     "updatetime": "",
                                     "symboltoken": "10793",
                                     "filledshares": "0",
                                     "lotsize": "1",
                                     "producttype": "DELIVERY",
                                     "status": "",
                                     "ordertag": "",
                                     "quantity": "1",
                                     "exchange": "NSE",
                                     "uniqueorderid": "b0e6db30-c10f-499e-beb5-69dc6c52a18a",
                                     "trailingstoploss": 0,
                                     "parentorderid": "",
                                     "orderid": "",
                                     "expirydate": "",
                                     "stoploss": 0,
                                     "duration": "DAY",
                                     "exchtime": "",
                                     "exchorderupdatetime": "",
                                     "variety": "NORMAL",
                                     "text": "",
                                     "orderstatus": "",
                                     "fillid": "",
                                     "optiontype": "",
                                     "transactiontype": "BUY",
                                     "disclosedquantity": "0",
                                     "price": 519.8,
                                     "unfilledshares": "1",
                                     "tradingsymbol": "SYRMA-EQ",
                                     "averageprice": 0,
                                     "filltime": "",
                                     "instrumenttype": "",
                                     "triggerprice": 0,
                                     "strikeprice": -1,
                                     "cancelsize": "0",
                                     "ordertype": "MARKET",
                                     "squareoff": 0
                                  }
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • P
                                    pkrawat1 last edited by

                                    @Moderator_2 @administrators Any documentation for market order, that specifies that price should be set to zero for market order ?

                                    I was able to make the api work, after adding a market order check before sending the params. For market order with price zero. The api is working now.

                                    1 Reply Last reply Reply Quote 0
                                    • First post
                                      Last post