diff --git a/market-simulator/src/components/Simulator.vue b/market-simulator/src/components/Simulator.vue
index def4fc47..63ae8783 100644
--- a/market-simulator/src/components/Simulator.vue
+++ b/market-simulator/src/components/Simulator.vue
@@ -6,7 +6,7 @@
type="range"
v-model.number="steps"
min="1"
- :max="entries.length"
+ :max="allEntries.length"
/>
@@ -27,23 +27,23 @@
-
+
{{ i + 1 }} |
YES |
{{ entry.yesBid }} |
- {{ entry.yesWeight.toFixed(2) || '' }} |
- {{ entry.prob.toFixed(2) || '' }} |
- {{ entry.yesPayout.value.toFixed(2) || '' }} |
- {{ (entry.yesReturn.value * 100).toFixed(2) || '' }}% |
+ {{ entry.yesWeight.toFixed(2) }} |
+ {{ entry.prob.toFixed(2) }} |
+ {{ entry.yesPayout.value.toFixed(2) }} |
+ {{ (entry.yesReturn.value * 100).toFixed(2) }}% |
NO |
{{ entry.noBid }} |
- {{ entry.noWeight.toFixed(2) || '' }} |
- {{ entry.prob.toFixed(2) || '' }} |
- {{ entry.noPayout.value.toFixed(2) || '' }} |
- {{ (entry.noReturn.value * 100).toFixed(2) || '' }}% |
+ {{ entry.noWeight.toFixed(2) }} |
+ {{ entry.prob.toFixed(2) }} |
+ {{ entry.noPayout.value.toFixed(2) }} |
+ {{ (entry.noReturn.value * 100).toFixed(2) }}% |
@@ -59,7 +59,7 @@ import { bids } from './orders'
import { ref, computed } from '@vue/reactivity'
import { onMounted, watch } from '@vue/runtime-core'
-const entries = [] as any
+const allEntries = [] as any
// Constants. TODO: Pull these from the orders instead of hardcoding.
const YES_SEED = 1
const NO_SEED = 9
@@ -70,18 +70,18 @@ let noPot = 0
const steps = ref(10)
// Computed variables: stop the simulation at the appropriate number of steps
-const truncatedEntries = computed(() => entries.slice(0, steps.value))
+const entries = computed(() => allEntries.slice(0, steps.value))
const yesPotC = computed(() =>
- truncatedEntries.value.reduce((acc, entry) => acc + entry.yesBid, 0)
+ entries.value.reduce((acc, entry) => acc + entry.yesBid, 0)
)
const noPotC = computed(() =>
- truncatedEntries.value.reduce((acc, entry) => acc + entry.noBid, 0)
+ entries.value.reduce((acc, entry) => acc + entry.noBid, 0)
)
const yesWeightsC = computed(() =>
- truncatedEntries.value.reduce((acc, entry) => acc + entry.yesWeight, 0)
+ entries.value.reduce((acc, entry) => acc + entry.yesWeight, 0)
)
const noWeightsC = computed(() =>
- truncatedEntries.value.reduce((acc, entry) => acc + entry.noWeight, 0)
+ entries.value.reduce((acc, entry) => acc + entry.noWeight, 0)
)
// Calculations:
@@ -107,13 +107,13 @@ for (const bid of bids) {
const yesReturn = computed(() => (yesPayout.value - yesBid) / yesBid)
const noReturn = computed(() => (noPayout.value - noBid) / noBid)
- entries.push({
+ allEntries.push({
yesBid,
noBid,
// Show two decimal places
- yesWeight: yesWeight,
- noWeight: noWeight,
- prob: prob,
+ yesWeight,
+ noWeight,
+ prob,
yesPayout,
noPayout,
yesReturn,
@@ -122,7 +122,7 @@ for (const bid of bids) {
}
// Graph the probabilities over time
-const probs = computed(() => truncatedEntries.value.map((entry) => entry.prob))
+const probs = computed(() => entries.value.map((entry) => entry.prob))
onMounted(initChart)
watch(steps, renderChart)