Quellcode durchsuchen

交易量字段容错

JiahengHe vor 3 Wochen
Ursprung
Commit
36ea92caf5
1 geänderte Dateien mit 6 neuen und 1 gelöschten Zeilen
  1. 6 1
      src/robot.js

+ 6 - 1
src/robot.js

@@ -539,7 +539,12 @@ function robotAmount(app) {
                 app.nowBalance = d.now_balance
                 app.posNum = d.pos
                 app.nowPrice = d.now_price
-                app.tradeVolume = d.trading_volume
+                if (!obj.hasOwnProperty(fieldName) || obj[fieldName] === null || obj[fieldName] === undefined){
+                    app.tradeVolume = 0
+                } else {
+                    app.tradeVolume = d.trading_volume
+                }
+
 
                 //余额有变动上报一次
                 // logger.info(`余额当前:${(app.nowBalance + "")}--${(d.now_balance + "")}--`);