fix: Update polymarket endpoint

This commit is contained in:
NunoSempere 2021-09-22 19:29:23 +02:00
parent c08ee19479
commit c573c1a2a6
8 changed files with 6546 additions and 2051 deletions

2252
metaforecasts.tsv Normal file

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@ const DEBUG_MODE = "off" // "on"
/* Support functions */
async function fetchPage(page, cookie){
console.log(page)
console.log(`Page #${page}`)
if(page==1){
cookie=cookie.split(";")[0] // Interesting that it otherwise doesn't work :(
}

View File

@ -70,7 +70,7 @@ export async function metaculus() {
console.log("Sleeping for 5secs")
await sleep(5000)
}
console.log(`Query #${i}`)
console.log(`\nQuery #${i}`)
let metaculusQuestions = await fetchMetaculusQuestions(next)
let results = metaculusQuestions.results;
let j=false
@ -127,7 +127,7 @@ export async function metaculus() {
//"last_activity_time": result.last_activity_time,
})
if (Number(result.number_of_predictions) >= 10) {
console.log(` ${interestingInfo.title}`)
console.log(`- ${interestingInfo.title}`)
all_questions.push(interestingInfo)
if(!j && (i % 20 == 0)){
console.log(interestingInfo)

View File

@ -5,7 +5,7 @@ import { calculateStars } from "../utils/stars.js"
import {upsert} from "../utils/mongo-wrapper.js"
/* Definitions */
let graphQLendpoint = "https://api.thegraph.com/subgraphs/name/polymarket/matic-markets-4"// "https://api.thegraph.com/subgraphs/name/tokenunion/polymarket-matic"//"https://subgraph-matic.poly.market/subgraphs/name/TokenUnion/polymarket"//"https://subgraph-backup.poly.market/subgraphs/name/TokenUnion/polymarket"//'https://subgraph-matic.poly.market/subgraphs/name/TokenUnion/polymarket3'
let graphQLendpoint = "https://api.thegraph.com/subgraphs/name/polymarket/matic-markets-5"// "https://api.thegraph.com/subgraphs/name/polymarket/matic-markets-4"// "https://api.thegraph.com/subgraphs/name/tokenunion/polymarket-matic"//"https://subgraph-matic.poly.market/subgraphs/name/TokenUnion/polymarket"//"https://subgraph-backup.poly.market/subgraphs/name/TokenUnion/polymarket"//'https://subgraph-matic.poly.market/subgraphs/name/TokenUnion/polymarket3'
let units = 10 ** 6
/* Support functions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,13 @@
/* Imports */
import fs from "fs"
import { mongoReadWithReadCredentials } from "./mongo-wrapper.js"
import { mongoReadWithReadCredentials } from "../mongo-wrapper.js"
/* Definitions */
/* Utilities */
/* Support functions */
let getQualityIndicators = forecast => Object.entries(forecast.qualityindicators).map(entry => `${entry[0]}: ${entry[1]}`).join("; ")
/* Body */
@ -18,12 +19,16 @@ let main = async () => {
//console.log(uniquePlatforms)
let forecastsFromGoodPlatforms = json.filter(forecast => highQualityPlatforms.includes(forecast.platform))
let tsv = "index\ttitle\turl\tstars\n"+forecastsFromGoodPlatforms
.map((forecast, index) => `${index}\t${forecast.title}\t${forecast.url}\t0`)
let tsv = "index\ttitle\turl\tqualityindicators\n"+forecastsFromGoodPlatforms
.map((forecast, index) => {
let row = `${index}\t${forecast.title}\t${forecast.url}\t${getQualityIndicators(forecast)}`
console.log(row)
return row
})
.join("\n")
//console.log(tsv)
// let string = JSON.stringify(json, null, 2)
fs.writeFileSync('evals/metaforecasts.tsv', tsv);
fs.writeFileSync('metaforecasts.tsv', tsv);
}
main()