phpkiteconnect icon indicating copy to clipboard operation
phpkiteconnect copied to clipboard

Its return stdClass

Open krButani opened this issue 2 years ago • 1 comments

I have face issue to fetch only LTP. When I tried to used getLTP Method it show below error

Fatal error: Uncaught TypeError: Return value of KiteConnect\KiteConnect::getLTP() must be an instance of KiteConnect\mixed, instance of stdClass returned in *\vendor\zerodha\phpkiteconnect\src\KiteConnect.php:791 Stack trace: #0 *\test.php(28): KiteConnect\KiteConnect->getLTP(Array) #1 {main} thrown in *\vendor\zerodha\phpkiteconnect\src\KiteConnect.php on line 791

I solved this issue to change some code on KiteConnect.php

  1. Old Code KiteConnect.php on line No 789

public function getLTP(array $instruments): mixed { return $this->get("market.quote.ltp", ["i" => $instruments]); }

  1. New Code To change

public function getLTP(array $instruments): stdClass { return $this->get("market.quote.ltp", ["i" => $instruments]); }

krButani avatar Oct 04 '21 04:10 krButani