NTPClient UDP && Exchange Server delay
12
Follow
657
Followers
A function to obtain the time of the remote NTP server, which is more common in high-frequency trading or calculation delays
Source
JavaScript
function ntp_client() {
// compatible with backtesting
if (IsVirtual()) {
return new Date().getTime()
}
let client = Dial("udp://time.windows.com:123")
client.write('\x1b' + Array(47).fill('\0').join(''))
let buf = client.read()
client.close()
if (buf && buf.byteLength == 48) {
let dataView = new DataView(buf)Related strategies
Comment
All comments (0)
No data
- 1
