The package provides output in 4 formats :
This package requires PHP7 to be installed on your system. There is no special requirement or dependencies to install this package.
I recommend you to install this package using composer.
composer require abuhurairalakdawala/indian-share-market
For using this package, you just need to invoke the following class:
use IndianShareMarket\IndianShareMarket;
$object = new IndianShareMarket();
This class holds all, what the package provides. We will reference the above object for our examples.
It provides following 4 functions to return output:
To retrieve all the stocks from NSE, you should call the following function:
$equities = $object->equities();
This function will load the data and return the object of IndianShareMarket. Optionally, it accepts one parameter.
Currently we do not provide BSE stock list. It will throw an exception if you try to fetch BSE data.
To get the response with values you should call any one function as mentioned in basic usage.
Item | Values |
---|---|
Default value | both |
Accepted Param Values | nse, bse and both |
Return for $equities->array() |
[
'nse' => [
'format' => 'array',
'data' => [
[
'symbol' => '20MICRONS',
'name_of_company' => '20 Microns Limited',
'series' => 'EQ',
'date_of_listing' => '06-OCT-2008',
'paid_up_value' => '5',
'market_lot' => 1,
'isin_number' => 'INE144J01027',
'face_value' => '5'
],
[
'symbol' => '21STCENMGM',
'name_of_company' => '21st Century Management Services Limited',
'series' => 'EQ',
'date_of_listing' => '03-MAY-1995',
'paid_up_value' => '110',
'market_lot' => 1,
'isin_number' => 'INE253B01015',
'face_value' => '10'
],
...
]
]
]
|
Return for $equities->json() |
{
"nse":{
"format":"json",
"data":[
{
"symbol":"20MICRONS",
"name_of_company":"20 Microns Limited",
"series":"EQ",
"date_of_listing":"06-OCT-2008",
"paid_up_value":"5",
"market_lot":"1",
"isin_number":"INE144J01027",
"face_value":"5"
},
{
"symbol":"21STCENMGM",
"name_of_company":"21st Century Management Services Limited",
"series":"EQ",
"date_of_listing":"03-MAY-1995",
"paid_up_value":"10",
"market_lot":"1",
"isin_number":"INE253B01015",
"face_value":"10"
},
...
]
}
}
|
$industries = $object->industries();
This function will load the data and return the object of IndianShareMarket. Optionally, it accepts one parameter.
To get the response with values you should call any one function as mentioned in basic usage.
Item | Values |
---|---|
Default value | both |
Accepted Param Values | nse, bse and both |
Return for $industries->array() |
[
"nse" => [
"format" => "array",
"data" => [
[
"name" => "Abrasives"
],
[
"name" => "Aluminium"
],
[
"name" => "Aquaculture"
],
[
"name" => "Auto - 2 & 3 Wheelers"
],
...
]
],
"bse" => [
"format" => "array",
"data" => [
[
"name" => "2\/3 Wheelers"
],
[
"name" => "Advertising & Media"
],
[
"name" => "Aerospace"
],
...
]
]
]
|
Return for $industries->json() |
{
"nse":{
"format":"json",
"data":[
{
"name":"Abrasives"
},
{
"name":"Aluminium"
},
{
"name":"Aquaculture"
},
{
"name":"Auto - 2 & 3 Wheelers"
},
...
]
},
"bse":{
"format":"json",
"data":[
{
"name":"2\/3 Wheelers"
},
{
"name":"Advertising & Media"
},
{
"name":"Aerospace"
},
...
]
}
}
|
$sectors = $object->sectors();
This function will load the data and return the object of IndianShareMarket. Optionally, it accepts one parameter.
To get the response with values you should call any one function as mentioned in basic usage.
Item | Values |
---|---|
Default value | both |
Accepted Param Values | nse, bse and both |
Return for $sectors->array() |
[
"nse" => [
"format" => "array",
"data" => [
[
"index_name" => "Nifty 50",
"index_date" => "22-02-2019",
"open_index_value" => "10782.7",
"high_index_value" => "10801.55",
"low_index_value" => "10758.4",
"closing_index_value" => "10791.65",
"points_change" => "1.8",
"change(%)" => ".02",
"volume" => "396846597",
"turnover_(rs._cr.)" => "24386.42",
"p/e" => "26.32",
"p/b" => "3.41",
"div_yield" => "1.25"
],
[
"index_name" => "Nifty Next 50",
"index_date" => "22-02-2019",
"open_index_value" => "25930.2",
"high_index_value" => "26124",
"low_index_value" => "25867.35",
"closing_index_value" => "26097.55",
"points_change" => "200.6",
"change(%)" => ".77",
"volume" => "168739680",
"turnover_(rs._cr.)" => "3106.73",
"p/e" => "41",
"p/b" => "3.71",
"div_yield" => ".94"
],
...
]
],
"bse" => [
"format" => "json",
"data" => [
[
"ScripFlagCode" => 16,
"INDX_CD" => "BSE30 ",
"IndexName" => "S&P BSE SENSEX",
"I_open" => 35906.01,
"High" => 35941.69,
"Low" => 35795.79,
"Curvalue" => 35871.48,
"Prev_Close" => 35898.35,
"Chg" => -26.87,
"ChgPer" => -0.07,
"Week52High" => 38989.65,
"Week52Low" => 32483.84,
"MKTCAP" => 6430398.06,
"MktcapPerc" => 47.48,
"NET_TURN" => 1293.8,
"TurnoverPerc" => 47.93,
"DT_TM" => "2019-02-22T16:00:00",
"Ind_Cat" => 100,
"IndCateGoryIndex" => "Broad"
],
[
"ScripFlagCode" => 81,
"INDX_CD" => "MIDCAP ",
"IndexName" => "S&P BSE MidCap",
"I_open" => 14132.67,
"High" => 14183.89,
"Low" => 14097.79,
"Curvalue" => 14169.74,
"Prev_Close" => 14115.65,
"Chg" => 54.09,
"ChgPer" => 0.38,
"Week52High" => 17059.37,
"Week52Low" => 13538.62,
"MKTCAP" => 1831764.88,
"MktcapPerc" => 13.52,
"NET_TURN" => 357.97,
"TurnoverPerc" => 13.26,
"DT_TM" => "2019-02-22T16:00:00",
"Ind_Cat" => 100,
"IndCateGoryIndex" => "Broad"
],
...
]
]
]
|
Return for $sectors->json() |
{
"nse":{
"format":"json",
"data":[
{
"index_name":"Nifty 50",
"index_date":"22-02-2019",
"open_index_value":"10782.7",
"high_index_value":"10801.55",
"low_index_value":"10758.4",
"closing_index_value":"10791.65",
"points_change":"1.8",
"change(%)":".02",
"volume":"396846597",
"turnover_(rs._cr.)":"24386.42",
"p\/e":"26.32",
"p\/b":"3.41",
"div_yield":"1.25\r"
},
{
"index_name":"Nifty Next 50",
"index_date":"22-02-2019",
"open_index_value":"25930.2",
"high_index_value":"26124",
"low_index_value":"25867.35",
"closing_index_value":"26097.55",
"points_change":"200.6",
"change(%)":".77",
"volume":"168739680",
"turnover_(rs._cr.)":"3106.73",
"p\/e":"41",
"p\/b":"3.71",
"div_yield":".94\r"
},
...
]
},
"bse":{
"format":"json",
"data":[
{
"ScripFlagCode":16,
"INDX_CD":"BSE30 ",
"IndexName":"S&P BSE SENSEX",
"I_open":35906.01,
"High":35941.69,
"Low":35795.79,
"Curvalue":35871.48,
"Prev_Close":35898.35,
"Chg":-26.87,
"ChgPer":-0.07,
"Week52High":38989.65,
"Week52Low":32483.84,
"MKTCAP":6430398.06,
"MktcapPerc":47.48,
"NET_TURN":1293.8,
"TurnoverPerc":47.93,
"DT_TM":"2019-02-22T16:00:00",
"Ind_Cat":100,
"IndCateGoryIndex":"Broad"
},
{
"ScripFlagCode":81,
"INDX_CD":"MIDCAP ",
"IndexName":"S&P BSE MidCap",
"I_open":14132.67,
"High":14183.89,
"Low":14097.79,
"Curvalue":14169.74,
"Prev_Close":14115.65,
"Chg":54.09,
"ChgPer":0.38,
"Week52High":17059.37,
"Week52Low":13538.62,
"MKTCAP":1831764.88,
"MktcapPerc":13.52,
"NET_TURN":357.97,
"TurnoverPerc":13.26,
"DT_TM":"2019-02-22T16:00:00",
"Ind_Cat":100,
"IndCateGoryIndex":"Broad"
},
...
]
}
}
|
To retrieve realtime or day end stock price from NSE / BSE, you should call the following function:
$getQuote = $object->getQuote('nse', 'INFY');
$getQuote = $object->getQuote('bse', '500209');
This function will load the data and return the object of IndianShareMarket. It accepts two parameter.
To get the response with values you should call any one function as mentioned in basic usage.
Item | Values (for nse) |
---|---|
Return for $getQuote->array() |
[
"nse" => [
"format" => "array",
"data" => [
"pricebandupper" => "807.70",
"symbol" => "INFY",
"applicableMargin" => "12.50",
"bcEndDate" => "-",
"totalSellQuantity" => "762",
"adhocMargin" => "-",
"companyName" => "Infosys Limited",
"marketType" => "N",
"exDate" => "24-JAN-19",
"bcStartDate" => "-",
"css_status_desc" => "Listed",
"dayHigh" => "743.40",
"basePrice" => "734.30",
"securityVar" => "4.95",
"pricebandlower" => "660.90",
"sellQuantity5" => "-",
"sellQuantity4" => "-",
"sellQuantity3" => "-",
"cm_adj_high_dt" => "08-FEB-19",
"sellQuantity2" => "-",
"dayLow" => "735.50",
"sellQuantity1" => "762",
"quantityTraded" => "39,98,826",
"pChange" => "1.02",
"totalTradedValue" => "29,590.91",
"deliveryToTradedQuantity" => "53.56",
"totalBuyQuantity" => "-",
"averagePrice" => "739.99",
"indexVar" => "-",
"cm_ffm" => "2,81,972.93",
"purpose" => "SPECIAL DIVIDEND - RS 4 PER SHARE",
"buyPrice2" => "-",
"secDate" => "01-Mar-2019 00 => 00 => 00",
"buyPrice1" => "-",
"high52" => "772.25",
"previousClose" => "734.30",
"ndEndDate" => "-",
"low52" => "551.00",
"buyPrice4" => "-",
"buyPrice3" => "-",
"recordDate" => "25-JAN-19",
"deliveryQuantity" => "21,41,670",
"buyPrice5" => "-",
"priceBand" => "No Band",
"extremeLossMargin" => "5.00",
"cm_adj_low_dt" => "16-APR-18",
"varMargin" => "7.50",
"sellPrice1" => "741.90",
"sellPrice2" => "-",
"totalTradedVolume" => "39,98,826",
"sellPrice3" => "-",
"sellPrice4" => "-",
"sellPrice5" => "-",
"change" => "7.50",
"surv_indicator" => "-",
"ndStartDate" => "-",
"buyQuantity4" => "-",
"buyQuantity3" => "-",
"buyQuantity2" => "-",
"buyQuantity1" => "-",
"series" => "EQ",
"faceValue" => "5.00",
"buyQuantity5" => "-",
"closePrice" => "741.90",
"open" => "735.50",
"isinCode" => "INE009A01021",
"lastPrice" => "741.80"
]
]
]
|
Return for $getQuote->json() |
{
"nse":{
"format":"json",
"data":{
"pricebandupper":"807.70",
"symbol":"INFY",
"applicableMargin":"12.50",
"bcEndDate":"-",
"totalSellQuantity":"762",
"adhocMargin":"-",
"companyName":"Infosys Limited",
"marketType":"N",
"exDate":"24-JAN-19",
"bcStartDate":"-",
"css_status_desc":"Listed",
"dayHigh":"743.40",
"basePrice":"734.30",
"securityVar":"4.95",
"pricebandlower":"660.90",
"sellQuantity5":"-",
"sellQuantity4":"-",
"sellQuantity3":"-",
"cm_adj_high_dt":"08-FEB-19",
"sellQuantity2":"-",
"dayLow":"735.50",
"sellQuantity1":"762",
"quantityTraded":"39,98,826",
"pChange":"1.02",
"totalTradedValue":"29,590.91",
"deliveryToTradedQuantity":"53.56",
"totalBuyQuantity":"-",
"averagePrice":"739.99",
"indexVar":"-",
"cm_ffm":"2,81,972.93",
"purpose":"SPECIAL DIVIDEND - RS 4 PER SHARE",
"buyPrice2":"-",
"secDate":"01-Mar-2019 00:00:00",
"buyPrice1":"-",
"high52":"772.25",
"previousClose":"734.30",
"ndEndDate":"-",
"low52":"551.00",
"buyPrice4":"-",
"buyPrice3":"-",
"recordDate":"25-JAN-19",
"deliveryQuantity":"21,41,670",
"buyPrice5":"-",
"priceBand":"No Band",
"extremeLossMargin":"5.00",
"cm_adj_low_dt":"16-APR-18",
"varMargin":"7.50",
"sellPrice1":"741.90",
"sellPrice2":"-",
"totalTradedVolume":"39,98,826",
"sellPrice3":"-",
"sellPrice4":"-",
"sellPrice5":"-",
"change":"7.50",
"surv_indicator":"-",
"ndStartDate":"-",
"buyQuantity4":"-",
"buyQuantity3":"-",
"buyQuantity2":"-",
"buyQuantity1":"-",
"series":"EQ",
"faceValue":"5.00",
"buyQuantity5":"-",
"closePrice":"741.90",
"open":"735.50",
"isinCode":"INE009A01021",
"lastPrice":"741.80"
}
}
}
|
Item | Values (for bse) |
---|---|
Return for $getQuote->array() |
[
"bse" => [
"format" => "array",
"data" => [
"CurrDate" => "Fri Mar 01 2019 16 => 00 => 02",
"PrevClose" => "733.95",
"LowVal" => "730",
"HighVal" => "745",
"Scripname" => "INFY",
"CurrVal" => "741.15",
"CurrTime" => "16 => 00",
"HighVol" => "100000"
]
]
]
|
Return for $getQuote->json() |
{
"bse":{
"format":"json",
"data":{
"CurrDate":"Fri Mar 01 2019 16:00:02",
"PrevClose":"733.95",
"LowVal":"730",
"HighVal":"745",
"Scripname":"INFY",
"CurrVal":"741.15",
"CurrTime":"16:00",
"HighVol":"100000"
}
}
}
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.