Most operations in the framework are asynchronous. The most obvious example is placing a trade: you send a trading request and you provide a callback function (or "completion handler", or whatever term you prefer) which the framework later calls when the action completes. For example:
Framework.SendOrder(orderDefinition, function(MsgResult) {
// Function called asynchronously by the framework when the order succeeds or fails
});
Another example would be asking the user a question by displaying the framework's standard
Framework.Ask("Are you sure?", function (Msg) {
// Called asynchronously by the framework
});
This example is in fact slightly more complicated than it looks. Your asynchronous callback from
And some types of asynchronous callback can get called multiple times. For example, if you issue a request for candle data then - unless you specifically say that you don't want streaming - your callback function will get called multiple times: with an initial batch of candles, and then with each update as the price changes and the current candle is modified or a new candle is formed. For example:
Framework.RequestCandles(candleDef, function(Msg) {
// Called repeatedly, until you terminate it with TerminateCandleRequest()
});