diff --git a/src/index.js b/src/index.js index f423bd9..3f3dd1e 100644 --- a/src/index.js +++ b/src/index.js @@ -76,5 +76,5 @@ let commandLineUtility = async () => { // console.log("1") // console.log(process.argv) -// commandLineUtility() +commandLineUtility() // doEverything() \ No newline at end of file diff --git a/src/platforms/csetforetell-fetch.js b/src/platforms/csetforetell-fetch.js index 4750ea4..72d02ac 100644 --- a/src/platforms/csetforetell-fetch.js +++ b/src/platforms/csetforetell-fetch.js @@ -41,7 +41,7 @@ async function fetchPage(page, cookie){ }), }) .then(res => res.data) - //console.log(response) + // console.log(response) return response } @@ -92,7 +92,7 @@ async function fetchStats(questionUrl, cookie){ let descriptionprocessed1 = descriptionraw.split(`">`)[0] let descriptionprocessed2 = descriptionprocessed1.replace(">", "") let descriptionprocessed3 = descriptionprocessed2.replace("To suggest a change or clarification to this question, please select Request Clarification from the green gear-shaped dropdown button to the right of the question.", ``) - console.log(descriptionprocessed3) + // console.log(descriptionprocessed3) let descriptionprocessed4=descriptionprocessed3.replaceAll("\r\n\r\n", "\n") let descriptionprocessed5=descriptionprocessed4.replaceAll("\n\n", "\n") let descriptionprocessed6=descriptionprocessed5.replaceAll(""", `"`) @@ -101,11 +101,11 @@ async function fetchStats(questionUrl, cookie){ let description = descriptionprocessed8 // Number of forecasts let numforecasts = response.split("prediction_sets_count":")[1].split(",")[0] - //console.log(numforecasts) + // console.log(numforecasts) // Number of predictors let numforecasters = response.split("predictors_count":")[1].split(",")[0] - //console.log(numpredictors) + // console.log(numpredictors) let result = { "description": description, @@ -137,9 +137,9 @@ export async function csetforetell(){ let response = await fetchPage(i, cookie) let results = [] let init = Date.now() - console.log("Downloading... This might take a couple of minutes. Results will be shown.") + // console.log("Downloading... This might take a couple of minutes. Results will be shown.") while(!isEnd(response)){ - console.log(`Page #${i}`) + // console.log(`Page #${i}`) let htmlLines = response.split("\n") let h4elements = htmlLines.filter(str => str.includes("

url != ""); - console.log(data) + // console.log(data) let results = [] for (let url of data) { - console.log(url) + // console.log(url) let page = await fetchPage(url) // Title @@ -51,7 +51,7 @@ async function main() { "stars": calculateStars("GiveWell/OpenPhilanthropy", ({})), } } // Note: This requires some processing afterwards - console.log(result) + // console.log(result) results.push(result) } // let string = JSON.stringify(results, null, 2) diff --git a/src/platforms/goodjudgment-fetch.js b/src/platforms/goodjudgment-fetch.js index 064581a..250355c 100644 --- a/src/platforms/goodjudgment-fetch.js +++ b/src/platforms/goodjudgment-fetch.js @@ -22,7 +22,6 @@ export async function goodjudgment() { jsonTable.shift() // deletes first element jsonTable.pop() // deletes last element if (endpoint == endpoints[1]) jsonTable.pop() // pop again - console.log(jsonTable) //console.log(jsonTable) for (let table of jsonTable) { let title = table[0]['0'] @@ -66,7 +65,7 @@ export async function goodjudgment() { results.push(standardObj) } } - console.log(results) + // console.log(results.slice(0,10)) // let string = JSON.stringify(results, null, 2) // fs.writeFileSync('./data/goodjudgment-questions.json', string); await upsert(results, "goodjudgment-questions") diff --git a/src/platforms/goodjudmentopen-fetch.js b/src/platforms/goodjudmentopen-fetch.js index cf8299d..57da923 100644 --- a/src/platforms/goodjudmentopen-fetch.js +++ b/src/platforms/goodjudmentopen-fetch.js @@ -27,6 +27,7 @@ function getcookie() { process.exit() } */ + } @@ -141,9 +142,9 @@ export async function goodjudgmentopen() { let response = await fetchPage(i, cookie) let results = [] let init = Date.now() - console.log("Downloading... This might take a couple of minutes. Results will be shown.") + // console.log("Downloading... This might take a couple of minutes. Results will be shown.") while (!isEnd(response)) { - console.log(`Page #${i}`) + // console.log(`Page #${i}`) let htmlLines = response.split("\n") let h5elements = htmlLines.filter(str => str.includes("
{ let description = res.props.details return ({ diff --git a/src/platforms/ladbrokes-fetch.js b/src/platforms/ladbrokes-fetch.js index af02883..9bbb7f1 100644 --- a/src/platforms/ladbrokes-fetch.js +++ b/src/platforms/ladbrokes-fetch.js @@ -127,7 +127,7 @@ let processResults = async (json) => { export async function ladbrokes() { let response = await fetchUrl(endpointPolitics) let results = await processResults(response) - console.log(results) + // console.log(results) // let string = JSON.stringify(results, null, 2) // fs.writeFileSync('./data/ladbrokes-questions.json', string); await upsert(results, "ladbrokes-questions") diff --git a/src/platforms/metaculus-fetch.js b/src/platforms/metaculus-fetch.js index c34d998..0ff0dd2 100644 --- a/src/platforms/metaculus-fetch.js +++ b/src/platforms/metaculus-fetch.js @@ -19,7 +19,7 @@ async function fetchMetaculusQuestions(next) { headers: ({ 'Content-Type': 'application/json' }) })) .then(res => res.data) - console.log(response) + // console.log(response) return response } @@ -36,6 +36,7 @@ async function fetchMetaculusQuestionDescription(slug) { }).then(response => response.data) return response } catch (error) { + console.log(error) console.log(`We encountered some error when attempting to fetch a metaculus page. Trying again`) await sleep(10000) try { @@ -76,7 +77,7 @@ export async function metaculus() { (result.publish_time < now) && (now < result.resolve_time) ) { - //console.log(result) + // console.log(result) await sleep(1000) let questionPage = await fetchMetaculusQuestionDescription(result.page_url) let descriptionraw = questionPage.split(`
`)[1] @@ -125,7 +126,7 @@ export async function metaculus() { //"last_activity_time": result.last_activity_time, }) if (Number(result.number_of_predictions) >= 10) { - console.log(interestingInfo) + // console.log(interestingInfo) all_questions.push(interestingInfo) } diff --git a/src/platforms/omen-fetch.js b/src/platforms/omen-fetch.js index fd7dc8b..e80ec4e 100644 --- a/src/platforms/omen-fetch.js +++ b/src/platforms/omen-fetch.js @@ -40,7 +40,7 @@ async function fetchAllContractData() { }) .then(res => res.data) .then(res => res.data.fixedProductMarketMakers) - //console.log(response) + // console.log(response) return response } @@ -53,8 +53,8 @@ async function fetch_all() { data.usdLiquidityMeasure != '0' & data.resolutionTimestamp == null & data.question.title != "ssdds") { - console.log(data) - //console.log(data.usdLiquidityMeasure) + // console.log(data) + // console.log(data.usdLiquidityMeasure) let options = data.outcomeTokenMarginalPrices.map((price, slotnum) => { let name = `Option ${slotnum}` if (data.outcomeTokenMarginalPrices.length == 2 && slotnum == 0) name = "Yes" @@ -77,7 +77,7 @@ async function fetch_all() { "stars": calculateStars("Omen", ({})) } } - console.log(obj) + // console.log(obj) results.push(obj) } diff --git a/src/platforms/polymarket-fetch.js b/src/platforms/polymarket-fetch.js index ad8a164..7f4d99d 100644 --- a/src/platforms/polymarket-fetch.js +++ b/src/platforms/polymarket-fetch.js @@ -58,7 +58,7 @@ async function fetchAllContractData() { }) .then(res => res.data) .then(res => res.data.fixedProductMarketMakers) - //console.log(response) + // console.log(response) return response } @@ -83,9 +83,9 @@ async function fetch_all() { } for (let data of allData) { let addressLowerCase = data.id - console.log(data) + // console.log(data) if (combinedObj[addressLowerCase] != undefined) { - //console.log(addressLowerCase) + // console.log(addressLowerCase) let obj = combinedObj[addressLowerCase] let numforecasts = data.tradesQuantity let isbinary = Number(data.conditions[0].outcomeSlotCount) == 2 @@ -122,14 +122,14 @@ async function fetch_all() { } } let result = Object.values(combinedObj) - //console.log(result) + // console.log(result) return result } /* Body */ export async function polymarket() { let results = await fetch_all() - console.log(results) + // console.log(results) // console.log(result) // let string = JSON.stringify(result, null, 2) // fs.writeFileSync('./data/polymarket-questions.json', string); diff --git a/src/platforms/predictit-fetch.js b/src/platforms/predictit-fetch.js index dee7756..179c132 100644 --- a/src/platforms/predictit-fetch.js +++ b/src/platforms/predictit-fetch.js @@ -31,7 +31,7 @@ function sleep(ms) { /* Body */ export async function predictit() { let response = await fetchmarkets() - console.log(response) + // console.log(response) let results = [] for (let market of response) { let isbinary = market.contracts.length == 1; diff --git a/src/platforms/smarkets-fetch.js b/src/platforms/smarkets-fetch.js index db9a3e5..b5ed33c 100644 --- a/src/platforms/smarkets-fetch.js +++ b/src/platforms/smarkets-fetch.js @@ -19,7 +19,7 @@ async function fetchEvents(url) { }), }) .then(res => res.data) - //console.log(response) + // console.log(response) return response } @@ -45,7 +45,7 @@ async function fetchContracts(marketid) { }), }) .then(res => res.data) - //console.log(response) + // console.log(response) return response } @@ -59,7 +59,7 @@ async function fetchPrices(marketid) { }), }) .then(res => res.data) - //console.log(response) + // console.log(response) return response } @@ -75,32 +75,32 @@ export async function smarkets() { events.push(...data.events) htmlPath = data.pagination.next_page } - //console.log(events) + // console.log(events) let markets = [] for (let event of events) { - //console.log(Date.now()) - //console.log(event.name) + // console.log(Date.now()) + // console.log(event.name) let eventMarkets = await fetchMarkets(event.id) eventMarkets = eventMarkets.map(market => ({ ...market, slug: event.full_slug })) - //console.log("Markets fetched") - //console.log(event.id) - //console.log(market) + // console.log("Markets fetched") + // console.log(event.id) + // console.log(market) markets.push(...eventMarkets) //let lastPrices = await fetchPrices(market.id) } - //console.log(markets) + // console.log(markets) let results = [] for (let market of markets) { - //console.log("================") - //console.log("Market: ", market) + // console.log("================") + // console.log("Market: ", market) let name = market.name let contracts = await fetchContracts(market.id) - //console.log("Contracts: ", contracts) + // console.log("Contracts: ", contracts) let prices = await fetchPrices(market.id) - //console.log("Prices: ", prices["last_executed_prices"][market.id]) + // console.log("Prices: ", prices["last_executed_prices"][market.id]) let options = {} for (let contract of contracts["contracts"]) { @@ -123,7 +123,7 @@ export async function smarkets() { probability: Number(element.probability) / totalValue })) - //console.log(options) + // console.log(options) /* if(contracts["contracts"].length == 2){ @@ -146,10 +146,10 @@ export async function smarkets() { } } - //console.log(result) + // console.log(result) results.push(result) } - //console.log(results) + // console.log(results) // let string = JSON.stringify(results, null, 2) // fs.writeFileSync('./data/smarkets-questions.json', string); diff --git a/src/utils/doEverythingForScheduler.js b/src/utils/doEverythingForScheduler.js index b1623b0..90fdfc6 100644 --- a/src/utils/doEverythingForScheduler.js +++ b/src/utils/doEverythingForScheduler.js @@ -1,3 +1,3 @@ import {doEverything} from "./doEverything.js" -doEverything() \ No newline at end of file +doEverything() diff --git a/src/utils/mongo-wrapper.js b/src/utils/mongo-wrapper.js index c690975..680a308 100644 --- a/src/utils/mongo-wrapper.js +++ b/src/utils/mongo-wrapper.js @@ -30,7 +30,7 @@ export async function upsert (contents, documentName, collectionName="metaforeca const myDocument = await collection.findOne(filter); // Print to the console - console.log(myDocument); + console.log(myDocument.contentsArray.slice(0,10)); } catch (err) { console.log(err.stack); } @@ -73,5 +73,6 @@ export async function mongoRead (documentName, collectionName="metaforecastColle finally { await client.close(); } + console.log(documentContents.slice(0,10)); return documentContents } \ No newline at end of file