Include percent returns

This commit is contained in:
Austin Chen 2021-11-30 18:41:46 -08:00
parent b3f156e4ef
commit 569f122e0b

View File

@ -20,6 +20,8 @@
<th>Implied Probability</th> <th>Implied Probability</th>
<th>Yes Payout</th> <th>Yes Payout</th>
<th>No Payout</th> <th>No Payout</th>
<th>Yes Return</th>
<th>No Return</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -29,9 +31,11 @@
<td>{{ entry.noBid || '' }}</td> <td>{{ entry.noBid || '' }}</td>
<td>{{ entry.yesWeight.toFixed(2) || '' }}</td> <td>{{ entry.yesWeight.toFixed(2) || '' }}</td>
<td>{{ entry.noWeight.toFixed(2) || '' }}</td> <td>{{ entry.noWeight.toFixed(2) || '' }}</td>
<td>{{ entry.prob.toFixed(2) }}</td> <td>{{ entry.prob.toFixed(2) || '' }}</td>
<td>{{ entry.yesPayout.value.toFixed(2) }}</td> <td>{{ entry.yesPayout.value.toFixed(2) || '' }}</td>
<td>{{ entry.noPayout.value.toFixed(2) }}</td> <td>{{ entry.noPayout.value.toFixed(2) || '' }}</td>
<td>{{ (entry.yesReturn.value * 100).toFixed(2) || '' }}%</td>
<td>{{ (entry.noReturn.value * 100).toFixed(2) || '' }}%</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -87,6 +91,9 @@ for (const bid of bids) {
() => noBid + (noWeight / noWeightsC.value) * (yesPotC.value - YES_SEED) () => noBid + (noWeight / noWeightsC.value) * (yesPotC.value - YES_SEED)
) )
const yesReturn = computed(() => (yesPayout.value - yesBid) / yesBid)
const noReturn = computed(() => (noPayout.value - noBid) / noBid)
entries.push({ entries.push({
yesBid, yesBid,
noBid, noBid,
@ -94,9 +101,10 @@ for (const bid of bids) {
yesWeight: yesWeight, yesWeight: yesWeight,
noWeight: noWeight, noWeight: noWeight,
prob: prob, prob: prob,
// These are reactive, so fix decimal places in HTML template
yesPayout, yesPayout,
noPayout, noPayout,
yesReturn,
noReturn,
}) })
} }
</script> </script>