Knowledgebase:
GetReflection
Posted by Mohammad Rahhal, Last modified by Rawan Al Hourani on 13 February 2018 10:44 AM

Syntax 

GetReflection( AccID As Long )

Description

The GetReflection operation is used to retrieve all account updates flags, So needed to make all account data current and up to date for the current logged in client.

Request Parameters

Name Description  Required
AccID
  • The intended account identifier.
  • Type: Long.
  • Default: None.
  • Constraints: Must be a valid account ID, and accessible by logged in client.
 Yes

 Response Elements

Name Description 
Result

In case of success, this operation returns a string array that holds the Client or Account Reflection flags

Otherwise, see Error codes.
Type: JSON object as String array

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>GetReflection</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 onSuccessResultOrder(dataResult) {
var rst = "No Reflection";
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]) == 1) {
rst = "when AccountRef property has value 1 then close open position Reflcetion has been occured . you should reflecsh the open positions , Account summary and pending Order "
}
else if (result.AccountRef[i] == 3) {
rst = "when AccountRef property has value 3 then Delete Close Position Reflcetion has been occured . you should refresh the open positions and Account Summary"
}
else if (result.AccountRef[i] == 4) {
rst = "when AccountRef property has value 4 then Delete Open Position Reflcetion has been occured . you should refresh the Open Positions and Accouont Summary "
}
else if (result.AccountRef[i] == 5) {
rst = "when AccountRef property has value 5 then the account has been liquidate . you can show a liquidate message "
}
else if (result.AccountRef[i] == 7) {
rst = "when AccountRef property has value 7 then Limit SLTP Orders has been Updated . you should refresh the open positions , Pending Orders and Account Summary "
}
else if (result.AccountRef[i] == 8) {
rst = "when AccountRef property has value 8 then a new updated for account Summary . you should refresh the account summary "
}
else if (result.AccountRef[i] == 11) {
rst = "when AccountRef property has value 11 then Delete Pending Order reflection had been occured . you should update the open position , Pending Orders and Account Summary "
}
else if (result.AccountRef[i] == 13) {
rst = "when AccountRef property has value 13 then a new account history has been occured ,, you should update the Account summary "
}
else if (result.AccountRef[i] == 14) {
rst = "when AccountRef property has value 14 then a New Limit SLTP Order has been occured . update the open positions , pending orders and Account Summary "
}
else if (parseInt(result.AccountRef[i]) == 15) {
rst = "when AccountRef property has value 15 then a New Position occured . upadte the open positions and Account Summary"
}
else if (result.AccountRef[i] == 16) {
rst = "when AccountRef property has value 16 then Updated Open Position Reflection occured . you should update the open positions and Account summary "
}
else if (result.AccountRef[i] == 18) {
rst = "when AccountRef property has value 18 then Accept New Order Reflection occured .you should update the open position , pending orders and Account Summary "
}
else if (result.AccountRef[i] == 19) {
rst = "when AccountRef property has value 18 then Accept Close Order Reflection occured . you should update the open position , pending orders and Account Summary"
}
else if (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"
}
else if (result.AccountRef[i] == 22) {
rst = "when AccountRef property has value 22 then invalid price when order rejected . you should update pending orders "
}
else if (result.AccountRef[i] == 23) {
rst = "when AccountRef property has value 23 then Accept Limit Order occured . you should upadte the open positions , pendings orders and Account Summary"
}
else if (result.AccountRef[i] == 24) {
rst = "when AccountRef property has value 24 then Cancel Limit Order occured . you should upadte the pending orders"
}
else if (result.AccountRef[i] == 25) {
var orderID = getPendingOrdersBuff(SelectedAccount, "cncl-hdg");
getPendingOrders(SelectedAccount);
}
else if (result.AccountRef[i] == 26) {
rst = "when AccountRef property has value 26 then Accept SlTp Order occured . you should update the open positions ,pending orders and Account summary"
}
else if (result.AccountRef[i] == 27) {
rst = "when AccountRef property has value 27 then Cancel SLTP Order occured . you should update the open positions , pending orders and Account Summary"
}
else if (result.AccountRef[i] == 21) {//Hedging is not allowed
rst = "when AccountRef property has value 21 then Hedging is not allowed. you should update the Pending Orders"
}
rst = rst.fontcolor("red");
rst = rst.bold();
}
}
$("#resultAction").html($("#resultAction").html() + "<br/>" + rst);
GetClientReflection(result.ClientRef)
setTimeout('GetReflection()', '2000');
}
function GetClientReflection(result) {
var rst = ""
for (var i = 0; i < result.length; i++) {
if (parseInt(result[i]) == 30) {
rst = "A new Mail has been recieved ,, 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 recieved ,, 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 GetReflection() {
$.getJSON(urlStr + "/GetReflection?AccID=" + $("#txtAccID").val() + "&callback=?" , onSuccessResultOrder);
}
$(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 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);
});
$("#btnAction").click(function () {
GetReflection();
});
$("#btnNewOrder").click(function () {
$.getJSON(urlStr + "/NewOrder?AccountId=" + $("#txtAccID").val() + "&Symbol=" + $("#txtSymbol").val() + "&BuySell=" + $("#txtBuySell").val() + "&lots=" + $("#txtlots").val() + "&Note=" + $("#txtNote").val() + "&callback=?", onResultOrder);
});
function onResultOrder(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] + "Order/Position :" + result[6]
$("#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 follwing link: " + errDetail.link(errDetail));
}
}
}
});
</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>AccID:<input type="text" id="txtAccID" value=""/>
<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>Note :<input type="text" id="txtNote" value ="" /></td>
<td><button id="btnNewOrder"> NewOrder </button></td>
</tr>
</td>
<td><button id="btnAction"> Start GetReflection </button></td>
</tr>
</tbody>
</table>
Note: We have tow type of reflection as the following :
<br/>
1- Account Reflection : appeared in red color
<br/>
2- Client Reflection : appeared in green color
<div id="resultData"> </div>
<div id="resultAction"> </div>
<div style="display:none" id="progress">Loading ... </div>
</body>
</html>

 

 


See Also


VertexFX WCF Service Index

(3 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