GetAccountTransactions
Posted by Mohammad Rahhal, Last modified by Rawan Al Hourani on 30 December 2018 08:57 AM

Syntax

 GetAccountTransactions(AccountId As Long , FromDate As String, ToDate as String)

Description

The GetAccountTransactions operation returns a 2 Dimensional String array which holds a statement of the closed transactions data


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

FromDate
  • Starting date for account transactions query.
  • Type: String
  • Default: 01/01/1900 or minimum date
  • Constraints: Must be in dd/MM/yyyy format.

 

No

ToDate
  • Ending date for account transactions query.
  • Type: String
  • Default: System date
  • Constraints: Must be in dd/MM/yyyy format

 

No


Response Elements

Name Description 
Result
  • This operation returns 2D string array of Account Transactions upon success as listed order:

        0- Ticket/ Order

        1- Date/ Time

        2- Transaction Type
             - N : Which means New order
             - L : Which means liquidate order
             - SL : Which means Sell Limit / Stop loss
             - BL : Which means Buy Limit 
             - BS : Which means Buy Stop
             - SS : Which means sell step
             - TP : Which means  take profit
             - DP : Which means Deposit
             - Wd: Which means Withdrawal 
             - Aj :  Which means Adjustment
             - Ci :  Which means Credit In
             -Co : Which means Credit Out

        3- SymbolID

        4- Amount

        5- Buy/Sell

        6- Open DateTime

        7- OpenPrice/ SL( Stop loss value )

        8- Close Price/ TP (Take Profit value)

        9- Amount of (DP/ WD/ AJ/Ci/CO)

        10- Commission

        11- Interest

        12- Profit / loss value 

        13- Symbol Name 

        14 - Method

  • Otherwise an explicit error code is returned at the first array element. 
  • Type: 2D Array of String


Sample

 

<!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>GetAccountTransactions</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<script>
$(document).ready(function () {
var urlStr = "https://webtrader.hybrid-solutions.com/webtrader/webservice.svc";
jQuery.support.cors = true;
$("#progress").ajaxStart(function () { $(this).css("display", "block"); });
$("#progress").ajaxComplete(function () { $(this).css("display", "none"); });
$("#resultAction").ajaxError(function (result) { $(this).html('An error occured'); });





function onSuccessResultt(dataResult) {
var result = eval(dataResult);
var rst = ""
if (result[0][0] > 0) {
for (var i = 0; i < result.length-1; i++) {
rst += "Ticket : " + result[i][0] + "<br/>"
rst += "Date/Time : " + result[i][1] + "<br/>"
rst += "Type : " + result[i][2] + "<br/>"
rst += "SymbolID : " + result[i][3] + "<br/>"
rst += "Amount : " + result[i][4] + "<br/>"
rst += "BuySell : " + result[i][5] + "<br/>"
rst += "OpenTime : " + result[i][6] + "<br/>"
rst += "OpenPrice/SL : " + result[i][7] + "<br/>"
rst += "ClosePrice/TP : " + result[i][8] + "<br/>"
rst += "Amount(DP/WD/AJ): : " + result[i][9] + "<br/>"
rst += "Commission : " + result[i][10] + "<br/>"
rst += "Interest : " + result[i][11] + "<br/>"
rst += "PL : " + result[i][12] + "<br/>"
rst += "SymbolName : " + result[i][13] + "<br/>"
rst += "method : " + result[i][14] + "<br/>"
rst += "------------------------------------------------------------" + "<br/>"
$("#resultAction").html(rst)
}
}
else {
$("#resultAction").html("Error Code : " + result[0][0] + "<br/>" );
}
}



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);
}
}
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 () {
$.getJSON(urlStr + "/GetAccountTransactions?AccountId=" + $("#txtClientID").val() + "&FromDate=" + $("#txtFromDate").val() + "&ToDate=" + $("#txtToDate").val()+ "&callback=?", onSuccessResultt);
});
});
</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="txtClientID" value ="" />
FromDate : <input type="text" id="txtFromDate" value=""/>
ToDate : <input type="text" id="txtToDate" value="" />
</td>
</tr>
<tr>
<td>
<button id="btnAction"> GetAccountTransactions </button>
</td>
</tr>
</tbody>
</table>
<div id="resultData"> </div>
<div id="resultAction"> </div>
</body>
</html>

 


See Also


VertexFX Backoffice WCF Service Index

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