fix: Changed units of Kalshi volume to shares traded

- Previously was in dollars
- Also some tweaks to stars
- Also some tweaks too Good Judgment fetching1
This commit is contained in:
NunoSempere 2021-09-03 23:00:07 +02:00
parent 50224cbb88
commit d9b654d19e
3 changed files with 15 additions and 10 deletions

View File

@ -21,9 +21,10 @@ export async function goodjudgment() {
let jsonTable = Tabletojson.convert(content, { stripHtmlFromCells: false }) let jsonTable = Tabletojson.convert(content, { stripHtmlFromCells: false })
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)
for (let table of jsonTable) { for (let table of jsonTable) {
// console.log(table)
let title = table[0]['0'] let title = table[0]['0']
.split("\t\t\t") .split("\t\t\t")
.splice(3)[0] .splice(3)[0]
@ -50,7 +51,11 @@ export async function goodjudgment() {
probability: Number(row['3'].split("%")[0]) / 100, probability: Number(row['3'].split("%")[0]) / 100,
type: "PROBABILITY" type: "PROBABILITY"
})) }))
let analysis = table.filter(row => row[0].includes("Examples of Superforecaster commentary"))[0][0] let analysis = table.filter(row => row[0]? row[0].toLowerCase().includes("commentary") : false)
// "Examples of Superforecaster Commentary" / Analysis
// The following is necessary twite, because we want to check if there is an empty list, and then get the first element of the first element of the list.
analysis = analysis ? analysis[0] : ""
analysis = analysis ? analysis[0] : ""
// console.log(analysis) // console.log(analysis)
let standardObj = ({ let standardObj = ({
"title": title, "title": title,
@ -63,7 +68,7 @@ export async function goodjudgment() {
"stars": calculateStars("Good Judgment", ({})), "stars": calculateStars("Good Judgment", ({})),
}, },
"extra": { "extra": {
"superforecastercommentary": analysis "superforecastercommentary": analysis || ""
} }
}) })
results.push(standardObj) results.push(standardObj)
@ -73,7 +78,7 @@ export async function goodjudgment() {
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);
// fs.writeFileSync('./goodjudgment-questions-test.json', string); // fs.writeFileSync('./goodjudgment-questions-test.json', string);
// console.log(results) console.log(results)
await upsert(results, "goodjudgment-questions") await upsert(results, "goodjudgment-questions")
console.log("Done") console.log("Done")
} }

View File

@ -47,12 +47,12 @@ async function processMarkets(markets) {
"options": options, "options": options,
"timestamp": new Date().toISOString(), "timestamp": new Date().toISOString(),
"qualityindicators": { "qualityindicators": {
"stars": calculateStars("Kalshi", ({volume: market.volume, interest: market.open_interest})), "stars": calculateStars("Kalshi", ({shares_volume: market.volume, interest: market.open_interest})),
"yes_bid": market.yes_bid, "yes_bid": market.yes_bid,
"yes_ask": market.yes_ask, "yes_ask": market.yes_ask,
"spread": Math.abs(market.yes_bid-market.yes_ask), "spread": Math.abs(market.yes_bid-market.yes_ask),
"volume": market.volume, "shares_volume": market.volume, // Assuming that half of all buys are for yes and half for no, which is a big if.
"open_interest": market.open_interest // "open_interest": market.open_interest, also in shares
} }
}) })
return result return result

View File

@ -132,8 +132,8 @@ function calculateStarsHypermind(data) {
} }
function calculateStarsKalshi(data) { function calculateStarsKalshi(data) {
let nuno = data => data.interest > 500 && data.volume > 10000 ? 4 : (data.volume > 1000 ? 3 : 2) let nuno = data => data.interest > 500 && data.shares_volume > 10000 ? 4 : (data.shares_volume > 2000 ? 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%