Skip to main content

Scalar Prediction

Here we jump straight to step 5 of the calculating prediction flow. Meaning that step 1 through 4 in the previous section are the same.

5. Printing the current (scalar) prediction

If the market is a scalar market we get the lower and upper bounds of the market and use them to calculate what the predicted scalar value of the market is currently.

const predictedPrice = assetPrices
.sort((a, b) => ( ? -1 : 1))

if (market.marketType.scalar) {
const [lower, upper] = getScalarBounds(market).unwrap()!;

const predictedValue = upper

`The prediction is ${} at ${predictedValue.toFixed(2)}`

Full Code

Go to the full code snippet for this example