Navigation

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

    Option sell with stop loss price API

    General Discussion
    2
    7
    171
    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.
    • N
      nehasrivastava last edited by

      Hi, Can anyone please help me with placing option sell order through API ?

      I am assuming, i need to give variety as "STOPLOSS" and give the stoploss price while placing the order. Do i need to enter anything in price or square off fields as well ? I want to sell the option at market price and put SL value, Would i be required to place an order at market price and then place an order for SL ? thanks

      	String sPriceString=String.valueOf(sPrice);
      	OrderParams orderParams = new OrderParams();
      	orderParams.variety = "STOPLOSS";
      	orderParams.quantity = 1;
      	orderParams.symboltoken = symbolToken;
      	orderParams.exchange = Constants.EXCHANGE_NFO;
      	orderParams.ordertype = Constants.ORDER_TYPE_SL;
      	orderParams.tradingsymbol = tradingSymbol;
      	orderParams.producttype = Constants.PRODUCT_INTRADAY;		;
      	orderParams.duration = Constants.VALIDITY_DAY;
      	orderParams.transactiontype = Constants.TRANSACTION_TYPE_SELL;
      	orderParams.price = null;
      	orderParams.squareoff = null;
      	orderParams.stoploss = sPriceString;
      
      N 1 Reply Last reply Reply Quote 0
      • N
        nehasrivastava @nehasrivastava last edited by

        Hi @Admin, i am able to place the order with the below parameters but stop loss field is not getting reflected in the order. Only a sell order gets executed, I want a pending order with SL values and trigger price.Also there is no trigger field defined in the Order parameters, kindly help. thanks

        String sPriceString=String.valueOf(sPrice);
        OrderParams orderParams = new OrderParams();
        orderParams.variety = "NORMAL";
        orderParams.quantity = 25;
        orderParams.symboltoken = symbolToken;
        orderParams.exchange = Constants.EXCHANGE_NFO;
        orderParams.ordertype = Constants.ORDER_TYPE_MARKET;
        orderParams.tradingsymbol = tradingSymbol;
        orderParams.producttype = Constants.PRODUCT_INTRADAY; ;
        orderParams.duration = Constants.VALIDITY_DAY;
        orderParams.transactiontype = Constants.TRANSACTION_TYPE_SELL;
        orderParams.price = Double.valueOf(0);
        orderParams.squareoff = "0";
        orderParams.stoploss = "5.1";

        F 1 Reply Last reply Reply Quote 0
        • F
          ForumUser_1 @nehasrivastava last edited by

          @nehasrivastava you need to give params like below:
          order_type='STOPLOSS_LIMIT'
          variety='STOPLOSS'
          triggerprice=sl trigger price
          price=limit price (or 0.0 for SL-M order)

          I did not give anything for "stoploss" and "squareoff" parameter

          N 1 Reply Last reply Reply Quote 0
          • N
            nehasrivastava @ForumUser_1 last edited by

            Thanks @prateekjjw001 for the reply. are you referring to price field or triggerprice value to set? I had a look at the code and only price field is defined. Does API support triggerprice as well if I include in the request? Thanks

            F 1 Reply Last reply Reply Quote 0
            • F
              ForumUser_1 @nehasrivastava last edited by

              @nehasrivastava you can see here
              https://smartapi.angelbroking.com/docs/Orders
              triggerprice The price at which an order should be triggered (SL, SL-M)

              N 1 Reply Last reply Reply Quote 0
              • N
                nehasrivastava @ForumUser_1 last edited by

                Thanks @prateekjjw001 for sharing the details. I think, ROBO order placement is required (which is under development as per post in forum) as with the above available options i had tried, either option is getting sold at market price with no SL or an order goes into pending state waiting for the price to match up.

                F 1 Reply Last reply Reply Quote 0
                • F
                  ForumUser_1 @nehasrivastava last edited by

                  @nehasrivastava strange it works for me as per expectation

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