我想在提取完成时获取返回的数据,因为在完全提取后正确的时间戳将在那里,但是该函数将返回带有空时间戳而不是所有数据的最新时间戳的链接。
async function pushData(url) {
let settings = { method: "Get" };
let timestamp = "";
let i = 0;
fetch(url, settings)
.then(res => res.json())
.then((json) => {
json.forEach(function (object) {
console.log(object);
i++;
});
timestamp = json[i-1].timestamp;
});
return await 'https://www.bitmex.com/api/v1/trade?count=1000&symbol=XBTUSD&startTime=' + timestamp;
}
var test = pushData('https://www.bitmex.com/api/v1/trade?count=1000&symbol=XBTUSD');
console.log(test);
幕布斯7119047
相关分类