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

Syntax 

GetRequotedOrders ()

Description

The GetReqoutedOrders operation is used to retrieve the orders which have been re-quoted by a dealer for the selected account.

Dependencies

You might use this operation based on the result of the GetAccountReflection operation. Check Reflection Flags.

Response Elements

Name Description 
Result

In case of success, this operation returns a list (of OrderAudit), OrderAudit’s members are:

  • Client: Client ID.
  • Account: Account number.
  • OrderType:
    1: means market order.
    2: means limit order.
    3: means Stop loss order type.
    4: means take profit order type.
  • OrderID: Order ID.
  • OrderStatus. 
  • OrLiId.
  • OrCpIoId: Order ID for close position.
  • Time: Order time.
  • NewBuy: New buy Price.
  • NewSell: New sell price.
  • Amount: Amount of lots.
  • Symbol: Symbol name.
  • OldBuy: Old Buy price
  • OldSell: Old Sell Price.
  • BuySell: The type of operation (1 for buy, -1 sell ).

Otherwise see Error codes.
Type: JSON as List ( of OrderAudit ).

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>Get Requoted Orders</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<script >
var urlStr = "http://5.10.64.199/vertexweb10/WebService.svc";
jQuery.support.cors = true;
function onSuccessReflectionOrder(dataResult) {
var rst = "";
result = eval('(' + dataResult + ')');
if (result.AccountRef.length > 1) {
for (var i = 0; i < result.AccountRef.length; i++) {
$("#resultAction").html($("#resultAction").html() + "<br/>" + rst);
if (parseInt(result.AccountRef[i]) == 20) {
rst = "when AccountRef property has value 20 then Price has been Changed . you should Get Requoted Orders and update the Open Positions , pending orders and Account Summary"
GetRequotedOrders();
}

rst = rst.fontcolor("red");
rst = rst.bold();
}
}
$("#resultAction").html($("#resultAction").html() + "<br/>" + rst);
GetClientReflection(result.ClientRef)
setTimeout('GetReflection()', '2000');

}
function onSuccessResultOrder(dataResult) {
var result = eval(dataResult);
var rst = ""
if (result[0] > 0) {
//if result[6]=1 , then Open Position has been done
if (result[6] == 1) {
rst += "Order has been done successfully! the following is the open position details : </br>"
rst += "Ticket ID:" + 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 = "http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1964"
$("#resultAction").html("Error Code : " + rst + "<br/>" + " for more details see the following 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 following link: " + rst.link(rst));
}
}
function GetClientReflection(result) {
var rst = ""
for (var i = 0; i < result.length; i++) {
if (parseInt(result[i]) == 30) {
rst = "A new Mail has been received ,, you should Update the mails by get the New mail .Initially,call GetMails method "
rst = rst.fontcolor("green");
rst = rst.bold();
$("#resultAction").html($("#resultAction").html() + "<br/>" + rst);
}
else if (parseInt(result[i]) == 29) {
rst = "delete Mail reflection has been received ,, you should update your mails .Initially , call GetMails method "
rst = rst.fontcolor("green");
rst = rst.bold();
$("#resultAction").html($("#resultAction").html() + "<br/>" + rst);
}
else if (parseInt(result[i]) < 0) {
var errDetail = "http://www.hybrid-solutions.com/support/index.php?/Knowledgebase/Article/View/1964"
errDetail = errDetail.link(errDetail);
errDetail = errDetail.fontcolor("green");
errDetail = errDetail.bold();
$("#resultAction").html("Error Code : " + dataResult + "<br/>" + " for more details see the follwing link: " + errDetail);
}
}
}

function GetRequotedOrders() {
$.ajaxSetup({ "cash": false });
$.getJSON(urlStr + "/GetRequotedOrders?callback=?", onSuccessResultAction);
}
function GetReflection() {
$.getJSON(urlStr + "/GetReflection?AccID=" + $("#txtAccID").val() + "&callback=?" , onSuccessReflectionOrder);
}
function onSuccessResultAction(dataResult) {
var result = eval(dataResult);
var strResult = ""
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>"
if (parseInt(result[i].BuySell) == 1) {
strResult = strResult + "BuySell Type :" + "Buy" + "</br>"
}
else {
strResult = strResult + "BuySell Type :" + "Sell" + "</br>"
}
strResult = strResult + "Old Price :" + result[i].OldSell + "</br>"
strResult = strResult + "New Price :" + result[i].NewSell + "</br>"
strResult = strResult + note.bold() + "</br>" + "</br>" + "</br>"
}
}
$("#resultAction").html($("#resultAction").html() + "<br/>" + strResult);
//setTimeout('GetRequotedOrders()', '2000');

}

$(document).ready(function () {
jQuery.support.cors = true
$("#progress").ajaxStart(function () { $(this).css("display", "block"); });
$("#progress").ajaxComplete(function () { $(this).css("display", "none"); });
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 occurred'); });
function onErrorResult(result) {
alert('Service call failed : ' + result.status + ' ' + result.statusText);
}
$("#btnLogin").click(function () {
$.getJSON(urlStr + "/Login?username=" + $("#txtusername").val() + "&password=" + $("#txtpassword").val() + "&callback=?", onSuccessResult);
});
$("#btn_Action").click(function () {
GetReflection();
});
$("#btnActionNewOrder").click(function () {
$.getJSON(urlStr + "/NewOrder?AccountId=" + $("#txtAccID").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="txtAccID" value=""/>
<td>Symbol: <input type="text" id="txtSymbol" value ="" /> </td>
</tr>
<tr>
<td>BuySell: <input type="text" id="txtBuySell" value ="" /></td>
<td>lots:<input type="text" id="txtlots" value ="" /></td>
<td><button id="btnActionNewOrder"> NewOrder </button></td>
<td><button id="btn_Action"> Start GetReflection </button></td>
</tr>
</td>
<td><button id="btnAction"> Start GetRequotedOrders </button></td>
</tr>
</tbody>
</table>
Note: you should press at get reflection to get Requoted orders (in case the reflection result = 20)
<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