Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Its return stdClass #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Its return stdClass #23

wants to merge 1 commit into from

Conversation

krButani
Copy link

@krButani krButani commented Oct 4, 2021

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]);
}

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]);
}

2. New Code To change

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

You need to upgrade to PHP version > 8.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants