Skip to content

Commit f71cba8

Browse files
author
Rakesh Ranjan
committed
fix: OI param for historical data API
1 parent fda9d7e commit f71cba8

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

kiteconnect.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -670,12 +670,14 @@ public function getLTP($instruments) {
670670
* $params bool "continuous" is a bool flag to get continuous data for futures and options instruments. Defaults to false.
671671
* @return array
672672
*/
673-
public function getHistoricalData($instrument_token, $interval, $from, $to, $continuous = false) {
673+
public function getHistoricalData($instrument_token, $interval, $from, $to, $continuous = false, $oi = false) {
674674
$params = [
675675
"instrument_token" => $instrument_token,
676676
"interval" => $interval,
677677
"from" => $from,
678-
"to" => $to
678+
"to" => $to,
679+
"continuous" => $continuous,
680+
"oi" => $oi
679681
];
680682

681683
if ($from instanceof DateTime) {
@@ -686,12 +688,18 @@ public function getHistoricalData($instrument_token, $interval, $from, $to, $con
686688
$params["to"] = $to->format("Y-m-d H:i:s");
687689
}
688690

689-
if (empty($params["continuous"]) || $continuous == false) {
691+
if ($params["continuous"] == false) {
690692
$params["continuous"] = 0;
691693
} else {
692694
$params["continuous"] = 1;
693695
}
694696

697+
if ($params["oi"] == false) {
698+
$params["oi"] = 0;
699+
} else {
700+
$params["oi"] = 1;
701+
}
702+
695703
$data = $this->_get("market.historical", $params);
696704

697705
$records = [];
@@ -703,6 +711,9 @@ public function getHistoricalData($instrument_token, $interval, $from, $to, $con
703711
$r->low = $j[3];
704712
$r->close = $j[4];
705713
$r->volume = $j[5];
714+
if (!empty($j[6])) {
715+
$r->oi = $j[6];
716+
}
706717

707718
$records[] = $r;
708719
}
@@ -844,7 +855,7 @@ public function getGTTs() {
844855
}
845856

846857
/**
847-
* Get history of the individual order.
858+
* Get detail of individual GTT order.
848859
* @param string $trigger_id "trigger_id" Trigger ID
849860
* @return array
850861
*/
@@ -853,7 +864,7 @@ public function getGTT($trigger_id) {
853864
}
854865

855866
/**
856-
* Cancel an open order.
867+
* Delete an GTT order
857868
* @param string $trigger_id "trigger_id" Trigger ID
858869
* @return void
859870
*/

0 commit comments

Comments
 (0)