vault backup: 2023-11-07 01:12:34

This commit is contained in:
Paul Trowbridge 2023-11-07 01:12:34 -05:00
parent 1b54c2d370
commit 64bd728b4c

17
api.ts
View File

@ -144,6 +144,22 @@ 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 ) {
doc.calcCeiling = "Cap At List";
doc.finalPrice = doc.list;
finalReason = `${doc.anchorSource} ${doc.anchorPrice} x ${inflationFactor} = ${calcPrice} but cap at list ${doc.list}`;
} else {
doc.finalPrice = calcPrice
finalReason = `${doc.anchorSource} ${doc.anchorPrice} x ${inflationFactor} = ${calcPrice}`;
}
doc.finalReason = finalReason;
return doc;
}
@ -168,4 +184,3 @@ app.use(router.allowedMethods());
// Start the server
console.log('Server is running on http://usmidsap02:8090');
await app.listen({ port: 8090 });