fix: Kalshi and Betfair stars are now 3

This commit is contained in:
NunoSempere 2021-08-06 04:05:38 +02:00
parent 66b024bd38
commit b1d8c3cba9
9 changed files with 38433 additions and 34038 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -74,8 +74,12 @@ async function whipIntoShape(data){
async function processPredictions(data) { async function processPredictions(data) {
let predictions = await whipIntoShape(data) let predictions = await whipIntoShape(data)
console.log(JSON.stringify(predictions, null, 4)) // console.log(JSON.stringify(predictions, null, 4))
let results = predictions.map(prediction => { let results = predictions.map(prediction => {
/* if(Math.floor(Math.random() * 10) % 20 ==0){
console.log(JSON.stringify(prediction, null, 4))
} */
let normalizationFactor = (prediction.options let normalizationFactor = (prediction.options
.filter(option => option.status == "ACTIVE" && option.totalMatched > 0) .filter(option => option.status == "ACTIVE" && option.totalMatched > 0)
.map(option => option.lastPriceTraded)) .map(option => option.lastPriceTraded))
@ -100,7 +104,7 @@ async function processPredictions(data) {
.replace(/\n/g, " ") .replace(/\n/g, " ")
.trim() .trim()
if(rules == undefined){ if(rules == undefined){
console.log(prediction.description) // console.log(prediction.description)
} }
let title = rules.split("? ")[0] + "?" let title = rules.split("? ")[0] + "?"
let description = rules.split("? ")[1].trim() let description = rules.split("? ")[1].trim()
@ -109,7 +113,7 @@ async function processPredictions(data) {
} }
let result = ({ let result = ({
"title": title, "title": title,
"url": `https://betfair.com`, "url": `https://www.betfair.com/exchange/plus/politics/market/${prediction.marketId}`,
"platform": "Betfair", "platform": "Betfair",
"description": description, "description": description,
"options": options, "options": options,

View File

@ -101,7 +101,7 @@ async function fetchStats(questionUrl, cookie){
"timestamp": new Date().toISOString(), "timestamp": new Date().toISOString(),
"qualityindicators": { "qualityindicators": {
"numforecasts": numforecasts, "numforecasts": numforecasts,
"numforecasters": numforecasters, "num_forecasters": numforecasters,
"stars": calculateStars("CSET-foretell", {numforecasts}) "stars": calculateStars("CSET-foretell", {numforecasts})
} }
} }

View File

@ -123,7 +123,7 @@ async function fetchStats(questionUrl, cookie){
"timestamp": new Date().toISOString(), "timestamp": new Date().toISOString(),
"qualityindicators": { "qualityindicators": {
"numforecasts": numforecasts, "numforecasts": numforecasts,
"numforecasters": numforecasters, "num_forecasters": numforecasters,
"stars": calculateStars("CSET-foretell", {numforecasts}) "stars": calculateStars("CSET-foretell", {numforecasts})
} }
} }

View File

@ -7,4 +7,15 @@ let main = async () => {
let string = JSON.stringify(json, null, 2) let string = JSON.stringify(json, null, 2)
fs.writeFileSync('metaforecasts.json', string); fs.writeFileSync('metaforecasts.json', string);
} }
main() // main()
let extractQualityIndicators = async () => {
let json = await mongoReadWithReadCredentials("metaforecasts")
let qualityIndicators = []
json.forEach(forecast => qualityIndicators.push(...Object.keys(forecast.qualityindicators)))
qualityIndicators = [...new Set(qualityIndicators)]
console.log(qualityIndicators)
// let string = JSON.stringify(json, null, 2)
// fs.writeFileSync('metaforecasts.json', string);
}
extractQualityIndicators()

View File

@ -1,5 +1,5 @@
/* Imports */ /* Imports */
import {goodjudgment} from "../platforms/goodjudgment-fetch.js" import { goodjudgment } from "../platforms/goodjudgment-fetch.js"
/* Definitions */ /* Definitions */

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
cd /home/nuno/Documents/core/software/fresh/js/metaforecasts/metaforecasts-mongo cd /home/nuno/Documents/core/software/fresh/js/metaforecasts/metaforecasts-mongo
/usr/bin/node ./src/utils/pullSuperforecastsManually.js date > done.txt
echo "done" > done.txt /home/nuno/.nvm/versions/node/v16.4.2/bin/node ./src/utils/pullSuperforecastsManually.js >> done.txt

View File

@ -38,9 +38,9 @@ function calculateStarsAstralCodexTen(data) {
function calculateStarsBetfair(data) { function calculateStarsBetfair(data) {
let nuno = data => data.volume > 1000 ? 3 : 2 let nuno = data => data.volume > 1000 ? 3 : 2
let eli = (data) => data.volume > 10000 ? 5 : 4 let eli = (data) => data.volume > 10000 ? null : null
let misha = (data) => 3.5 let misha = (data) => null
let starsDecimal = average([nuno(data), eli(data), misha(data)]) let starsDecimal = average([nuno(data)]) //, eli(data), misha(data)])
// Substract 1 star if probability is above 90% or below 10% // Substract 1 star if probability is above 90% or below 10%
if(data.option && if(data.option &&
(data.option.probability < 0.1 || data.option.probability > 0.9) (data.option.probability < 0.1 || data.option.probability > 0.9)
@ -132,10 +132,10 @@ function calculateStarsHypermind(data) {
} }
function calculateStarsKalshi(data) { function calculateStarsKalshi(data) {
let nuno = data => data.interest > 1000 && data.volume > 1000 ? 4 : 3 let nuno = data => data.interest > 1000 && data.volume > 1000 ? 3 : 2
let eli = (data) => data.interest > 10000 ? 5 : 4 let eli = (data) => data.interest > 10000 ? 5 : 4
let misha = (data) => 4 let misha = (data) => 4
let starsDecimal = average([nuno(data), eli(data), misha(data)]) let starsDecimal = average([nuno(data)]) //, eli(data), misha(data)])
// Substract 1 star if probability is above 90% or below 10% // Substract 1 star if probability is above 90% or below 10%
if(data.option && if(data.option &&
(data.option.probability < 0.1 || data.option.probability > 0.9) (data.option.probability < 0.1 || data.option.probability > 0.9)