Fixed problem with inactive polymarket markets

This commit is contained in:
NunoSempere 2021-04-09 16:51:25 +02:00
parent 6f70199f60
commit 112f56b6a3

View File

@ -23,7 +23,7 @@ async function fetchAllContractInfo() { // for info which the polymarket graphql
} }
async function fetchAllContractData() { async function fetchAllContractData() {
let daysSinceEra = Math.round(Date.now() / (1000 * 24 * 60 * 60)) - 2 let daysSinceEra = Math.round(Date.now() / (1000 * 24 * 60 * 60)) - 7 // last week
let response = await axios({ let response = await axios({
url: graphQLendpoint, url: graphQLendpoint,
method: 'POST', method: 'POST',
@ -31,7 +31,7 @@ async function fetchAllContractData() {
data: JSON.stringify(({ data: JSON.stringify(({
query: ` query: `
{ {
fixedProductMarketMakers(first: 300 fixedProductMarketMakers(first: 1000
where: { where: {
lastActiveDay_gt: ${daysSinceEra} lastActiveDay_gt: ${daysSinceEra}
}){ }){
@ -72,7 +72,7 @@ async function fetch_all() {
let address = info.marketMakerAddress let address = info.marketMakerAddress
let addressLowerCase = address.toLowerCase() let addressLowerCase = address.toLowerCase()
//delete info.history //delete info.history
if (info.outcomes[0] != "Long" || info.outcomes[1] != "Short") if (info.outcomes[0] != "Long" || info.outcomes[1] != "Long")
combinedObj[addressLowerCase] = { combinedObj[addressLowerCase] = {
title: info.question, title: info.question,
url: "https://polymarket.com/market/" + info.slug, url: "https://polymarket.com/market/" + info.slug,