Navigation

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

    I want fetch specific holding

    General Discussion
    3
    5
    32
    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.
    • V
      Ved last edited by

      I have more 3 stock in my demat account . I want get data only BHEL-EQ holding data . Anyone tell me how to fetch only one data
      I use this code :
      <?php
      $urlholding ='https://apiconnect.angelbroking.com/rest/secure/angelbroking/portfolio/v1/getHolding?tradingSymbol=BHEL-EQ';
      $curltrade = curl_init();
      curl_setopt($curltrade, CURLOPT_URL, $urlholding);

      curl_setopt($curltrade, CURLOPT_HEADEROPT, CURLHEADER_UNIFIED);
      curl_setopt($curltrade, CURLOPT_HTTPHEADER, $tradeheaders);

      curl_setopt($curltrade, CURLOPT_RETURNTRANSFER, 1);

      $resulttrade = curl_exec($curltrade);
      $http_statustrade = curl_getinfo($curltrade, CURLINFO_HTTP_CODE);

      echo '<br/>Response Status trade : ' . $http_statustrade;
      //echo '<br/>Response String trade : ' . $resulttrade;

      //To Convert json response to array
      $resJsontrade = json_decode($resulttrade, true);

      //holding
      $ts = $resJsontrade['data']['0']['tradingsymbol'];
      $exg = $resJsontrade['data']['0']['exchange'];
      $quh = $resJsontrade['data']['0']['quantity'];
      $proh = $resJsontrade['data']['0']['product'];
      $avh = $resJsontrade['data']['0']['averageprice'];
      $ltp0 = $resJsontrade['data']['0']['ltp'];
      $sth = $resJsontrade['data']['0']['symboltoken'];
      $close0 = $resJsontrade['data']['0']['close'];
      $realisedquantity0 = $resJsontrade['data']['0']['realisedquantity'];
      $profitandloss0 = $resJsontrade['data']['0']['profitandloss'];
      echo " ts " . $ts . " quantity " . $quh;
      ?>

      A W 2 Replies Last reply Reply Quote 0
      • A
        admin @Ved last edited by

        HI @aksharmty After getting the response from api you can perform operation on it to get the stock detail.

        1 Reply Last reply Reply Quote 0
        • W
          webseos @Ved last edited by

          @aksharmty You did a lot ? Whats left to do? whats your point of problem is not clear

          V 1 Reply Last reply Reply Quote 0
          • V
            Ved @webseos last edited by

            @webseos i have 3 stock ( BHEL-EQ, SBIN-EQ,NHPC-EQ) in holding. now I want to fetch only BHEL-EQ stock quantity and average price from the exchange using api.

            W 1 Reply Last reply Reply Quote 0
            • W
              webseos @Ved last edited by

              @aksharmty I am giving you a common algo. Get all stocks in a loop. Check the symbol in loop. When you get BHEL , then break the loop.

              Call server for LTP

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