websocket interface Speed testing with REST interface, support for adding multiple exchange tests, note that it will briefly increase the frequency of your API calls, make sure it runs without affecting the running of other bots. If an error occurs in the Futures_OP 4: argument error tab, please update to the latest host program Special warning: only exchanges that support websocket interface can be added (a bit of nonsense, do not support websocket interface, what speed do you measure), otherwise you will get an error, currently ok, tokens provide websocket interface, BTCCC does not provide, otherwise please consult the relevant exchange API introduction or help
var Interval=1000; function _N(v, precision) { if (typeof (precision) != 'number') { precision = 4; } var d = parseFloat(v.toFixed(Math.max(10, precision + 5))); s = d.toString().split("."); if (s.length < 2 || s[1].length <= precision) { return d; } var b = Math.pow(10, precision); return Math.floor(d * b) / b; } function onexit() { Log("【【【系统退出】】】"); } function main() { var start=Date.now(); for (var i = 0; i < exchanges.length; i++) { var ecg=exchanges[i]; //Log(ecg); ecg.IO("rest");//rest 模式 var iii=0; var sum=0; while (iii<=10) { //连续调用10次,取平均值 var account = null; start=Date.now(); account = ecg.GetAccount(); //测试执行的API函数,可根据需要自己修改,如 GetTick iii=iii+1; if(account){ var delay=(Date.now()-start); sum=sum+delay; } Sleep(1000); } Log("平均毫秒数【"+_N(sum/iii,2)+"】"+ecg.GetName()+" rest"); ecg.IO("websocket"); //websocket 模式 sum=0; iii=0; while (iii<=10) { //连续调用10次,取平均值 var account = null; start=Date.now(); account = ecg.GetAccount(); //测试执行的API函数,可根据需要自己修改,如 GetTick iii=iii+1; if(account){ var delay=(Date.now()-start); sum=sum+delay; } Sleep(1000); } Log("平均毫秒数【"+_N(sum/iii,2)+"】"+ecg.GetName()+" websocket"); } }
The old man.2016-01-08 23:37:00 Error TypeError: undefined is not a function Adding tokens and errors in post-ok tests
The old man.There's a problem with the code.
The bride too.Asked about ok's technology, ok futures support websocket. However, regardless of the type of api, there is a frequency limit of 5 minutes, 3000 times.
momoxAnd I'm going to have to limit it, and that's also a question, okay, but the websocket might be a relative rest stable point.
The bride too.Thank you. Let me ask you something. If it were a websocket, the exchange wouldn't limit the frequency, would it?
momoxI don't know about futures, but I'm not sure if it supports websocket.
The bride too.The custodian has upgraded to 2.87, Ok futures still reporting Futures_OP 4: argument error
momoxWhat's the problem, I just ran it and didn't find it? Note that the current support for websocket interfaces seems to be just ok and tokens, so adding these two to the run is fine, and without support for things like BTCCC, the run will definitely go wrong.