The resource loading... loading...

Write an example of recording a token transaction for recording historical data, why is there only one record at the same time when running?

Author: igagix, Created: 2018-10-30 00:28:47, Updated: 2018-10-30 00:41:13

img

    function main(){
        var tradesData = "";
        while(true){
        var huobiTrades = exchanges[0].GetTrades()[0];
   	    if(tradesData != huobiTrades['Time']){
            tradesData = huobiTrades['Time']; //赋值唯一时间戳
   		    
            var tradesType = "买入";//定义买卖类型及颜色
            var tradesTypeColor = "#32CD99";
            
            if (huobiTrades['Type'] == 1) {
        	    tradesType = "卖出";
        	    tradesTypeColor = "#CC3299";
            }

        //日志输出
        Log(tradesType, "时间:", 
        	_D(huobiTrades['Time']), "交易金额:", 
        	huobiTrades['Price'], "交易数量:", 
        	huobiTrades['Amount'], tradesTypeColor);
   	}
}
}

More

Inventors quantify - small dreamsYes, this interface is usually an exchange that returns a certain amount of transaction information. It usually has an ID and a time stamp to judge if the data has been obtained.

dajiahaoGetTrades))) [0] You only take the first item, sometimes multiple items.

Inventors quantify - small dreamsIf the transaction is not active, the same transaction information may be returned in a short time, and the ID may be the same.

igagixCoin

Inventors quantify - small dreamsHey, which exchange is this?

igagixYesterday, during the test, I just came across the output of a record, which was misguided. And now the returned ID is the same, which was later changed to the time stamp to judge. Thank you both confused.

igagixThank you.