Files
strategies/每日市价定投.md
T

61 lines
860 B
Markdown
Raw Normal View History

2019-07-09 12:09:54 +08:00
2023-07-14 18:39:48 +08:00
> Name
2019-07-09 12:09:54 +08:00
每日市价定投
2023-07-14 18:39:48 +08:00
> Author
2019-07-09 12:09:54 +08:00
cdxy
2023-07-14 18:39:48 +08:00
> Strategy Arguments
2019-07-09 12:09:54 +08:00
2023-07-14 18:39:48 +08:00
|Argument|Default|Description|
2019-07-09 12:09:54 +08:00
|----|----|----|
|singleInvestAmount|true|市价买入|
2023-07-14 18:39:48 +08:00
> Source (javascript)
2019-07-09 12:09:54 +08:00
``` javascript
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);
}
}
```
2023-07-14 18:39:48 +08:00
> Detail
2019-07-09 12:09:54 +08:00
https://www.fmz.com/strategy/151259
2023-07-14 18:39:48 +08:00
> Last Modified
2019-07-09 12:09:54 +08:00
2019-06-07 16:26:19