Unable to fetch data for all stocks from KITE PHP API

FU0406
FU0406 edited January 7 in PHP client
The problem is we are using Kite PHP Rest API, to fetch the stock data like current rate, day closing, opening etc. But the API is returning the result only for few stocks, eg: if I search for HDFC, TCS , Reliance - it returns the data. But if search for other stocks like ICICI, SBI etc, it is not returning any data.

I have attached our index.php file below. Also the reference screenshot.

I am expecting the reply from you by EOD today.



My index.php code is below:
<?php
include "kiteconnect.php";

$apiKey = "[my_api_key]";
$apiSecret = "[my_secret_key]";
$request_token = "[my_request_token]";//$_GET["request_token"];

// Initialise.
$kite = new KiteConnect($apiKey);

// Assuming you have obtained the `request_token`
// after the auth flow redirect by redirecting the
// user to $kite->login_url()
try {
$user = $kite->generateSession($request_token, $apiSecret);

echo "Authentication successful. \n";
print_r($user);

$kite->setAccessToken($user->access_token);
} catch(Exception $e) {
echo "Authentication failed: ".$e->getMessage();
throw $e;
}



// Retrieve quote and market depth for list of instruments.
echo "Quote: \n";
print_r($kite->getQuote(["NSE:RELIANCE", "BSE:RELIANCE"]));
print_r($kite->getQuote(["NSE:ICICI", "BSE:ICICI"])); // returns no data , WHYYYYYYYYYY??


?>
  • sujith
    The quote API expects a user to send a valid tradingsymbol and exchange or instrument token.
    You can fetch all the details from the instrument dump.
    You can check out quote API documentation here.
  • Nikhil.A
    Nikhil.A edited January 7
    @FU0406 In your example, I see that you're sending "ICICI" while the trading symbol is actually "ICICIBANK". Similarly, I'm guessing you're sending "SBI" while it should be "SBIN". Refer to the instrument dump for the correct symbols.
Sign In or Register to comment.