2024-09-23 05:58
IndustrySynchronous and Asynchronous Execution
Synchronous and Asynchronous Execution
"... Synchronous trade operation methods, send requests to the server and wait for the server response, then pass execution to the statements that follow.
In asynchronous operation, when a request is send to the server, the program continues to execute the next statements, without waiting for the response from the server. The statements that follow the asynchronous trade operation request cannot assume anything about the result of those requests.
For example, if the program sends a request to execute a market order and then continues to place a limit order, the request to place a limit order will most probably be send to the server before the response is received, that position is opened, for instance. When the server response is received, the program can pass execution control to a callback function, then the necessary statements will be executed according to whether the operation was successful or not. We cover callbacks at the end of this section.
The benefit of using asynchronous execution is that a potentially time consuming process of waiting for the response from the server is avoided. Instead, execution continues and when the response arrives, control is passed to a callback if one is specified.
Do not confuse asynchronous operation with multi-threading. At any given time only one method can be invoked. cAlgo never invokes your methods in parallel so you don’t have to worry about multi-threading issues...."
Like 0
FX1824085384
Trader
Hot content
Industry
Event-A comment a day,Keep rewards worthy up to$27
Industry
Nigeria Event Giveaway-Win₦5000 Mobilephone Credit
Industry
Nigeria Event Giveaway-Win ₦2500 MobilePhoneCredit
Industry
South Africa Event-Come&Win 240ZAR Phone Credit
Industry
Nigeria Event-Discuss Forex&Win2500NGN PhoneCredit
Industry
[Nigeria Event]Discuss&win 2500 Naira Phone Credit
Forum category
Platform
Exhibition
Agent
Recruitment
EA
Industry
Market
Index
Synchronous and Asynchronous Execution
| 2024-09-23 05:58
Synchronous and Asynchronous Execution
"... Synchronous trade operation methods, send requests to the server and wait for the server response, then pass execution to the statements that follow.
In asynchronous operation, when a request is send to the server, the program continues to execute the next statements, without waiting for the response from the server. The statements that follow the asynchronous trade operation request cannot assume anything about the result of those requests.
For example, if the program sends a request to execute a market order and then continues to place a limit order, the request to place a limit order will most probably be send to the server before the response is received, that position is opened, for instance. When the server response is received, the program can pass execution control to a callback function, then the necessary statements will be executed according to whether the operation was successful or not. We cover callbacks at the end of this section.
The benefit of using asynchronous execution is that a potentially time consuming process of waiting for the response from the server is avoided. Instead, execution continues and when the response arrives, control is passed to a callback if one is specified.
Do not confuse asynchronous operation with multi-threading. At any given time only one method can be invoked. cAlgo never invokes your methods in parallel so you don’t have to worry about multi-threading issues...."
Like 0
I want to comment, too
Submit
0Comments
There is no comment yet. Make the first one.
Submit
There is no comment yet. Make the first one.