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 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 inflation = Math.max(...Object.keys(doc.iidx).map(Number));
const inflationFactor = doc.iidx[inflation] + 1; const inflationFactor = doc.iidx[inflation] + 1;
doc.inflationFactor = inflationFactor; doc.inflationFactor = inflationFactor;
var calcPrice = doc.anchorPrice * doc.inflationFactor; var calcPrice = doc.anchorPrice * doc.inflationFactor;
calcPrice = parseFloat(calcPrice.toFixed(5)); calcPrice = parseFloat(calcPrice.toFixed(5));
let finalReason = "" let finalReason = ""
if (calcPrice >= doc.list ) { if (calcPrice >= doc.list ) {
doc.calcCeiling = "Cap At List"; doc.calcCeiling = "Cap At List";
doc.finalPrice = doc.list; doc.finalPrice = doc.list;
finalReason = `${doc.anchorSource} ${doc.anchorPrice} x ${inflationFactor} = ${calcPrice} but cap at list ${doc.list}`; finalReason = `${doc.anchorSource} ${doc.anchorPrice} x ${inflationFactor} = ${calcPrice} but cap at list ${doc.list}`;
} else { } else {
doc.finalPrice = calcPrice doc.finalPrice = calcPrice
finalReason = `${doc.anchorSource} ${doc.anchorPrice} x ${inflationFactor} = ${calcPrice}`; finalReason = `${doc.anchorSource} ${doc.anchorPrice} x ${inflationFactor} = ${calcPrice}`;
} }
doc.finalReason = finalReason; doc.finalReason = finalReason;
return doc; return doc;
} }