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);
}
}