Syntax
GetMWNewTick ()
Description
The GetMWNewTick operation is used to get the market watch symbol data if changed and returns a list of symbols which holds all symbols with their corresponding Bid/Ask, High/Low.
Note: This operation does not require a login session to get the data.
Request Parameters
No Request parameters.
Response Elements
Name |
Description |
Result |
This operation returns the following:
- TickTime: Time of the tick when requested the NewTick.
- Symbols: As list ( of type Symbol ).
The following are the Symbol's data members:
1 - I: Which means symbol ID. 2 - B: Which means Bid price. 3 - A: Which means Ask price. 4 - H: Which means High price. 5 - L: Which means Low price.
|
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>GetMWNewTick</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<script >
$(document).ready(function () {
var urlStr = "http://webtrader.hybridsolutions.com/publicweb/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 onErrorResult(result) {
alert('Service call failed : ' + result.status + ' ' + result.statusText);
}
$("#btnLogin").click(function () {
$.getJSON(urlStr + "/Login?username=" + $("#txtusername").val() + "&password=" + $("#txtpassword").val() + "&callback=?", onSuccessResult);
});
$("#btnAction").click(function () {
$.getJSON(urlStr + "/GetMWNewTick?" + "callback=?", onSuccessResult);
function onSuccessResult(dataResult) {
dataResult = eval('(' + dataResult + ')');
$("#resultAction").html("Tick Time " + dataResult.TickTime);
if (dataResult.Symbols.length > 0) {
var myTable = '<table border="1px"><thead>' +
'<tr><th>ID </th><th> High</th>' +
'<th >Low</th><th>Ask</th><th>Bid</th></tr></thead><tbody>';
for (var i = 0; i <= dataResult.Symbols.length - 1; i++) {
myTable += "<tr>"
myTable += "<td>" + dataResult.Symbols[i].I + "</td>"
myTable += "<td>" + dataResult.Symbols[i].H + "</td>"
myTable += "<td>" + dataResult.Symbols[i].L + "</td>"
myTable += "<td>" + dataResult.Symbols[i].A + "</td>"
myTable += "<td>" + dataResult.Symbols[i].B + "</td>"
myTable += "</tr>"
}
myTable += '</tbody></table>';
$("#resultAction").html(myTable);
}
}
});
});
</script>
<body>
<table border="1px">
<tbody>
<tr>
<td><button id="btnAction"> GetMWNewTick </button></td>
</tr>
</tbody>
</table>
<div id="resultData"> </div>
<div id="resultAction"> </div>
<div style="display:none" id="progress">Loading ... </div>
</body>
</html>
.
See Also
VertexFX WCF Service Index
|