资源加载中... loading...

每日市价定投

Author: cdxy, Date: 2019-06-07 15:34:53
Tags: Tool




function main() {
   Log(exchange.GetAccount());

   
   //最近一次投资的日期
   var lastInvestDate = '';

   while (true) {
       //每次轮询,间隔时间为60秒
       Sleep(60 * 1000);

       //如果当前日期和最近一次投资日期相同,说明当天已经投过了,跳过
       var now = new Date();
       var date = now.toISOString().slice(0,10);
       if (date == lastInvestDate) {
           continue;
       }

       lastInvestDate = date;
       Log("日期: " + date);

    
       exchange.Buy(-1, singleInvestAmount);
   }
}


Related

More

keep_up 不尽长江滚滚来

fmzero 圣杯啊