Loading ...

币安小额资产转换

Author: xunfeng91, Date: 2022-10-08 18:02:07
Tags:


//小额资产转换为BNB
function autoswaptobnb() {
    var ret = exchange.IO("api", "POST", "/sapi/v1/asset/dust-btc")
    Sleep(100)
    var dustarr = []

    for (var i = 0; i < ret.details.length; i++) {
        dustarr.push(ret.details[i].asset)
    }
    if (dustarr.length > 0) {
      Log("将进行小额资产转换", dustarr)
      var obj
      if (dustarr.length == 1) {
        obj = "asset=" + dustarr[0] + "&timestamp=" + new Date().getTime()
      }
      if (dustarr.length > 1) {
        obj = "asset=" + dustarr[0]
        for (var i = 1; i < dustarr.length; i++) {
          obj = obj + "&asset=" + dustarr[i]
        }
        obj = obj + "&timestamp=" + new Date().getTime()
      }
      var ret = exchange.IO("api", "POST", "/sapi/v1/asset/dust", obj)
      Log("小额资产转换完成")
      Log(ret)
    }
  }
  
  function main() {
      autoswaptobnb()
  }

More