Events-driven issues when retesting

Author: lightring, Created: 2019-06-19 21:50:30, Updated:

As for the re-test run, the program is running as it is, not very clear, so I don't understand the behavior of the program very well, please answer!

The following code is an example:

function onTick() {
    Log(exchange.GetTicker());
    Log(exchange.GetTicker());
}
function main() {
    exchange.SetContractType("this_week");
    while (true) {
        onTick();
        Sleep(1000);
    }
}

If the hard drive is runningRunning the process is easy to understand, the main ((() function is a dead loop, where two ticker data are obtained for each Sleep ((1000) and printed out, the two ticker data should be very close.

When the retest is runningAt this time Sleep ((1000) is obviously not really sleeping, and it's like exchange.GetTicker ((() moves the simulated ticker time forward to the next step every time it is called. And, if you don't write the onTick function, the program is like a really dead loop, it doesn't end.

Please tell me, when running the retest, what events are going through the ticker step by step in the driver?


More

The Little DreamIn addition, the report also highlighted the importance of the consultation mechanism, not the event-driven mechanism.

lightringUnderstood, thank you!

The Little DreamAccess GetTicker, which runs backwards in time sequence.

lightringSo, when is the ticker going to go backwards when the retest is running?