Revert "feat: save Insight Prediction progress"

This reverts commit 3892db1157.
This commit is contained in:
NunoSempere 2022-10-09 12:41:16 +01:00
parent 3892db1157
commit 0e3cede352
2 changed files with 20 additions and 15 deletions

View File

@ -65,7 +65,7 @@ async function fetchData(bearer: string) {
console.log(`Page = #${pageNum}`); console.log(`Page = #${pageNum}`);
// console.log(newPageData) // console.log(newPageData)
// console.dir(finalObject, {depth: null}); console.dir(finalObject, {depth: null});
results.push(... finalObject); results.push(... finalObject);
let newPagination = newPage.meta.pagination; let newPagination = newPage.meta.pagination;
@ -79,30 +79,35 @@ async function fetchData(bearer: string) {
} }
async function processPredictions(predictions: any[]) { async function processPredictions(predictions: any[]) {
let filteredPredictions = predictions.filter(prediction => !prediction.is_resolved && prediction.category != "Sports") let results = await predictions.map((prediction) => {
let results = filteredPredictions.map((prediction) => {
const id = `${platformName}-${ const id = `${platformName}-${
prediction.id prediction.id
}`; }`;
const options: FetchedQuestion["options"] = prediction.options const probability = prediction.probability;
const options: FetchedQuestion["options"] = [
{
name: "Yes",
probability: probability,
type: "PROBABILITY"
}, {
name: "No",
probability: 1 - probability,
type: "PROBABILITY"
},
];
const result: FetchedQuestion = { const result: FetchedQuestion = {
id, id,
title: prediction.title, title: prediction.title,
url: `https:${ url: "https://example.com",
prediction.url description: prediction.description,
}`,
description: prediction.rules,
options, options,
qualityindicators: { qualityindicators: {
volume: prediction.volume,
createdTime: prediction.created_at
// other: prediction.otherx, // other: prediction.otherx,
// indicators: prediction.indicatorx, // indicators: prediction.indicatorx,
} }
}; };
return result; return result;
}); });
// Filter results
return results; // resultsProcessed return results; // resultsProcessed
} }
@ -112,12 +117,12 @@ export const insight: Platform = {
name: platformName, name: platformName,
label: "Insight Prediction", label: "Insight Prediction",
color: "#ff0000", color: "#ff0000",
version: "v1", version: "v0",
async fetcher() { async fetcher() {
let bearer = process.env.INSIGHT_BEARER; let bearer = process.env.INSIGHT_BEARER;
let data = await fetchData(bearer); let data = await fetchData(bearer);
let results = await processPredictions(data); // console.log(data);
console.log(results); let results = []; // await processPredictions(data); // somehow needed
return results; return results;
}, },
calculateStars(data) { calculateStars(data) {

View File

@ -74,7 +74,7 @@ const getCurrencySymbolIfNeeded = ({
"openInterest", "openInterest",
"liquidity", "liquidity",
]; ];
let dollarPlatforms = ["predictit", "kalshi", "polymarket", "insight"]; let dollarPlatforms = ["predictit", "kalshi", "polymarket"];
if (indicatorsWhichNeedCurrencySymbol.includes(indicator)) { if (indicatorsWhichNeedCurrencySymbol.includes(indicator)) {
if (dollarPlatforms.includes(platform)) { if (dollarPlatforms.includes(platform)) {
return "$"; return "$";