- 策略广场
- 宏观数据获取演示
宏观数据获取演示
Author:
扫地僧, Date: 2024-02-02 10:09:58
Tags:
/*backtest
start: 2021-02-01 00:00:00
end: 2024-02-01 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_CTP","currency":"FUTURES"}]
*/
function main() {
let preData = null
while (true) {
// 数据源必须要有time,data两个字段在schema里描述
let obj = exchange.GetData("https://www.datadata.cn/api/v1/query/a10ea45c-1674-48ef-b414-cc17a7e4a548/data")
if (obj.Data != preData) {
let info = JSON.parse(obj.Data)
Log(`数据时间: ${_D(obj.Time)}, 新增投资者${info.add_investor}万户, 上证指数: ${info.close_price}`)
preData = obj.Data
}
Sleep(PERIOD_D1*1000)
}
}
更多内容