It looks like you're new here. If you want to get involved, click one of these buttons!
if ($f3->exists('SESSION.oKite')) {
$this->kite = $f3->get('SESSION.oKite');
try {
$this->kite->setAccessToken($f3->get('SESSION.user_access_token'));
} catch (Exception $e) {
echo "Authentication failed: ".$e->getMessage();
throw $e;
}
// some code that fetches $quotes from db are left out for brevity
try {
$oQuote = $this->kite->getQuote($quotes);
//print_r($oQuote);
} catch (Exception $e) {
echo "exception while trying to get quote :-( ".$e->getMessage();
throw $e;
}
}
class orderController extends Controller
{
protected $Kite;
public function __construct()
{
parent::__construct();
}
if ($f3->exists('SESSION.oKite')) {
$this->Kite = $f3->get('SESSION.oKite');
try {
$this->kite->setAccessToken($f3->get('SESSION.user_access_token'));
} catch (Exception $e) {
echo "Authentication failed: ".$e->getMessage();
throw $e;
}
}
public function processOrder($order)
{
$o = $this->Kite->placeOrder( "regular",[
"tradingsymbol" => $order['tradingsymbol'],
"exchange" => $order['exchange'],
"quantity" => $order['quantity'],
"transaction_type" => $transaction_type,
"order_type" => $order['order_type'],
"product" => "MIS",
"trigger_price" => $trigger_price,
"price" => $price,
"validity" => 'DAY',
]);
}
$order_id = $o->order_id;
return $order_id;
}
describes it as rate-limiting. are you crossing the current limit of 5 orders per second. check limits.
if so, you will have to pass your orders through a scheduler at your end that wont let fire more than the prescribed number of orders in prescribed time range .( which is currently in measure of orders per second ).
Thanks
Regards
i am requesting the quote to refresh on every new page request (1/sec). i am only trying to process one order. is there a combined limit like if i request a quote, i am not supposed to send an order (1/sec). actually i am getting the problem only when i try to process an order. (see code above)
should i renewAccessToken on subsequent requests.
refresh on every new page request (1/sec).
i am not supposed to send an order (1/sec)
Thanks
Regards
bumping this again. almost one month of subscription is going to get over tomorrow. i have not even used it once for my original purpose. appreciate your help in this regard.
thanks.
You can check out latest API rate limits here.
thank you. in that case, can anyone please fix the problem with my above code.
orders
which you're passing inprocessOrder
? The issue is you're most likely sending more than 5 orders/second.You can try putting a
sleep()
after every iteration oforders
array to overcome this.its very kind of you to reply to this issue.
i dont have any more strength or time to troubleshoot this. i may move to the competition. however, as promised i will post my code to github, so its useful to someone.