Remove price alert
Attention: All examples in the documents contain the data not carrying any actual information!
This example was made using open source library jQuery
Description of server request parameters and a sample response:
The service enables removing price alerts
Limit on inquiries per minute: Unlimited
Request:
{
"cmd" (string) :"togglePriceAlert",
"params" (array) :{
"id" (number) :116071,
"del" (boolean) :true,
"quote_type" (string) :"ltp",
"notification_type" (string) :"email"
}
}
Base parameter | Parameter | Type | Description |
cmd | String | Name of the method invoked | |
params | array | Parameter array | |
params | id | number | unique alert ID |
params | del | boolean | Alert removal feature |
params | quote_type | string |
type of the price underlying the alert calculation.
Possible values are described in the table: Price type description |
params | notification_type | string |
type of notification.
Possible values are described in the table: Notification type description |
Price type | Description |
ltp | last trade price |
bap | the best bid price |
bbp | the best ask price |
op | opening price |
pp | closing price |
type of notification | Description |
by mail only | |
sms | only via SMS |
push | push notification |
all | via SMS and email |
Response:
{
"added" (boolean):true
}
Base parameter | Parameter | Type | Description |
added | boolean | Deliverable |
Error examples
//Common error
{
"code" (number) : 1,
"errMsg" (string) : "No \"params\" key in request object"
}
Base parameter | Parameter | Type | Description |
code | number | Code error. The meaning of the codes can be viewed on the page "A list of the codes and errors" | |
errMsg | string | Error description. The meaning of the errors can be viewed on the page "A list of the codes and errors" |
Examples of using
-
Browser
/** * Removing price alert * @param {string} id * @param {function} callback */ function removePriceAlert(id, callback) { var removeData = { "cmd": "togglePriceAlert", "params":{ "id":"134216", "del":true, "quote_type":"ltp", "notification_type":"email" } }; var params = { q: JSON.stringify(removeData) }; $.ajax({ url: 'https://tradernet.com/api/', xhrFields: { withCredentials: true }, data: params, type: 'GET', success: callback, error: callback }); } removePriceAlert("247", console.info.bind(console));