From 569f122e0bf0b7a84c3ed5bcd8300f3058aa6208 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Tue, 30 Nov 2021 18:41:46 -0800 Subject: [PATCH] Include percent returns --- market-simulator/src/components/Simulator.vue | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/market-simulator/src/components/Simulator.vue b/market-simulator/src/components/Simulator.vue index b9575c73..6cca3374 100644 --- a/market-simulator/src/components/Simulator.vue +++ b/market-simulator/src/components/Simulator.vue @@ -20,6 +20,8 @@ Implied Probability Yes Payout No Payout + Yes Return + No Return @@ -29,9 +31,11 @@ {{ entry.noBid || '' }} {{ entry.yesWeight.toFixed(2) || '' }} {{ entry.noWeight.toFixed(2) || '' }} - {{ entry.prob.toFixed(2) }} - {{ entry.yesPayout.value.toFixed(2) }} - {{ entry.noPayout.value.toFixed(2) }} + {{ entry.prob.toFixed(2) || '' }} + {{ entry.yesPayout.value.toFixed(2) || '' }} + {{ entry.noPayout.value.toFixed(2) || '' }} + {{ (entry.yesReturn.value * 100).toFixed(2) || '' }}% + {{ (entry.noReturn.value * 100).toFixed(2) || '' }}% @@ -87,6 +91,9 @@ for (const bid of bids) { () => noBid + (noWeight / noWeightsC.value) * (yesPotC.value - YES_SEED) ) + const yesReturn = computed(() => (yesPayout.value - yesBid) / yesBid) + const noReturn = computed(() => (noPayout.value - noBid) / noBid) + entries.push({ yesBid, noBid, @@ -94,9 +101,10 @@ for (const bid of bids) { yesWeight: yesWeight, noWeight: noWeight, prob: prob, - // These are reactive, so fix decimal places in HTML template yesPayout, noPayout, + yesReturn, + noReturn, }) }