Knowledgebase:
ClientRejectOrder
Posted by Mohammad Rahhal, Last modified by Eyad Alhaj Hammad on 22 January 2017 03:43 PM

Syntax 

ClientRejectOrder (AccountID As Long , OrderID As Long)

Description

The ClientRejectOrder operation is used to reject a re-quoted order at specific account number.

Dependencies

In order to obtain the requoted orders you’ll need to invoke GetReqoutedOrders operation.

Request Parameters

Name Description  Required
AccountId
  • The intended account identifier.
  • Type: Long.
  • Default: None.
  • Constraints: Must be a valid account ID, and accessible by logged in client.
Yes
OrderId
  • The order to be rejected identifier.
  • Type: Integer.
  • Default: Long.
  • Constraints: Must be a valid order for the given AccountId.
Yes


Response Elements

Name Description 
Result

In case of success, this operation returns Order Id that had been rejected.

Otherwise, see
 Error Codes
Type: JSON object as String.


Sample

Download sample as text file.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ClientRejectOrder</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<script >
var urlStr = "http://5.10.64.199/vertexweb10/WebService.svc";
function RejectOrder(OrderID) {
$.getJSON(urlStr + "/ClientRejectOrder?AccountID=" + $("#txtAccountId").val() + "&OrderID=" + OrderID + "&callback=?", onSuccessResultOrder);
function onSuccessResultOrder(dataResult) {
var result = eval(dataResult.d);
var rst = ""
if (result > 0) {
var strAcceptOrder = "The OrderId is :" + result + "and it has been rejected ... "
$("#resultAction").html($("#resultAction").html() + "<br/>" + strAcceptOrder.fontcolor("red"));
}
else {
rst = "http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1964"
$("#resultAction").html("Error Code : " + result + "<br/>" + " for more details see the follwing link: " + rst.link(rst));
}
}
}
function onSuccessResultOrder(dataResult) {
var result = eval(dataResult);
var rst = ""
if (result[0] > 0) {
//if result[6]=1 , then Open Postion has been done
if (result[6] == 1) {
rst += "Order has been done successfully! the following is the open position details : </br>"
rst += "OrderID:" + result[0] + " Time :" + result[1] + " Amount :" + result[3] + " Symbol ID:" + result[4] + " Open Price:" + result[5]
$("#resultAction").html(rst);
}
//if result[6]=2 , then pending order has been done
else if (result[6] == 2) {
rst += "Order has been done successfully! the following is the pending Order details : </br>"
rst += "OrderID:" + result[0] + " Time :" + result[1] + " Amount :" + result[3] + "Symbol ID:" + result[4] + "Open Price:" + result[5]
$("#resultAction").html(rst);
}
else {
var rst = "www.hybrid-solutions/support/index.php?/knowledgebase/Article/View/1964"
$("#resultAction").html("Error Code : " + rst + "<br/>" + " for more details see the follwing link: " + rst.link(rst));
}
}
else {
var rst = "www.hybrid-solutions/support/index.php?/knowledgebase/Article/View/1964"
$("#resultAction").html("Error Code : " + result[0] + "<br/>" + " for more details see the follwing link: " + rst.link(rst));
}
}
function GetRequotedOrders() {
$.ajaxSetup({ "cash": false });
$.getJSON(urlStr + "/GetRequotedOrders?callback=?", onSuccessResultAction);
}
function onSuccessResultAction(dataResult) {
var result = eval(dataResult);
var strResult = ""
var notifyStr = ""
if (result.length == 0) {
strResult = "No result ";
}
else {
var note = "Call ClientAcceptOrder() or ClientRejectOrder() method to accept or reject the Requoted Order "
for (var i = 0; i < result.length; i++) {
strResult = strResult + "OrderID :" + result[i].OrderID + "</br>"
notifyStr = "OrderID :" + result[i].OrderID + "\n"
if (parseInt(result[i].BuySell) == 1) {
strResult = strResult + "BuySell Type :" + "Buy" + "</br>"
notifyStr = notifyStr + "BuySell Type :" + "Buy" + +"\n"
}
else {
strResult = strResult + "BuySell Type :" + "Sell" + "</br>"
notifyStr = notifyStr + "BuySell Type :" + "Sell" + +"\n"
}
strResult = strResult + "Old Price :" + result[i].OldSell + "</br>"
notifyStr = notifyStr + "Old Price :" + result[i].OldSell + "\n"
strResult = strResult + "New Price :" + result[i].NewSell + "</br>"
notifyStr = notifyStr + "New Price :" + result[i].NewSell + "\n"
strResult = strResult + note.bold() + "</br>" + "</br>" + "</br>"
// use to reject order when the dealer requote it
alert(notifyStr + "\nPress Ok to Reject Order");
RejectOrder(result[i].OrderID)
}
}
$("#resultAction").html($("#resultAction").html() + "<br/>" + strResult);
setTimeout('GetRequotedOrders()', '2000');
}
$(document).ready(function () {
$.support.cors = true;
$("#progress").ajaxStart(function () { $(this).css("display", "block"); });
$("#progress").ajaxComplete(function () { $(this).css("display", "none"); });
$.ajaxSetup({ "cash": false });
function onSuccessResult(response) {
response = eval('(' + response + ')')
if (response.UserId == -1 || response.UserId == -207) {
$("#resultData").html("Invalid username or password");
}
else if (response.UserId == -231) {
$("#resultData").html("You must have at least one account");
}
else if (response == null || response == "" || response.UserId < 0) {
$("#resultData").html("Error while login.Please try later");
}
else {
$("#resultData").html("SuccessResult ... UserId is :" + response.UserId);
}
}
$("#resultAction").ajaxError(function (result) { $(this).html('An error occured'); });
function onErrorResult(result) {
alert('Service call faild : ' + result.status + ' ' + result.statusText);
}
$("#btnLogin").click(function () {
$.getJSON(urlStr + "/Login?username=" + $("#txtusername").val() + "&password=" + $("#txtpassword").val() + "&callback=?" , onSuccessResult);
});
$("#btnActionNewOrder").click(function () {
$.getJSON(urlStr + "/NewOrder?AccountId=" + $("#txtAccountId").val() + "&Symbol=" + $("#txtSymbol").val() + "&BuySell=" + $("#txtBuySell").val() + "&lots=" + $("#txtlots").val() + "&callback=?", onSuccessResultOrder);
});
$("#btnAction").click(function () {
GetRequotedOrders();
});
});
</script>
<body>
<table border="1px">
<tbody>
<tr>
<td>
Username: <input type="text" id="txtusername" value=""/>
Password: <input type="text" id="txtpassword" value=""/>
<button id="btnLogin"> Login </button>
</td>
</tr>
<tr>
<td>AccountId : <input type="text" id="txtAccountId" value ="" /> </td>
<td>Symbol: <input type="text" id="txtSymbol" value ="" /> </td>
<td>BuySell: <input type="text" id="txtBuySell" value ="" /></td>
</tr>
<tr>
<td>lots:<input type="text" id="txtlots" value ="" /></td>
<td><button id="btnActionNewOrder"> NewOrder </button></td>
<td><button id="btnAction"> Start GetRequotedOrders and Reject Orders </button></td>
</tr>
</tbody>
</table>
Note: Press (Start GetRequotedOrders and Reject Orders) button to start listening, after take order and the dealer Requote it ..... wait while a new message appeared to reject the order.
<div id="resultData"> </div>
<div id="resultAction"> </div>
<div style="display:none" id="progress">Loading ... </div>
</body>
</html>

 

 


See Also


VertexFX WCF Service Index

(0 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).

Help Desk Software by Hybrid Solutions