Delayed processing of petitions

Author: wcg123, Created: 2018-02-27 14:26:47, Updated: 2018-02-27 15:22:33

During the testing of the TA library indicators on the platform, Log showed the indicator values of the PERIODM5 and the array of Records, which were updated at a point in time when retesting, however, in the real disk it was found that the value of the previous cycle was updated every time the time cycle passed about 3 to 4 seconds. Ali Yun, who rents in southern China, connects to OKEX futures. I've tested GetRecords and the latency is no more than 100ms, what's the problem?

function main(){
    while(true){
        exchange.SetMarginLevel(10);
        exchange.SetContractType("quarter");                            
        var beginTime = new Date().getTime()
        var records = exchange.GetRecords(PERIOD_M5)
        var endTime = new Date().getTime()
        LogStatus("GetRecords 接口延迟时间:", endTime - beginTime, "毫秒。")
        
        Sleep(500)
    }
}

More

The Little DreamIt is true that the exchange updates the K-line with a delay of 3 seconds or synthesizes the K-line itself using ticker data.

wcg123For example, records that require a 5-minute cycle from 0 to 0 to 0 to 0 would theoretically get the value of the previous 5-minute cycle at 0 to 0 to 0 to 0 seconds, but I would need to run the real disk for 3 to 4 seconds to see the update.

The Little DreamHowever, in the real disk, it is found that the value of the previous cycle is updated every 3-4 seconds after the time cycle.

nxtplayerBecause of the flute, I tried to change the sky too.

wcg123I noticed that Huobi's getrecords update was delayed by 5s.

nxtplayerThis is embarrassing.

wcg123It's like the OKEX platform updating the K-line meeting card in three seconds.

nxtplayerYou get a bar every 1 second, monitor the time of the bar, and if the time changes, there's a new bar, then compare it.