vault backup: 2023-11-07 08:38:24

This commit is contained in:
Paul Trowbridge 2023-11-07 08:38:24 -05:00
parent d048a1fac6
commit 24c3a20d67

20
api.ts
View File

@ -144,21 +144,21 @@ function apply_guidance(doc: any) {
doc.anchorSource = 'none'; // or any other default value you wish to indicate no anchor price was found
}
const inflation = Math.max(...Object.keys(doc.iidx).map(Number));
const inflationFactor = doc.iidx[inflation] + 1;
doc.inflationFactor = inflationFactor;
var calcPrice = doc.anchorPrice * doc.inflationFactor;
calcPrice = parseFloat(calcPrice.toFixed(5));
let finalReason = ""
if (calcPrice >= doc.list ) {
const inflation = Math.max(...Object.keys(doc.iidx).map(Number));
const inflationFactor = doc.iidx[inflation] + 1;
doc.inflationFactor = inflationFactor;
var calcPrice = doc.anchorPrice * doc.inflationFactor;
calcPrice = parseFloat(calcPrice.toFixed(5));
let finalReason = ""
if (calcPrice >= doc.list ) {
doc.calcCeiling = "Cap At List";
doc.finalPrice = doc.list;
finalReason = `${doc.anchorSource} ${doc.anchorPrice} x ${inflationFactor} = ${calcPrice} but cap at list ${doc.list}`;
} else {
} else {
doc.finalPrice = calcPrice
finalReason = `${doc.anchorSource} ${doc.anchorPrice} x ${inflationFactor} = ${calcPrice}`;
}
doc.finalReason = finalReason;
}
doc.finalReason = finalReason;
return doc;
}