Order Placing API return no response


  • Hi, using following method; placing the order but there is no return response:

    $post_value_arr = array(
        "variety" => "REGULAR",
        "tradingsymbol" => "RELIANCE-EQ",
        "symboltoken" => "2885",
        "exchange" => "NSE",
        "quantity" => "1",
        "transaction_type" => "BUY",
        "ordertype" => "MARKET",
        "producttype" => "MIS"
    );
    $post_value_json = json_encode($post_value_arr);
    
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "https://apiconnect.angelbroking.com/rest/secure/angelbroking/order/v1/placeOrder");
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_value_json);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $auth_token, 'Content-Type: application/json', 'Accept: application/json', 'X-UserType: USER', 'X-SourceID: WEB', 'X-ClientPublicIP: 172.29.24.173', 'X-ClientLocalIP: 172.29.24.173', 'X-MACAddress: e0:d5:5e:91:23:d4', 'X-PrivateKey: ' . $api_key));
    
    // receive server response ...
    $server_output = curl_exec($ch);
    $server_output_arr = json_decode($server_output, true);
    

    Please rectify the issue.


  • Hi @sachinsrm variety parameter should either be NORMAL, STOPLOSS or AMO. Please refer https://smartapi.angelbroking.com/docs/Orders#place


  • @sandipkhairnar
    hi, thanks for the response; I have updated the variety parameter to "NORMAL"; but there is no change in response. Nothing is return.


  • @sachinsrm Please try with below request.

    {
    "variety":"NORMAL",
    "tradingsymbol":"RELIANCE-EQ",
    "symboltoken":"2885",
    "transactiontype":"BUY",
    "exchange":"NSE",
    "ordertype":"MARKET",
    "producttype":"MIS",
    "duration":"DAY",
    "price":"0",
    "quantity":"1"
    }


  • @sandipkhairnar
    Hi, Thanks for response again.

    Tried as you have suggested; but not getting the any response. Once again getting an empty result.
    Not receiving success or error response.


  • @sachinsrm There is no MIS. its INTRADAY.. I have attached the table below for your reference.

    Screen Shot 2021-01-07 at 12.03.14.png


  • @rajanprabu
    Hi, thanks for the response. Now updating MIS to INTRADAY, Response is coming.
    For given input

        "variety" => "NORMAL",
        "tradingsymbol" => "RELIANCE-EQ",
        "symboltoken" => "2885",
        "exchange" => "NSE",
        "quantity" => "1",
        "transactiontype" => "BUY",
        "ordertype" => "MARKET",
        "producttype" => "INTRADAY"
    

    following response is coming:

    AB2001 : Internal Error
    How can this issue be handled?


  • @sachinsrm There is missing "duration":"DAY" in place order request body.


  • @sandipkhairnar
    Hi,
    Thanks!
    Now getting the responses.
    API response getting Success but when checking into the trading panel:
    https://trade.angelbroking.com/
    it shows Order Rejected.


  • @sachinsrm order placement is successful - status of the order is what you are seeing in the web


  • Hi @admin and other fellow coders
    I am refferring to the symbol token in the link given here
    174d2738-ed40-425c-b3d4-59ce137dccd6-image.png

    I tried to place order in the below code-

    paceSLorder_payload = "{\n\"exchange\": \"NFO\",\n\"tradingsymbol\": \"BANKNIFTY21JAN2132600PE\",\n\
        \"quantity\": 25, \
            \n\"disclosedquantity\": 25,\
             \n\"symboltoken\": 58068,\
           \n    \"transactiontype\": \"BUY\",\
           \n    \"ordertype\": \"LIMIT\",\
           \n    \"duration\": \"DAY\",\
           \n    \"variety\": \"STOPLOSS_LIMIT\",\
           \n    \"triggerprice\": \"800\",\
          \n    \"price\": \"805\",\
           \n    \"producttype\": \"INTRADAY\"\
           \n}"
    conn.request("POST", 
    "/rest/secure/angelbroking/order/v1/placeOrder",\
    placeSLorder_payload,\
    headers)
    res = conn.getresponse()
    data = res.read()
    print(data.decode("utf-8"))
    

    I get the following error-

    {"message":"Entered trading symbol and symbol token is mismatch","errorcode":"AB1019","status":false,"data":null}
    

    If you see the symbol and token value is correct. Why do i get this error?


  • Hi @PandaTrade , thank you for sharing your system on remote. The query is now resolved.


  • @admin
    I am also not able to place the order using above request. Please help me..


  • Hi @nshekhar , as discussed and solved.