feat: save Insight Prediction progress
Note that the fetcher is subject to this bug: <https://github.com/quantified-uncertainty/metaforecast/issues/94> which means that it'll hit insight pretty hard.
This commit is contained in:
parent
69ab8f905c
commit
3892db1157
|
@ -65,7 +65,7 @@ async function fetchData(bearer: string) {
|
|||
|
||||
console.log(`Page = #${pageNum}`);
|
||||
// console.log(newPageData)
|
||||
console.dir(finalObject, {depth: null});
|
||||
// console.dir(finalObject, {depth: null});
|
||||
results.push(... finalObject);
|
||||
|
||||
let newPagination = newPage.meta.pagination;
|
||||
|
@ -79,35 +79,30 @@ async function fetchData(bearer: string) {
|
|||
}
|
||||
|
||||
async function processPredictions(predictions: any[]) {
|
||||
let results = await predictions.map((prediction) => {
|
||||
let filteredPredictions = predictions.filter(prediction => !prediction.is_resolved && prediction.category != "Sports")
|
||||
let results = filteredPredictions.map((prediction) => {
|
||||
const id = `${platformName}-${
|
||||
prediction.id
|
||||
}`;
|
||||
const probability = prediction.probability;
|
||||
const options: FetchedQuestion["options"] = [
|
||||
{
|
||||
name: "Yes",
|
||||
probability: probability,
|
||||
type: "PROBABILITY"
|
||||
}, {
|
||||
name: "No",
|
||||
probability: 1 - probability,
|
||||
type: "PROBABILITY"
|
||||
},
|
||||
];
|
||||
const options: FetchedQuestion["options"] = prediction.options
|
||||
const result: FetchedQuestion = {
|
||||
id,
|
||||
title: prediction.title,
|
||||
url: "https://example.com",
|
||||
description: prediction.description,
|
||||
url: `https:${
|
||||
prediction.url
|
||||
}`,
|
||||
description: prediction.rules,
|
||||
options,
|
||||
qualityindicators: {
|
||||
volume: prediction.volume,
|
||||
createdTime: prediction.created_at
|
||||
// other: prediction.otherx,
|
||||
// indicators: prediction.indicatorx,
|
||||
}
|
||||
};
|
||||
return result;
|
||||
});
|
||||
// Filter results
|
||||
return results; // resultsProcessed
|
||||
}
|
||||
|
||||
|
@ -117,12 +112,12 @@ export const insight: Platform = {
|
|||
name: platformName,
|
||||
label: "Insight Prediction",
|
||||
color: "#ff0000",
|
||||
version: "v0",
|
||||
version: "v1",
|
||||
async fetcher() {
|
||||
let bearer = process.env.INSIGHT_BEARER;
|
||||
let data = await fetchData(bearer);
|
||||
// console.log(data);
|
||||
let results = []; // await processPredictions(data); // somehow needed
|
||||
let results = await processPredictions(data);
|
||||
console.log(results);
|
||||
return results;
|
||||
},
|
||||
calculateStars(data) {
|
||||
|
|
|
@ -74,7 +74,7 @@ const getCurrencySymbolIfNeeded = ({
|
|||
"openInterest",
|
||||
"liquidity",
|
||||
];
|
||||
let dollarPlatforms = ["predictit", "kalshi", "polymarket"];
|
||||
let dollarPlatforms = ["predictit", "kalshi", "polymarket", "insight"];
|
||||
if (indicatorsWhichNeedCurrencySymbol.includes(indicator)) {
|
||||
if (dollarPlatforms.includes(platform)) {
|
||||
return "$";
|
||||
|
|
Loading…
Reference in New Issue
Block a user