getMargins("equity") giving wrong data

yc_mhk
What I'm trying to do is-To get margin available for trading initially and the margin available after placing a order. Here is the sample code:
getMargins("equity");
regularOrderPlace('regular');//place some10 stocks for RELIANCE
var millisecondsToWait = 2000;
setTimeout(function() {
getMargins("equity");
}, millisecondsToWait);

In above code, getMargins('equity') inside the timeout function doesn't return the updated margin rather it gives the initial margin that i got the from line 1.

But a strange thing is when i remove the first line i.e getMargins("equity") ,i get the correct margin that is available after placing the order. Is there something I am missing out kindly clarify.
Tagged:
Sign In or Register to comment.