Introduction
Goodwill API which helps traders/investors to build, monitor and execute their trading requirement automatically.
API Endpoint
https://api.gwcindia.in/v1/
REST API URL
https://api.gwcindia.in/v1/{{api_name}}
HEADER STRUCTURE
Each rest call will have 2 compulsory header parameters
1. api_key
2. access_token
# Here is a curl example
curl --location --request GET 'https://api.gwcindia.in/v1/{{api_name}}' \
--header 'x-api-key: {{your_api_key}}' \
--header 'Authorization: Bearer {{your_access_token}}' \
# | Param | Value | Description |
---|---|---|---|
1 | x-api-key | api_key | user/partner api_key |
2 | Bearer Token | access_token | Bearer token authorization header |
api_key is a key allocated to the Goodwill User. If you don't have a api_key, signup here. Input will be in string format.
access_token is a token received as response from Login 2FA. Input will be in string format.
SUCCESSFUL RESPONSE
{
"status": "success",
"data": {}
}
Each successful response rest will have parameters
1. status
2. data
ERROR RESPONSE
{
"status": "error",
"error_msg": "Error Message",
"error_type": "GeneralException"
}
Each error response rest will have 3 parameters
1. status
2. error_msg
3. error_type
Login
Goodwill Login Flow
#Example
https://{{registered redirect URL}}?request_token={{request_token}}
# | REQUEST | RESPONSE |
---|---|---|
1 | https://api.gwcindia.in/v1/login?api_key=xxx | Redirects Goodwill Login page |
2 | After Successful Goodwill Login | request_token will be passed as query string parameter to the registered redirect URL. |
3 | https://api.gwcindia.in/v1/login-response with Signature | User Login Session Details |
Login Response
Rest Properties | Description |
---|---|
Name | Login Response |
Description | Gives the login session details with access token |
URL | https://api.gwcindia.in/v1/login-response |
Input | YES |
Input
{
"api_key": "xxxxx",
"request_token": "5ca9e0b42c4e94759030e850",
"signature": "f110112a934b7a867dfe611abb41b7274e"
}
# | Parameter | Description |
---|---|---|
1 | api_key | API Key |
2 | request_token | Received as Query String to the Redirect URL |
3 | signature | Hash value using request_token as key |
Success Response
{
{"status":"success",
"data":{
"clnt_id":"GQ1A0007",
"name":"MANOHARAN SARAVANABHAVAN",
"email":"SARAVANAKIRAN2012@GMAIL.COM",
"exarr":["BSE","NFO","NSE","MCX","ICEX"],
"prarr":["BO","CNC","CO","MIS","NRML"],
"orarr":["L","MKT","SL","SL-M"],
"exchDetail":{"EQUITY":[{"product":["BO","CNC","CO","MIS","NRML"],"exchseg":"bse_cm","exch":"BSE"},{"product":["BO","CNC","CO","MIS","NRML"],"exchseg":"nse_cm","exch":"NSE"}],"DERIVATIVE":[{"product":["BO","CO","MIS","NRML"],"exchseg":"nse_fo","exch":"NFO"}],"COMMODITY":[{"product":["BO","CO","MIS","NRML"],"exchseg":"mcx_fo","exch":"MCX"},{"product":["BO","CO","MIS","NRML"],"exchseg":"icx_fo","exch":"ICEX"}]},
"usersessionid":"3279379865",
"access_token":"8a5e32e1126025fefbcefc88eb6eb9a9"}
}
}
# | Parameter | Description |
---|---|---|
1 | client_id | Client Unique ID |
2 | name | Account name |
3 | Email id of user | |
4 | exarr | Enabled exchange in a JSON array |
5 | prarr | Enabled product type in a JSON array |
6 | orarr | Enabled order type in a JSON array |
7 | exchDetail | Exchange details JSON object |
8 | usersessionid | User session ID(Used in web sockets) |
9 | access_token | Access Token |
Error Response
{
"status": "error",
"error_msg": "Invalid Signature",
"error_type": "E"
}
# | Parameter | Description |
---|---|---|
1 | status | error |
2 | error_msg | Error Message |
3 | error_type | Error Type |
# | Error Messages | Description |
---|---|---|
1 | Invalid API key or API key expired | Input API Key is invalid or expired |
2 | Invalid Signature | Input Signature is invalid |
3 | Invalid Request Token | Input Session ID and Request Token is Invalid |
Signature
Example :
API Key="xxxxx"
request_token="5ca9e0b42c4e94759030e850"
API Secret="yyyyy"
checksum='xxxxx5ca9e0b42c4e94759030e850yyyyy'
signature=hash('sha256','xxxxx5ca9e0b42c4e94759030e850yyyyy')
To make the request secure, we have implemented parameter posting with signature (i.e. SHA-256 of checksum). Signature parameter is created by hashing the value of below mentioned parameters.
i. API Key
ii. request_token
iii. API Secret
checksum=API Key + request_token + API Secret
signature=SHA-256 of checksum
'signature' parameter is mandatory and needs to be added in login-response API
Profile
# Here is a curl example
curl --location --request GET 'https://api.gwcindia.in/v1/profile' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 05b8167eed78367034cb5ed4a8c15930'
To get characters you need to make a GET call to the following url :
https://api.gwcindia.in/v1/profile
RESPONSE ATTRIBUTES
{
"status": "success",
"data": {
"client_id": "GZXXXXX",
"name": "ESWARAN",
"email": "username@GMAIL.COM",
"exarr": [
"NSE",
"NFO",
"CDS",
"BSEFO",
"MCX",
"ICEX",
"MCXSX",
"BFO"
],
"prarr": [
{
"prd": "I",
"s_prdt_ali": "MIS",
"exch": [
"NSE",
"NFO",
"BFO",
"CDS",
"MCX"
]
}
],
"orarr": [
"MKT",
"LMT",
"SL-LMT",
"SL-MKT"
],
"exchdetail": [
"NSE",
"NFO",
"CDS",
"BSEFO",
"MCX",
"ICEX",
"MCXSX",
"BFO"
]
}
}
Attribute | Datatype | Description |
---|---|---|
client_id | string | Client Id |
name | string | Name of the Client |
string | E-mail address of the user | |
exarr | array | Array of Exchanges |
prarr | array | Array of Products |
orarr | array | Array of Ordertypes |
Balance
# Here is a curl example
curl --location --request GET 'https://api.gwcindia.in/v1/balance' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 05b8167eed78367034cb5ed4a8c15930'
To get characters you need to make a GET call to the following url :
https://api.gwcindia.in/v1/balance
{
"status": "success",
"data": {
"segment": "ALL",
"bookedpnl": "1.45",
"unbookedpnl": "0",
"openingbalance": "2016.03",
"credits": "0",
"payinamt": "0.00",
"utilizedamount": "77.04",
"payoutamt": "0.00",
"varmargin": "",
"spanmargin": "",
"realisedmtom": "1.45",
"unrealisedmtom": "",
"debits": "0"
}
}
RESPONSE ATTRIBUTES
Attribute | Datatype | Description |
---|---|---|
segment | string | Segment type - ALL |
bookedpnl | string | Booked profit and loss |
unbookedpnl | string | Unbooked profit and loss |
openingbalance | string | Opening balance or cash margin available |
credits | string | Credits |
payinamt | string | Pay in amount |
utilizedamount | string | Utilized amount |
payoutamt | string | Pay out amount |
varmargin | string | Var margin |
spanmargin | string | Span margin |
realisedmtom | string | Realised mtom |
unrealisedmtom | string | UnRealised mtom |
debits | string | debits |
Positions
# Here is a curl example
curl --location --request GET 'https://api.gwcindia.in/v1/positions' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 05b8167eed78367034cb5ed4a8c15930'
To get characters you need to make a GET call to the following url :
https://api.gwcindia.in/v1/positions
{
"status": "success",
"data": [
{
"exchange": "NSE",
"product": "MIS",
"tsym": "IDEA-EQ",
"token": "14366",
"cfbuyqty": "0",
"cfbuyavgprc": "",
"cfsellqty": "0",
"cfsellavgprc": "",
"bqty": "0",
"buyavgprc": "0.00",
"sqty": "0",
"sellavgprc": "0.00",
"netqty": "0",
"netbuyavgprc": "655.00",
"netsellavgprc": "650.00",
"netamt": "0",
"ltp": "6.60",
"bep": "",
"realisedprofitloss": "-0.75",
"unrealisedprofitloss": "0.00"
}
]
}
RESPONSE ATTRIBUTES
Parameter | Description |
---|---|
exchange | Exchange name |
product | Product code |
tsym | Trading symbol |
token | Token of the scrip |
cfbuyqty | CF buy quantity |
cfbuyavgprc | CF net buy average price |
cfsellqty | CF sell quantity |
cfsellavgprc | CF net sell average price |
bqty | Buy quantity |
buyavgprc | Buy average price |
sqty | Sell quantity |
sellavgprc | Sell average price |
netqty | Net quantity |
netbuyavgprc | Net Buy Average price |
netsellavgprc | Net Sell Average price |
netamt | Net amount |
ltp | Last trade price of the scrip |
bep | Break-even price of the position |
realisedprofitloss | Realized profit loss |
unrealisedprofitloss | Unrealized profit loss |
exitposition
# Here is a curl example
curl --location --request POST 'https://api.gwcindia.in/v1/exitposition' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 05b8167eed78367034cb5ed4a8c15930' \
To get characters you need to make a POST call to the following url :
https://api.gwcindia.in/v1/exitposition
Request example :
{ "segment":"nse_cm",
"product":"CNC",
"netqty":"1",
"token": "11915",
"tsym": "YESBANK-EQ"
}
Response example :
{
"status": "success",
"data": {
"nstordno": "23031400017243"
}
}
QUERY PARAMETERS
Request Parameter | Description | Mandatory |
---|---|---|
segment | Exchange segment name | Yes |
product | Product Code | Yes |
netqty | Net Quantity | Yes |
token | Symbol token | Yes |
tsym | Trading Symbol | Yes |
Holdings
# Here is a curl example
curl --location --request GET 'https://api.gwcindia.in/v1/holdings' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 05b8167eed78367034cb5ed4a8c15930'
To get characters you need to make a GET call to the following url :
https://api.gwcindia.in/v1/holdings
{
"status": "success",
"data": [
{
"exchange": "NSE",
"token": "11915",
"tsym": "YESBANK-EQ",
"isin": "INE528G01035",
"holdqty": "0",
"btst_qty": "1",
"sellable_qty": "1",
"average_price": "15.75",
"ltp": "15.55",
"pcode": "CNC",
"coll_qty": "",
"coll_type": ""
}
]
}
RESPONSE ATTRIBUTES
Parameter | Description |
---|---|
exchange | Exchange name |
token | Token of the scrip |
tsym | Trading symbol |
isin | ISIN |
holdqty | Holding quantity |
btst_qty | BTST quantity |
sellable_qty | Sellable quantity |
average_price | Average price |
ltp | Last trade price of the scrip |
pcode | Product code |
coll_qty | Collateral quantity |
coll_type | Collateral type |
OrderBook
# Here is a curl example
curl --location --request GET 'https://api.gwcindia.in/v1/orderbook' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 05b8167eed78367034cb5ed4a8c15930'
To get characters you need to make a GET call to the following url :
https://api.gwcindia.in/v1/orderbook
{
"status": "success",
"data": [
{
"exchange": "NSE",
"token": "14366",
"tsym": "IDEA-EQ",
"product": "CNC",
"pricetype": "MKT",
"validity": "DAY",
"price": "0.00",
"trgprc": "",
"qty": "1",
"dscqty": "0",
"trantype": "S",
"avgprc": "6.55",
"fillshares": "1",
"remarks": "",
"exchordid": "1100000017705694",
"syomorderid": "",
"nstordno": "23031400017243",
"orderentrytime": "13:10:32 14-03-2023",
"exchconfrmtime": "14-03-2023 13:10:32",
"status": "complete",
"ordvaldate": "",
"rejreason": ""
}
]
}
RESPONSE ATTRIBUTES
Attributes | Datatype | Description |
---|---|---|
exchange | string | Exchange name |
token | string | Token of the scrip |
tsym | string | Trading symbol |
product | string | Product Code |
pricetype | string | Price type |
validity | string | validity |
price | string | Price |
trgprc | string | Trigger price |
qty | string | Quantity |
dscqty | string | Disclosed quantity |
trantype | string | Transaction type |
avgprc | string | Average price |
fillshares | string | Filled Quantity |
remarks | string | Remarks |
exchordid | string | Exchange order id |
syomorderid | string | Syom Order ID |
nstordno | string | Order number |
orderentrytime | string | Order entry time |
exchconfrmtime | string | Exchange confirmation time |
status | string | Status of the order |
ordvaldate | string | Order validity date |
rejreason | string | Rejection reason |
orderhistory
# Here is a curl example
curl --location --request POST 'https://api.gwcindia.in/v1/orderhistory' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 05b8167eed78367034cb5ed4a8c15930' \
To get characters you need to make a POST call to the following url :
https://api.gwcindia.in/v1/orderhistory
Request example :
{
"nstordno": "220104000034606"
}
Response example :
{
"status": "success",
"data": [
{
"exchange": "NSE",
"tsym": "IDEA-EQ",
"product": "MIS",
"pricetype": "MKT",
"duration": "DAY",
"price": "0.00",
"trgprc": "",
"qty": "1",
"disclosedqty": "0",
"trantype": "B",
"avgprc": "6.60",
"filledshares": "1",
"orderusermessage": "",
"exchordid": "1100000017915998",
"nstordno": "23031400017379",
"status": "complete",
"rejectionreason": "",
"exchtimestamp": "14-03-2023 13:13:59",
"nestreqid": ""
},
{
"exchange": "NSE",
"tsym": "IDEA-EQ",
"product": "MIS",
"pricetype": "MKT",
"duration": "DAY",
"price": "0.00",
"trgprc": "",
"qty": "1",
"disclosedqty": "0",
"trantype": "B",
"avgprc": "",
"filledshares": "",
"orderusermessage": "",
"exchordid": "1100000017915998",
"nstordno": "23031400017379",
"status": "open",
"rejectionreason": "",
"exchtimestamp": "14-03-2023 13:13:59",
"nestreqid": ""
},
{
"exchange": "NSE",
"tsym": "IDEA-EQ",
"product": "MIS",
"pricetype": "MKT",
"duration": "DAY",
"price": "0.00",
"trgprc": "",
"qty": "1",
"disclosedqty": "0",
"trantype": "B",
"avgprc": "",
"filledshares": "",
"orderusermessage": "",
"exchordid": "",
"nstordno": "23031400017379",
"status": "open",
"rejectionreason": "",
"exchtimestamp": "",
"nestreqid": ""
},
{
"exchange": "NSE",
"tsym": "IDEA-EQ",
"product": "MIS",
"pricetype": "MKT",
"duration": "DAY",
"price": "0.00",
"trgprc": "",
"qty": "1",
"disclosedqty": "0",
"trantype": "B",
"avgprc": "",
"filledshares": "",
"orderusermessage": "",
"exchordid": "",
"nstordno": "23031400017379",
"status": "open",
"rejectionreason": "",
"exchtimestamp": "",
"nestreqid": ""
}
]
}
REQUEST PARAMETERS
Request Parameter | Description | Mandatory |
---|---|---|
nstordno | Order Number | Yes |
RESPONSE ATTRIBUTES
# | Parameter | Description |
---|---|---|
1 | exchange | Exchange |
2 | tsym | Trading symbol |
3 | product | Product code |
4 | pricetype | Price type |
5 | duration | Order duration |
6 | price | Price |
7 | trgprc | Trigger Price |
8 | qty | Quantity |
9 | disclosedqty | Disclosed quantity |
10 | trantype | Transaction type |
11 | avgprc | Average price |
12 | filledshares | filledShares |
13 | orderusermessage | Order User Message |
14 | exchordid | Exchange Order id |
15 | nstordno | Order number |
17 | status | Status of the order |
18 | rejectionreason | Rejection reason |
19 | exchtimestamp | Exchange time stamp |
20 | reqid | Request id |
tradebook
# Here is a curl example
curl --location --request GET 'https://api.gwcindia.in/v1/tradebook' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 05b8167eed78367034cb5ed4a8c15930'
To get characters you need to make a GET call to the following url :
https://api.gwcindia.in/v1/tradebook
{
"status": "success",
"data": [
{
"exchange": "NSE",
"tsym": "IDEA-EQ",
"product": "MIS",
"pricetype": "MKT",
"trantype": "S",
"qty": "1",
"exchordid": "1100000010905576",
"nstordno": "23031400011069",
"exchtime": "14-03-2023 11:33:50",
"price": "0.00"
}
]
}
RESPONSE ATTRIBUTES
Attributes | Datatype | Description |
---|---|---|
exchange | string | Exchange |
tsym | string | Trading Symbol |
product | string | Product code |
pricetype | string | Price type of the Trade |
trantype | string | Trasaction type(B/S) |
qty | string | Quantity |
exchordid | string | Exchange Order ID |
nstordno | string | Order ID |
exchtime | string | Exchange time |
price | string | Price |
placeorder
# Here is a curl example
curl --location --request POST 'https://api.gwcindia.in/v1/placeorder' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 05b8167eed78367034cb5ed4a8c15930' \
To get characters you need to make a POST call to the following url :
https://api.gwcindia.in/v1/placeorder
Request example :
{
"tsym": "YESBANK-EQ",
"exchange":"NSE",
"trantype":"B",
"validity":"DAY",
"pricetype":"MKT",
"qty":"1",
"discqty":"0",
"price":"0",
"trgprc":"0",
"product":"CNC",
"amo":"NO"
}
Response example :
{
"status": "success",
"data": {
"nstordno": "220104000034606"
}
}
QUERY PARAMETERS
Request Parameter | Description | Mandatory |
---|---|---|
tsym | Trading Symbol | Yes |
exchange | Exchange name | Yes |
trantype | Transtaction Type | Yes |
validity | Validity - It can be one of the following DAY IOC |
Yes |
pricetype | It can be one of the following MKT - Market Order L - Limit Order SL-L - Stop Loss Limit Order SL-M - Stop Loss Market Order |
Yes |
qty | Quantity | Yes |
discqty | Disclosed Quantity | Yes |
price | Price | Yes |
trgprc | Trigger Price | Yes |
product | Product Code | Yes |
amo | AMO - It can be one of the following YES NO |
Yes |
placecoorder
# Here is a curl example
curl --location --request POST 'https://api.gwcindia.in/v1/placecoorder' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 05b8167eed78367034cb5ed4a8c15930' \
To get characters you need to make a POST call to the following url :
https://api.gwcindia.in/v1/placecoorder
Request example :
{
"tsym": "YESBANK-EQ",
"exchange":"NSE",
"trantype":"B",
"validity":"DAY",
"pricetype":"MKT",
"qty":"1",
"discqty":"0",
"price":"0",
"stop_price":"0",
"amo":"NO"
}
Response example :
{
"status": "success",
"data": {
"nstordno": "220104000034607"
}
}
QUERY PARAMETERS
Request Parameter | Description | Mandatory |
---|---|---|
tsym | Trading Symbol | Yes |
exchange | Exchange name | Yes |
trantype | Transtaction Type | Yes |
validity | Validity - It can be one of the following DAY IOC |
Yes |
pricetype | It can be one of the following MKT - Market Order L - Limit Order SL-L - Stop Loss Limit Order SL-M - Stop Loss Market Order |
Yes |
qty | Quantity | Yes |
discqty | Disclosed Quantity | Yes |
price | Price | Yes |
stop_price | Stop Price | Yes |
amo | AMO - It can be one of the following YES NO |
Yes |
placeboorder
# Here is a curl example
curl --location --request POST 'https://api.gwcindia.in/v1/placeboorder' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 05b8167eed78367034cb5ed4a8c15930' \
To get characters you need to make a POST call to the following url :
https://api.gwcindia.in/v1/placeboorder
Request example :
{
"exchange":"NSE",
"tsym": "YESBANK-EQ",
"trantype":"B",
"qty":"1",
"validity":"DAY",
"discqty":"0",
"price":"14",
"squareoff":"15",
"stoploss":"13",
"trailing_ticks":"0",
"pricetype":"L",
"trgprc":"0"
}
Response example :
{
"status": "success",
"data": {
"nstordno": "220104000034606"
}
}
QUERY PARAMETERS
Request Parameter | Description | Mandatory |
---|---|---|
exchange | Exchange name | Yes |
tsym | Trading Symbol | Yes |
trantype | Transtaction Type | Yes |
qty | Quantity | Yes |
validity | Validity - It can be one of the following DAY IOC |
Yes |
discqty | Disclosed Quantity | Yes |
price | Price | Yes |
squareoff | Square Off | Yes |
stoploss | Stop Loss | Yes |
trailing_ticks | Trailing Ticks | Yes |
pricetype | It can be one of the following MKT - Market Order L - Limit Order SL-L - Stop Loss Limit Order SL-M - Stop Loss Market Order |
Yes |
trgprc | Trigger Price | Yes |
modifyorder
# Here is a curl example
curl --location --request POST 'https://api.gwcindia.in/v1/modifyorder' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 3e81bfb2a1ef11d3bd3e9a8966d4d51e' \
To get characters you need to make a POST call to the following url :
https://api.gwcindia.in/v1/modifyorder
Request example :
{ "exchange":"NSE",
"tsym": "YESBANK-EQ",
"nstordno":"23031400017379",
"trantype":"B",
"pricetype":"MKT",
"price":"0",
"qty":"1",
"discqty":"0",
"trgprc":"0",
"validity":"DAY",
"filledqty":"1",
"product":"CNC"
}
Response example :
{
"status": "success",
"data": {
"result": "23031400017379"
}
}
QUERY PARAMETERS
Request Parameter | Description | Mandatory |
---|---|---|
exchange | Exchange name | Yes |
tsym | Trading Symbol | Yes |
nstordno | Order ID | Yes |
trantype | Transaction type(B/S) | Yes |
pricetype | Type of order. It can be one of the following MKT - Market Order L - Limit Order SL-L - Stop Loss Limit Order SL-M - Stop Loss Market Order |
Yes |
price | Price at which the order was placed | Yes |
qty | Quantity with which the order was placed | Yes |
discqty | Disclosed Quantity | Yes |
trgprc | Trigger Price | Yes |
validity | Validity | Yes |
filledqty | Filledqty | Yes |
product | Product Code | Yes |
modifyboorder
# Here is a curl example
curl --location --request POST 'https://api.gwcindia.in/v1/modifyboorder' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 3e81bfb2a1ef11d3bd3e9a8966d4d51e' \
To get characters you need to make a POST call to the following url :
https://api.gwcindia.in/v1/modifyboorder
Request example :
{ "exchange":"NSE",
"tsym": "BHEL-EQ",
"nstordno":"23042400028714",
"pricetype":"L",
"price":"74",
"qty":"1",
"discqty":"0",
"trgprc":"78",
"validity":"DAY",
"trailing_ticks":"0",
"stoploss":"1",
"squareoff":"1"
}
Response example :
{
"status": "success",
"data": {
"result": "23042400028714"
}
}
QUERY PARAMETERS
Request Parameter | Description | Mandatory |
---|---|---|
exchange | Exchange name | Yes |
tsym | Trading Symbol | Yes |
nstordno | Order ID | Yes |
pricetype | Type of order. It can be one of the following MKT - Market Order L - Limit Order SL-L - Stop Loss Limit Order SL-M - Stop Loss Market Order |
Yes |
price | Price at which the order was placed | Yes |
qty | Quantity with which the order was placed | Yes |
discqty | Disclosed Quantity | Yes |
trgprc | Trigger Price | Yes |
validity | Validity | Yes |
trailing_ticks | Trailing Ticks | Yes |
stoploss | Stoploss | Yes |
squareoff | Squareoff | Yes |
modifycoorder
# Here is a curl example
curl --location --request POST 'https://api.gwcindia.in/v1/modifycoorder' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 3e81bfb2a1ef11d3bd3e9a8966d4d51e' \
To get characters you need to make a POST call to the following url :
https://api.gwcindia.in/v1/modifycoorder
Request example :
{ "exchange":"NSE",
"tsym": "ZOMATO-EQ",
"nstordno":"23042400032632",
"pricetype":"SL-L",
"price":"74",
"qty":"1",
"discqty":"0",
"trgprc":"78",
"validity":"DAY",
"trailing_ticks":"0",
"stoploss":"1"
}
Response example :
{
"status": "success",
"data": {
"result": "23042400032632"
}
}
QUERY PARAMETERS
Request Parameter | Description | Mandatory |
---|---|---|
exchange | Exchange name | Yes |
tsym | Trading Symbol | Yes |
nstordno | Order ID | Yes |
pricetype | Type of order. It can be one of the following MKT - Market Order L - Limit Order SL-L - Stop Loss Limit Order SL-M - Stop Loss Market Order |
Yes |
price | Price at which the order was placed | Yes |
qty | Quantity with which the order was placed | Yes |
discqty | Disclosed Quantity | Yes |
trgprc | Trigger Price | Yes |
validity | Validity | Yes |
trailing_ticks | Trailing Ticks | Yes |
stoploss | Stoploss | Yes |
CancelOrder
# Here is a curl example
curl --location --request POST 'https://api.gwcindia.in/v1/cancelorder' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 3e81bfb2a1ef11d3bd3e9a8966d4d51e' \
To get characters you need to make a POST call to the following url :
https://api.gwcindia.in/v1/cancelorder
Request example :
{
"nstordno":"220106000024964"
}
Response example :
{
"status": "success",
"data": {
"result": "220106000024964"
}
}
QUERY PARAMETERS
Request Parameter | Description | Mandatory |
---|---|---|
nstordno | Order Number | Yes |
Exit BO Order
# Here is a curl example
curl --location --request POST 'https://api.gwcindia.in/v1/exitboorder' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 3e81bfb2a1ef11d3bd3e9a8966d4d51e' \
To get characters you need to make a POST call to the following url :
https://api.gwcindia.in/v1/exitboorder
Request example :
{
"nstordno":"220106000024964"
}
Response example :
{
"status": "success",
"data": {
"result": "success"
}
}
QUERY PARAMETERS
Request Parameter | Description | Mandatory |
---|---|---|
nstordno | Order Number | Yes |
Exit CO Order
# Here is a curl example
curl --location --request POST 'https://api.gwcindia.in/v1/exitcoorder' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 3e81bfb2a1ef11d3bd3e9a8966d4d51e' \
To get characters you need to make a POST call to the following url :
https://api.gwcindia.in/v1/exitcoorder
Request example :
{
"nstordno":"220106000024964"
}
Response example :
{
"status": "success",
"data": {
"result": "success"
}
}
QUERY PARAMETERS
Request Parameter | Description | Mandatory |
---|---|---|
nstordno | Order Number | Yes |
Position Conversion
# Here is a curl example
curl --location --request POST 'https://api.gwcindia.in/v1/positionconversion' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 3e81bfb2a1ef11d3bd3e9a8966d4d51e' \
To get characters you need to make a POST call to the following url :
https://api.gwcindia.in/v1/positionconversion
Request example :
{
"exchange":"NSE",
"tsym":"IDEA-EQ",
"qty":"1",
"prev_product":"CNC",
"trantype":"B",
"new_product":"MIS"
}
Response example :
{
"status": "success",
"data": {
"result": "success"
}
}
QUERY PARAMETERS
Request Parameter | Description | Mandatory |
---|---|---|
exchange | Exchange name | Yes |
tsym | Trading Symbol | Yes |
qty | Quantity | Yes |
prev_product | Previous Product | Yes |
trantype | Transtaction Type | Yes |
new_product | New product | Yes |
GetQuote
# Here is a curl example
curl --location --request POST 'https://api.gwcindia.in/v1/getquote' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 6cb7ac3a5a73831ec88ee8915bee3f2a' \
To get characters you need to make a POST call to the following url :
https://api.gwcindia.in/v1/getquote
Request example :
{
"exchange":"NSE",
"token":"11915"
}
Response example :
{
"status": "success",
"data": {
"symbol_name": "YESBANK",
"trading_symbl": "YESBANK-EQ",
"token": "11915",
"company_name": "YES BANK LIMITED",
"last_trade_time": "13:18:29",
"last_price": "15.65",
"change": "0.0",
"change_per": "0.0",
"last_quantity": "1",
"buy_quantity": "37308286",
"sell_quantity": "26519029",
"volume": "119231098",
"average_price": "15.66",
"open": "15.70",
"high": "15.95",
"low": "15.45",
"close": "15.65",
"tick_size": "0.05",
"multiplier": "1",
"lot_size": "1",
"decimalprecision": "2",
"yearly_low_price": "12.10",
"yearly_high_price": "24.75"
}
}
QUERY PARAMETERS
Request Parameter | Description | Mandatory |
---|---|---|
exchange | Exchange | Yes |
token | Token | Yes |
RESPONSE ATTRIBUTES
Attributes | Datatype | Description |
---|---|---|
symbol_name | string | Symbol Name |
trading_symbl | string | Trading Symbol |
token | string | Symbol Token |
company_name | string | Company Name |
last_trade_time | string | Last Traded Time |
last_price | string | Last Traded Price |
change | string | Change Price |
change_per | string | Change Percentage |
last_quantity | string | Last Traded Quantity |
buy_quantity | string | Buy Quantity |
sell_quantity | string | Sell Quantity |
volume | string | Volume |
average_price | string | Average Price |
open | string | Open |
high | string | High |
low | string | Low |
close | string | Close |
tick_size | string | Tick Size |
multiplier | string | Multiplier |
lot_size | string | Lot Size |
decimalprecision | string | Decimal Precision |
yearly_low_price | string | Yearly low price |
yearly_high_price | string | Yearly high price |
Fetch Symbol
# Here is a curl example
curl --location --request POST 'https://api.gwcindia.in/v1/fetchsymbol' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 6cb7ac3a5a73831ec88ee8915bee3f2a' \
To get characters you need to make a POST call to the following url :
https://api.gwcindia.in/v1/fetchsymbol
Request example :
{
"s":"RELIANCE"
}
Response example :
{
"status": "success",
"data": [
{
"exchange": "NSE",
"token": "2885",
"symbol": "RELIANCE-EQ",
"trading_symbol": "RELIANCE-EQ",
"company_name": "RELIANCE INDUSTRIES LTD",
"expiry_date": "",
"expiry_date_desc": "",
"strike_price": "",
"lot_size": "1"
}
]
}
QUERY PARAMETERS
Request Parameter | Description | Mandatory |
---|---|---|
s | Search Symbol | Yes |
RESPONSE ATTRIBUTES
Attributes | Datatype | Description |
---|---|---|
exchange | string | Exchange |
token | string | Symbol Token |
symbol | string | Symbol |
trading_symbol | string | Trading Symbol |
company_name | string | Company Name |
expiry_date | string | Expiry Date |
expiry_date_desc | string | Expiry Date Description |
strike_price | string | Strike Price |
lot_size | string | Lot size |
Logout
# Here is a curl example
curl --location --request GET 'https://api.gwcindia.in/v1/logout' \
--header 'x-api-key: 2e4c1f0ac084dd6b30fd808e016be3f0' \
--header 'Authorization: Bearer 6cb7ac3a5a73831ec88ee8915bee3f2a'
To get characters you need to make a GET call to the following url :
https://api.gwcindia.in/v1/logout
Result Example:
{
"status": "success",
"data": {
"check": "OK"
}
}
RESPONSE ATTRIBUTES
Attribute | Datatype | Description |
---|---|---|
check | string | OK / NOT_OK |
Web Socket
Description
It will create a web socket connection
Web socket url :
wss://giga.gwcindia.in/NorenWSTP/
URL
wss://giga.gwcindia.in/NorenWSTP/
Request example(To connect to websocket) :
{
"channel": "",
"task":"cn",
"acctid": "GQ1A0007",
"user": "GQ1A0007",
"token": "3279379865"
}
Request example(For subscribing index) :
{
"channel": "bse_cm|SENSEX&nse_cm|Nifty 50&nse_cm|Nifty Bank&nse_cm|India VIX",
"task":"sfi",
"acctid": "GQ1A0007",
"user": "GQ1A0007",
"token": "3279379865"
}
Request example(For market watch) :
{
"channel": "nse_cm|10940",
"task":"mw",
"acctid": "GQ1A0007",
"user": "GQ1A0007",
"token": "3279379865"
}
Request example(For market depth) :
{
"channel": "nse_cm|10940",
"task":"dp",
"acctid": "GQ1A0007",
"user": "GQ1A0007",
"token": "3279379865"
}
Input
# | Parameter | Mandatory | Description |
---|---|---|---|
1 | channel | YES | -> Scrip Subscription Scrip list to subscribed in below format for task "mw"? nse_cm|22&bse_cm|1523&… For CSE statistics feed sample input : cse_cm|Equity&cse_cm|Fixed Income -> Index Subscription for subscribing index send channel like below indexExch1 | indexName1 & indexExch2 | indexName2&... above index default value you will get from MarketWatch rest api in indexValues parameter. For further set of index details refer Index details API . -> Other Subscriptions channel will be a blank string for task other than “mw" and “sfi" |
2 | task | YES | task list is given below |
3 | acctid | YES | Account ID |
4 | user | YES | User id |
5 | token | YES | User session ID (from Login Success Response(usersessionid)) |
NOTE
1. General instruction doesn't hold good for this API. There will be above input parameter sent in JSON format for all type of task. There is no encryption for this parameter.
2. To stop (unsubscribe) index/scrip feed you need to send "channel" parameter in input JSON object as blank string.
3. To start (subscribe) feed (index/scrip)you need to send input JSON object with "channel" value as mentioned in document
4. Index Feed : If ampersand (&) value exists in index value , need to replace with exclamatory symbol (!) .
Eg : bse_cm|BSE Oil&Gas to be sent as bse_cm|BSE Oil!Gas.
Task List
# | Task Name | Description |
---|---|---|
1 | cn | To connect to websocket or to async servlet |
2 | mw | For market watch |
3 | sfi | For subscribing index |
4 | os | For subscribing order status / order update |
5 | dp | For market depth |
First connect to web socket using “cn" task and then subscribe scrip using “mw" task ( Acknowledgement response : {ak: ok, msg:mw, task:mw}) . To do reconnect to web socket we need to send task as “cn" and do the subscription again. To do subscribe for index socket should be connected first.
Response
Connect
# | Parameter | Description |
---|---|---|
1 | ak | ok / nk |
2 | msg | connected |
3 | task | cn |
Index Feed
# | Parameter | Description |
---|---|---|
1 | name | if -> If value comes as "if" it’s a index feed |
2 | tk | scrip token |
3 | e | Exchange |
4 | c | index close value |
5 | nc | % change |
6 | cng | Change |
7 | iv | Index value |
8 | tvalue | Update time |
Scrip Feed
# | Parameter | Description |
---|---|---|
1 | name | sf -> If value comes as "sf" it's a scrip feed |
2 | tk | scrip token |
3 | e | Exchange |
4 | ltp | Last traded price |
5 | c | Previous close price |
6 | nc | % change |
7 | cng | Change |
8 | v | Volume |
9 | bq | Best buy quantity |
10 | bp | Best buy price |
11 | bs | Best sell quantity |
12 | sp | Best sell price |
13 | ltq | Last traded quantity |
In above table name will come for all the subscription we made such as scrip feed, index feed, time feed etc which is not implemented as of now, for scrip feed name value will be “sf". If a response doesn't contain name parameter it can be considered as acknowledgement response such as heart beat, connect. If name value comes as “if" it means it is a feed for index.
Order Status Feed
# | Parameter | Description |
---|---|---|
1 | name | osf |
2 | tt | Transaction type |
3 | a | Account id |
4 | u | User id |
5 | qtf | Quantity |
6 | ptf | Price |
7 | os | Order status |
8 | pt | Price type |
9 | non | order number |
10 | fs | Filled quantity |
11 | uf | Unfilled size |
12 | od | Order duration |
13 | rpt | report type |
14 | tk | token or symbol |
15 | eoi | exchange order id |
16 | ts | Trading symbol |
17 | reqid | Request id |
18 | discqty | Disclosed quantity |
19 | fillprc | Trade Price |
20 | trigprc | Trigger Price |
21 | ordgentype | Order generation type ( isAMO) |
22 | prod | Product code |
23 | exchtim | Exchange Timestamp |
24 | syomid | Sym order id |
25 | fillid | Trade id |
26 | valdate | Valid date |
27 | oumsg | Order user message |
Market Depth Feed
# | Parameter | Description |
---|---|---|
1 | name | dp |
2 | bp | Best Buy Price 1 |
3 | sp | Best Sell Price 1 |
4 | bq | Best buy quantitiy 1 |
5 | bs | Best sell quantity 1 |
6 | bno | Best Buy no of orders 1 |
7 | sno | Best Sell no of orders 1 |
8 | bp1 | Best Buy Price 2 |
9 | sp1 | Best Sell Price 2 |
10 | bq1 | Best buy quantitiy 2 |
11 | bs1 | Best sell quantity 2 |
12 | bno1 | Best Buy no of orders 2 |
13 | sno1 | Best Sell no of orders 2 |
14 | bp2 | Best Buy Price 3 |
15 | sp2 | Best Sell Price 3 |
16 | bq2 | Best buy quantitiy 3 |
17 | bs2 | Best sell quantity 3 |
18 | bno2 | Best Buy no of orders 3 |
19 | sno2 | Best Sell no of orders 3 |
20 | bp3 | Best Buy Price 4 |
21 | sp3 | Best Sell Price 4 |
22 | bq3 | Best buy quantitiy 4 |
23 | bs3 | Best sell quantity 4 |
24 | bno3 | Best Buy no of orders 4 |
25 | sno3 | Best Sell no of orders 4 |
26 | bp4 | Best Buy Price 5 |
27 | sp4 | Best Sell Price 5 |
28 | bq4 | Best buy quantitiy 5 |
29 | bs4 | Best sell quantity 5 |
30 | bno4 | Best Buy no of orders 5 |
31 | sno4 | Best Sell no of orders 5 |
-> Response will be received in JSON Array with compressed and base64 encoded format
-> You need decode and decompress it
-> Please don't assume that you will have all the parameters in the response for below reason.
-> The data you see is the market data that we receive from the exchange. The exchange works in such a manner that as soon as any data (be it an any parameter) based on the parameter received by the exchange, the exchanges passes the same to us. Lets taken a example if am I buyer and I want to place an order at x price, then what the exchange will do is that it will see the price sent by you and display based on the prevailing orders that are available at the exchange, suppose if any other order is above you price it will display your price as the second best price. This is applicable for both best buy and sell. There other parameters that you see are the actual value based on the trades (LTP). So in certain situation there can be only the buyers willing to buy and sell but the trade might not happen based on the price quotes by the users at that instance you will receive only the best bid a bid best ask. It will not have LTP.
Appendix
Postman Collection
Download and import the postman collection from here
Exchange List
NSE - EQUITY
BSE - EQUITY
MCX - COMMODITY
NFO - DERIVATIVE
CDS - CURRENCY
Exchange Segment
nse_cm - NSE EQUITY
bse_cm - BSE EQUITY
nse_fo - NFO DERIVATIVE
mcx_fo - MCX COMMODITY
Product Codes
NRML - NORMAL
CNC - Cash and Carry
MIS - Intraday
CO - Cover order
BO - Bracket order
Order Types
L - LIMIT
MKT - Market
SL-L - Stop Loss Limit
SL-M - Stop Loss Market
Transaction Types
B - Buy
S - Sell