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 })
jsonTable.shift() // deletes first 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)
for (let table of jsonTable) {
// console.log(table)
let title = table[0]['0']
.split("\t\t\t")
.splice(3)[0]
@ -50,7 +51,11 @@ export async function goodjudgment() {
probability: Number(row['3'].split("%")[0]) / 100,
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)
let standardObj = ({
"title": title,
@ -63,7 +68,7 @@ export async function goodjudgment() {
"stars": calculateStars("Good Judgment", ({})),
},
"extra": {
"superforecastercommentary": analysis
"superforecastercommentary": analysis || ""
}
})
results.push(standardObj)
@ -73,7 +78,7 @@ export async function goodjudgment() {
let string = JSON.stringify(results, null, 2)
// fs.writeFileSync('./data/goodjudgment-questions.json', string);
// fs.writeFileSync('./goodjudgment-questions-test.json', string);
// console.log(results)
console.log(results)
await upsert(results, "goodjudgment-questions")
console.log("Done")
}

View File

@ -47,12 +47,12 @@ async function processMarkets(markets) {
"options": options,
"timestamp": new Date().toISOString(),
"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_ask": market.yes_ask,
"spread": Math.abs(market.yes_bid-market.yes_ask),
"volume": market.volume,
"open_interest": market.open_interest
"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, also in shares
}
})
return result

View File

@ -132,8 +132,8 @@ function calculateStarsHypermind(data) {
}
function calculateStarsKalshi(data) {
let nuno = data => data.interest > 500 && data.volume > 10000 ? 4 : (data.volume > 1000 ? 3 : 2)
let eli = (data) => data.interest > 10000 ? 5 : 4
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 misha = (data) => 4
let starsDecimal = average([nuno(data)]) //, eli(data), misha(data)])
// Substract 1 star if probability is above 90% or below 10%