Simplified prints
This commit is contained in:
		
							parent
							
								
									fff8470b8f
								
							
						
					
					
						commit
						3774ce55d4
					
				|  | @ -76,5 +76,5 @@ let commandLineUtility  = async () => { | ||||||
| 
 | 
 | ||||||
| // console.log("1")
 | // console.log("1")
 | ||||||
| // console.log(process.argv)
 | // console.log(process.argv)
 | ||||||
| // commandLineUtility()
 | commandLineUtility() | ||||||
| // doEverything()
 | // doEverything()
 | ||||||
|  | @ -41,7 +41,7 @@ async function fetchPage(page, cookie){ | ||||||
|     }), |     }), | ||||||
|   }) |   }) | ||||||
|   .then(res => res.data) |   .then(res => res.data) | ||||||
|   //console.log(response)
 |   // console.log(response)
 | ||||||
|   return response |   return response | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -92,7 +92,7 @@ async function fetchStats(questionUrl, cookie){ | ||||||
|   let descriptionprocessed1 = descriptionraw.split(`">`)[0] |   let descriptionprocessed1 = descriptionraw.split(`">`)[0] | ||||||
|   let descriptionprocessed2 = descriptionprocessed1.replace(">", "") |   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.", ``) |   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 descriptionprocessed4=descriptionprocessed3.replaceAll("\r\n\r\n", "\n") | ||||||
|   let descriptionprocessed5=descriptionprocessed4.replaceAll("\n\n", "\n")   |   let descriptionprocessed5=descriptionprocessed4.replaceAll("\n\n", "\n")   | ||||||
|   let descriptionprocessed6=descriptionprocessed5.replaceAll(""", `"`) |   let descriptionprocessed6=descriptionprocessed5.replaceAll(""", `"`) | ||||||
|  | @ -101,11 +101,11 @@ async function fetchStats(questionUrl, cookie){ | ||||||
|   let description = descriptionprocessed8 |   let description = descriptionprocessed8 | ||||||
|   // Number of forecasts
 |   // Number of forecasts
 | ||||||
|   let numforecasts = response.split("prediction_sets_count":")[1].split(",")[0] |   let numforecasts = response.split("prediction_sets_count":")[1].split(",")[0] | ||||||
|   //console.log(numforecasts)
 |   // console.log(numforecasts)
 | ||||||
|    |    | ||||||
|   // Number of predictors
 |   // Number of predictors
 | ||||||
|   let numforecasters = response.split("predictors_count":")[1].split(",")[0] |   let numforecasters = response.split("predictors_count":")[1].split(",")[0] | ||||||
|   //console.log(numpredictors)
 |   // console.log(numpredictors)
 | ||||||
|    |    | ||||||
|   let result = { |   let result = { | ||||||
|     "description": description,  |     "description": description,  | ||||||
|  | @ -137,9 +137,9 @@ export async function csetforetell(){ | ||||||
|   let response = await fetchPage(i, cookie) |   let response = await fetchPage(i, cookie) | ||||||
|   let results = [] |   let results = [] | ||||||
|   let init = Date.now() |   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)){ |   while(!isEnd(response)){ | ||||||
|     console.log(`Page #${i}`) |     // console.log(`Page #${i}`)
 | ||||||
|     let htmlLines = response.split("\n") |     let htmlLines = response.split("\n") | ||||||
|     let h4elements = htmlLines.filter(str => str.includes("<h4><a href="))  |     let h4elements = htmlLines.filter(str => str.includes("<h4><a href="))  | ||||||
|     for(let h4element of h4elements){ |     for(let h4element of h4elements){ | ||||||
|  | @ -160,7 +160,10 @@ export async function csetforetell(){ | ||||||
|             "platform": "CSET-foretell", |             "platform": "CSET-foretell", | ||||||
|             ...moreinfo |             ...moreinfo | ||||||
|           }) |           }) | ||||||
|  |           if(i % 10 == 0){ | ||||||
|  |             console.log(`Page #${i}`) | ||||||
|             console.log(question) |             console.log(question) | ||||||
|  |           } | ||||||
|           results.push(question) |           results.push(question) | ||||||
|       } catch(error){ |       } catch(error){ | ||||||
|         console.log(error) |         console.log(error) | ||||||
|  | @ -168,12 +171,13 @@ export async function csetforetell(){ | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     i=i+1 |     i=i+1 | ||||||
|     console.log("Sleeping for ~5secs so as to not be as noticeable to the cset-foretell servers") |     // console.log("Sleeping for ~5secs so as to not be as noticeable to the cset-foretell servers")
 | ||||||
|     await sleep(5000 + Math.random()*1000) // don't be as noticeable
 |     await sleep(5000 + Math.random()*1000) // don't be as noticeable
 | ||||||
|      |      | ||||||
|     try{ |     try{ | ||||||
|       response = await fetchPage(i, cookie) |       response = await fetchPage(i, cookie) | ||||||
|     }catch(error){ |     }catch(error){ | ||||||
|  |       console.log(error) | ||||||
|       console.log(`The program encountered some error when fetching page #${i}, so it won't appear on the final json. It is possible that this page wasn't actually a prediction question pages`) |       console.log(`The program encountered some error when fetching page #${i}, so it won't appear on the final json. It is possible that this page wasn't actually a prediction question pages`) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | @ -28,7 +28,7 @@ export async function estimize(){ | ||||||
|         results.push(standardObj) |         results.push(standardObj) | ||||||
|       } |       } | ||||||
|   } |   } | ||||||
|   console.log(results) |   // console.log(results)
 | ||||||
|   // let string = JSON.stringify(results, null, 2)
 |   // let string = JSON.stringify(results, null, 2)
 | ||||||
|   // fs.writeFileSync('./data/estimize-questions.json', string);
 |   // fs.writeFileSync('./data/estimize-questions.json', string);
 | ||||||
|   await upsert(results, "estimize-questions") |   await upsert(results, "estimize-questions") | ||||||
|  |  | ||||||
|  | @ -91,7 +91,7 @@ async function processData(data) { | ||||||
|           "stars": calculateStars("FantasySCOTUS", ({})) |           "stars": calculateStars("FantasySCOTUS", ({})) | ||||||
|         } |         } | ||||||
|       }) |       }) | ||||||
|       console.log(eventObject) |       // console.log(eventObject)
 | ||||||
|       results.push(eventObject) |       results.push(eventObject) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -87,7 +87,7 @@ export async function foretold(){ | ||||||
|           tradevolume: tradevolume.toFixed(2), |           tradevolume: tradevolume.toFixed(2), | ||||||
|           address: obj.address*/ |           address: obj.address*/ | ||||||
|       } |       } | ||||||
|       console.log(result) |       // console.log(result)
 | ||||||
|       results.push(result) |       results.push(result) | ||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | @ -27,10 +27,10 @@ async function fetchPage(url) { | ||||||
| async function main() { | async function main() { | ||||||
|   let rawdata = fs.readFileSync("./src/input/givewellopenphil-urls.txt") |   let rawdata = fs.readFileSync("./src/input/givewellopenphil-urls.txt") | ||||||
|   let data = rawdata.toString().split("\n").filter(url => url != ""); |   let data = rawdata.toString().split("\n").filter(url => url != ""); | ||||||
|   console.log(data) |   // console.log(data)
 | ||||||
|   let results = [] |   let results = [] | ||||||
|   for (let url of data) { |   for (let url of data) { | ||||||
|     console.log(url) |     // console.log(url)
 | ||||||
|     let page = await fetchPage(url) |     let page = await fetchPage(url) | ||||||
| 
 | 
 | ||||||
|     // Title
 |     // Title
 | ||||||
|  | @ -51,7 +51,7 @@ async function main() { | ||||||
|         "stars": calculateStars("GiveWell/OpenPhilanthropy", ({})), |         "stars": calculateStars("GiveWell/OpenPhilanthropy", ({})), | ||||||
|       } |       } | ||||||
|     } // Note: This requires some processing afterwards
 |     } // Note: This requires some processing afterwards
 | ||||||
|     console.log(result) |     // console.log(result)
 | ||||||
|     results.push(result) |     results.push(result) | ||||||
|   } |   } | ||||||
|   // let string = JSON.stringify(results, null, 2)
 |   // let string = JSON.stringify(results, null, 2)
 | ||||||
|  |  | ||||||
|  | @ -22,7 +22,6 @@ export async function goodjudgment() { | ||||||
|     jsonTable.shift() // deletes first element
 |     jsonTable.shift() // deletes first element
 | ||||||
|     jsonTable.pop() // deletes last element
 |     jsonTable.pop() // deletes last element
 | ||||||
|     if (endpoint == endpoints[1]) jsonTable.pop() // pop again
 |     if (endpoint == endpoints[1]) jsonTable.pop() // pop again
 | ||||||
|     console.log(jsonTable) |  | ||||||
|     //console.log(jsonTable)
 |     //console.log(jsonTable)
 | ||||||
|     for (let table of jsonTable) { |     for (let table of jsonTable) { | ||||||
|       let title = table[0]['0'] |       let title = table[0]['0'] | ||||||
|  | @ -66,7 +65,7 @@ export async function goodjudgment() { | ||||||
|       results.push(standardObj) |       results.push(standardObj) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   console.log(results) |   // console.log(results.slice(0,10))
 | ||||||
|   // let string = JSON.stringify(results, null, 2)
 |   // let string = JSON.stringify(results, null, 2)
 | ||||||
|   // fs.writeFileSync('./data/goodjudgment-questions.json', string);
 |   // fs.writeFileSync('./data/goodjudgment-questions.json', string);
 | ||||||
|   await upsert(results, "goodjudgment-questions") |   await upsert(results, "goodjudgment-questions") | ||||||
|  |  | ||||||
|  | @ -27,6 +27,7 @@ function getcookie() { | ||||||
|     process.exit() |     process.exit() | ||||||
|   } |   } | ||||||
|   */ |   */ | ||||||
|  |    | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -141,9 +142,9 @@ export async function goodjudgmentopen() { | ||||||
|   let response = await fetchPage(i, cookie) |   let response = await fetchPage(i, cookie) | ||||||
|   let results = [] |   let results = [] | ||||||
|   let init = Date.now() |   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)) { |   while (!isEnd(response)) { | ||||||
|     console.log(`Page #${i}`) |     // console.log(`Page #${i}`)
 | ||||||
|     let htmlLines = response.split("\n") |     let htmlLines = response.split("\n") | ||||||
|     let h5elements = htmlLines.filter(str => str.includes("<h5><a href=")) |     let h5elements = htmlLines.filter(str => str.includes("<h5><a href=")) | ||||||
|     for (let h5element of h5elements) { |     for (let h5element of h5elements) { | ||||||
|  | @ -164,7 +165,11 @@ export async function goodjudgmentopen() { | ||||||
|           "platform": "Good Judgment Open", |           "platform": "Good Judgment Open", | ||||||
|           ...moreinfo |           ...moreinfo | ||||||
|         }) |         }) | ||||||
|  |         if(i % 10 == 0){ | ||||||
|  |           console.log(`Page #${i}`) | ||||||
|           console.log(question) |           console.log(question) | ||||||
|  |         } | ||||||
|  |         // console.log(question)
 | ||||||
|         results.push(question) |         results.push(question) | ||||||
|       } catch (error) { |       } catch (error) { | ||||||
|         console.log(error) |         console.log(error) | ||||||
|  | @ -172,7 +177,7 @@ export async function goodjudgmentopen() { | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     i = i + 1 |     i = i + 1 | ||||||
|     console.log("Sleeping for 5secs so as to not be as noticeable to the gjopen servers") |     // console.log("Sleeping for 5secs so as to not be as noticeable to the gjopen servers")
 | ||||||
|     await sleep(5000 + Math.random() * 1000) // don't be a dick to gjopen server
 |     await sleep(5000 + Math.random() * 1000) // don't be a dick to gjopen server
 | ||||||
| 
 | 
 | ||||||
|     try { |     try { | ||||||
|  |  | ||||||
|  | @ -201,7 +201,7 @@ export async function hypermind() { | ||||||
|   console.log("AI in 2023") |   console.log("AI in 2023") | ||||||
|   await sleep(1000 + Math.random() * 1000) |   await sleep(1000 + Math.random() * 1000) | ||||||
|   let results4 = await fetchHypermindData4() |   let results4 = await fetchHypermindData4() | ||||||
|   console.log(results4) |   // console.log(results4)
 | ||||||
|   let results4processed = results2.map(res => { |   let results4processed = results2.map(res => { | ||||||
|     let description = res.props.details |     let description = res.props.details | ||||||
|     return ({ |     return ({ | ||||||
|  |  | ||||||
|  | @ -127,7 +127,7 @@ let processResults = async (json) => { | ||||||
| export async function ladbrokes() { | export async function ladbrokes() { | ||||||
|   let response = await fetchUrl(endpointPolitics) |   let response = await fetchUrl(endpointPolitics) | ||||||
|   let results = await processResults(response) |   let results = await processResults(response) | ||||||
|   console.log(results) |   // console.log(results)
 | ||||||
|   // let string = JSON.stringify(results, null, 2)
 |   // let string = JSON.stringify(results, null, 2)
 | ||||||
|   // fs.writeFileSync('./data/ladbrokes-questions.json', string);
 |   // fs.writeFileSync('./data/ladbrokes-questions.json', string);
 | ||||||
|   await upsert(results, "ladbrokes-questions") |   await upsert(results, "ladbrokes-questions") | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ async function fetchMetaculusQuestions(next) { | ||||||
|     headers: ({ 'Content-Type': 'application/json' }) |     headers: ({ 'Content-Type': 'application/json' }) | ||||||
|   })) |   })) | ||||||
|     .then(res => res.data) |     .then(res => res.data) | ||||||
|   console.log(response) |   // console.log(response)
 | ||||||
|   return response |   return response | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -36,6 +36,7 @@ async function fetchMetaculusQuestionDescription(slug) { | ||||||
|     }).then(response => response.data) |     }).then(response => response.data) | ||||||
|     return response |     return response | ||||||
|   } catch (error) { |   } catch (error) { | ||||||
|  |     console.log(error) | ||||||
|     console.log(`We encountered some error when attempting to fetch a metaculus page. Trying again`) |     console.log(`We encountered some error when attempting to fetch a metaculus page. Trying again`) | ||||||
|     await sleep(10000) |     await sleep(10000) | ||||||
|     try { |     try { | ||||||
|  | @ -76,7 +77,7 @@ export async function metaculus() { | ||||||
|         (result.publish_time < now) && |         (result.publish_time < now) && | ||||||
|         (now < result.resolve_time) |         (now < result.resolve_time) | ||||||
|       ) { |       ) { | ||||||
|         //console.log(result)
 |         // console.log(result)
 | ||||||
|         await sleep(1000) |         await sleep(1000) | ||||||
|         let questionPage = await fetchMetaculusQuestionDescription(result.page_url) |         let questionPage = await fetchMetaculusQuestionDescription(result.page_url) | ||||||
|         let descriptionraw = questionPage.split(`<div class="question__content">`)[1] |         let descriptionraw = questionPage.split(`<div class="question__content">`)[1] | ||||||
|  | @ -125,7 +126,7 @@ export async function metaculus() { | ||||||
|           //"last_activity_time": result.last_activity_time,
 |           //"last_activity_time": result.last_activity_time,
 | ||||||
|         }) |         }) | ||||||
|         if (Number(result.number_of_predictions) >= 10) { |         if (Number(result.number_of_predictions) >= 10) { | ||||||
|           console.log(interestingInfo) |           // console.log(interestingInfo)
 | ||||||
|           all_questions.push(interestingInfo) |           all_questions.push(interestingInfo) | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -40,7 +40,7 @@ async function fetchAllContractData() { | ||||||
|   }) |   }) | ||||||
|     .then(res => res.data) |     .then(res => res.data) | ||||||
|     .then(res => res.data.fixedProductMarketMakers) |     .then(res => res.data.fixedProductMarketMakers) | ||||||
|   //console.log(response)
 |   // console.log(response)
 | ||||||
|   return response |   return response | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -53,8 +53,8 @@ async function fetch_all() { | ||||||
|       data.usdLiquidityMeasure != '0' & |       data.usdLiquidityMeasure != '0' & | ||||||
|       data.resolutionTimestamp == null & |       data.resolutionTimestamp == null & | ||||||
|       data.question.title != "ssdds") { |       data.question.title != "ssdds") { | ||||||
|       console.log(data) |       // console.log(data)
 | ||||||
|       //console.log(data.usdLiquidityMeasure)
 |       // console.log(data.usdLiquidityMeasure)
 | ||||||
|       let options = data.outcomeTokenMarginalPrices.map((price, slotnum) => { |       let options = data.outcomeTokenMarginalPrices.map((price, slotnum) => { | ||||||
|         let name = `Option ${slotnum}` |         let name = `Option ${slotnum}` | ||||||
|         if (data.outcomeTokenMarginalPrices.length == 2 && slotnum == 0) name = "Yes" |         if (data.outcomeTokenMarginalPrices.length == 2 && slotnum == 0) name = "Yes" | ||||||
|  | @ -77,7 +77,7 @@ async function fetch_all() { | ||||||
|           "stars": calculateStars("Omen", ({})) |           "stars": calculateStars("Omen", ({})) | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|       console.log(obj) |       // console.log(obj)
 | ||||||
|       results.push(obj) |       results.push(obj) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -58,7 +58,7 @@ async function fetchAllContractData() { | ||||||
|   }) |   }) | ||||||
|     .then(res => res.data) |     .then(res => res.data) | ||||||
|     .then(res => res.data.fixedProductMarketMakers) |     .then(res => res.data.fixedProductMarketMakers) | ||||||
|   //console.log(response)
 |   // console.log(response)
 | ||||||
|   return response |   return response | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -83,9 +83,9 @@ async function fetch_all() { | ||||||
|   } |   } | ||||||
|   for (let data of allData) { |   for (let data of allData) { | ||||||
|     let addressLowerCase = data.id |     let addressLowerCase = data.id | ||||||
|     console.log(data) |     // console.log(data)
 | ||||||
|     if (combinedObj[addressLowerCase] != undefined) { |     if (combinedObj[addressLowerCase] != undefined) { | ||||||
|       //console.log(addressLowerCase)
 |       // console.log(addressLowerCase)
 | ||||||
|       let obj = combinedObj[addressLowerCase] |       let obj = combinedObj[addressLowerCase] | ||||||
|       let numforecasts = data.tradesQuantity |       let numforecasts = data.tradesQuantity | ||||||
|       let isbinary = Number(data.conditions[0].outcomeSlotCount) == 2 |       let isbinary = Number(data.conditions[0].outcomeSlotCount) == 2 | ||||||
|  | @ -122,14 +122,14 @@ async function fetch_all() { | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   let result = Object.values(combinedObj) |   let result = Object.values(combinedObj) | ||||||
|   //console.log(result)
 |   // console.log(result)
 | ||||||
|   return result |   return result | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* Body */ | /* Body */ | ||||||
| export async function polymarket() { | export async function polymarket() { | ||||||
|   let results = await fetch_all() |   let results = await fetch_all() | ||||||
|   console.log(results) |   // console.log(results)
 | ||||||
|   // console.log(result)
 |   // console.log(result)
 | ||||||
|   // let string = JSON.stringify(result, null, 2)
 |   // let string = JSON.stringify(result, null, 2)
 | ||||||
|   // fs.writeFileSync('./data/polymarket-questions.json', string);
 |   // fs.writeFileSync('./data/polymarket-questions.json', string);
 | ||||||
|  |  | ||||||
|  | @ -31,7 +31,7 @@ function sleep(ms) { | ||||||
| /* Body */ | /* Body */ | ||||||
| export async function predictit() { | export async function predictit() { | ||||||
|   let response = await fetchmarkets() |   let response = await fetchmarkets() | ||||||
|   console.log(response) |   // console.log(response)
 | ||||||
|   let results = [] |   let results = [] | ||||||
|   for (let market of response) { |   for (let market of response) { | ||||||
|     let isbinary = market.contracts.length == 1; |     let isbinary = market.contracts.length == 1; | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ async function fetchEvents(url) { | ||||||
|     }), |     }), | ||||||
|   }) |   }) | ||||||
|     .then(res => res.data) |     .then(res => res.data) | ||||||
|   //console.log(response)
 |   // console.log(response)
 | ||||||
|   return response |   return response | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -45,7 +45,7 @@ async function fetchContracts(marketid) { | ||||||
|     }), |     }), | ||||||
|   }) |   }) | ||||||
|     .then(res => res.data) |     .then(res => res.data) | ||||||
|   //console.log(response)
 |   // console.log(response)
 | ||||||
|   return response |   return response | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | @ -59,7 +59,7 @@ async function fetchPrices(marketid) { | ||||||
|     }), |     }), | ||||||
|   }) |   }) | ||||||
|     .then(res => res.data) |     .then(res => res.data) | ||||||
|   //console.log(response)
 |   // console.log(response)
 | ||||||
|   return response |   return response | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | @ -75,32 +75,32 @@ export async function smarkets() { | ||||||
|     events.push(...data.events) |     events.push(...data.events) | ||||||
|     htmlPath = data.pagination.next_page |     htmlPath = data.pagination.next_page | ||||||
|   } |   } | ||||||
|   //console.log(events)
 |   // console.log(events)
 | ||||||
| 
 | 
 | ||||||
|   let markets = [] |   let markets = [] | ||||||
|   for (let event of events) { |   for (let event of events) { | ||||||
|     //console.log(Date.now())
 |     // console.log(Date.now())
 | ||||||
|     //console.log(event.name)
 |     // console.log(event.name)
 | ||||||
|     let eventMarkets = await fetchMarkets(event.id) |     let eventMarkets = await fetchMarkets(event.id) | ||||||
|     eventMarkets = eventMarkets.map(market => ({ ...market, slug: event.full_slug })) |     eventMarkets = eventMarkets.map(market => ({ ...market, slug: event.full_slug })) | ||||||
|     //console.log("Markets fetched")
 |     // console.log("Markets fetched")
 | ||||||
|     //console.log(event.id)
 |     // console.log(event.id)
 | ||||||
|     //console.log(market)
 |     // console.log(market)
 | ||||||
|     markets.push(...eventMarkets) |     markets.push(...eventMarkets) | ||||||
|     //let lastPrices = await fetchPrices(market.id)
 |     //let lastPrices = await fetchPrices(market.id)
 | ||||||
|   } |   } | ||||||
|   //console.log(markets)
 |   // console.log(markets)
 | ||||||
| 
 | 
 | ||||||
|   let results = [] |   let results = [] | ||||||
|   for (let market of markets) { |   for (let market of markets) { | ||||||
|     //console.log("================")
 |     // console.log("================")
 | ||||||
|     //console.log("Market: ", market)
 |     // console.log("Market: ", market)
 | ||||||
|     let name = market.name |     let name = market.name | ||||||
| 
 | 
 | ||||||
|     let contracts = await fetchContracts(market.id) |     let contracts = await fetchContracts(market.id) | ||||||
|     //console.log("Contracts: ", contracts)
 |     // console.log("Contracts: ", contracts)
 | ||||||
|     let prices = await fetchPrices(market.id) |     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 = {} |     let options = {} | ||||||
|     for (let contract of contracts["contracts"]) { |     for (let contract of contracts["contracts"]) { | ||||||
|  | @ -123,7 +123,7 @@ export async function smarkets() { | ||||||
|       probability: Number(element.probability) / totalValue |       probability: Number(element.probability) / totalValue | ||||||
|     })) |     })) | ||||||
| 
 | 
 | ||||||
|     //console.log(options)
 |     // console.log(options)
 | ||||||
| 
 | 
 | ||||||
|     /* |     /* | ||||||
|     if(contracts["contracts"].length == 2){ |     if(contracts["contracts"].length == 2){ | ||||||
|  | @ -146,10 +146,10 @@ export async function smarkets() { | ||||||
|       } |       } | ||||||
|        |        | ||||||
|     } |     } | ||||||
|     //console.log(result)
 |     // console.log(result)
 | ||||||
|     results.push(result) |     results.push(result) | ||||||
|   } |   } | ||||||
|   //console.log(results)
 |   // console.log(results)
 | ||||||
| 
 | 
 | ||||||
|   // let string = JSON.stringify(results, null, 2)
 |   // let string = JSON.stringify(results, null, 2)
 | ||||||
|   // fs.writeFileSync('./data/smarkets-questions.json', string);
 |   // fs.writeFileSync('./data/smarkets-questions.json', string);
 | ||||||
|  |  | ||||||
|  | @ -30,7 +30,7 @@ export async function upsert (contents, documentName, collectionName="metaforeca | ||||||
|         const myDocument = await collection.findOne(filter); |         const myDocument = await collection.findOne(filter); | ||||||
|      |      | ||||||
|         // Print to the console
 |         // Print to the console
 | ||||||
|         console.log(myDocument); |         console.log(myDocument.contentsArray.slice(0,10)); | ||||||
|       } catch (err) { |       } catch (err) { | ||||||
|         console.log(err.stack); |         console.log(err.stack); | ||||||
|       } |       } | ||||||
|  | @ -73,5 +73,6 @@ export async function mongoRead (documentName, collectionName="metaforecastColle | ||||||
|     finally { |     finally { | ||||||
|       await client.close(); |       await client.close(); | ||||||
|     } |     } | ||||||
|  |     console.log(documentContents.slice(0,10)); | ||||||
|     return documentContents |     return documentContents | ||||||
| } | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user