diff --git a/market-simulator/src/components/EntryRow.vue b/market-simulator/src/components/EntryRow.vue
new file mode 100644
index 00000000..e18622dc
--- /dev/null
+++ b/market-simulator/src/components/EntryRow.vue
@@ -0,0 +1,40 @@
+
+
+
+
+ N/A |
+ N/A |
+ N/A |
+ N/A |
+
+
+
+ N/A |
+ {{ entry.prob.toFixed(2) }} |
+ N/A |
+ N/A |
+
+
+
+ {{ entry.yesWeight.toFixed(2) }} |
+ {{ entry.prob.toFixed(2) }} |
+ {{ entry.yesPayout.toFixed(2) }} |
+ {{ (entry.yesReturn * 100).toFixed(2) }}% |
+
+
+
+ {{ entry.noWeight.toFixed(2) }} |
+ {{ entry.prob.toFixed(2) }} |
+ {{ entry.noPayout.toFixed(2) }} |
+ {{ (entry.noReturn * 100).toFixed(2) }}% |
+
+
+
+
diff --git a/market-simulator/src/components/Simulator.vue b/market-simulator/src/components/Simulator.vue
index af74ad14..8d8ae021 100644
--- a/market-simulator/src/components/Simulator.vue
+++ b/market-simulator/src/components/Simulator.vue
@@ -58,14 +58,16 @@
placeholder="0"
class="input input-bordered"
@focus="$event.target.select()"
+ @keyup.enter="submitBid"
/>
-
X |
- X |
- X |
- X |
+
- |
@@ -92,27 +94,16 @@
SEED |
{{ entry.yesBid }} / {{ entry.noBid }} |
- N/A |
- {{ entry.prob.toFixed(2) }} |
- N/A |
- N/A |
YES |
{{ entry.yesBid }} |
- {{ entry.yesWeight.toFixed(2) }} |
- {{ entry.prob.toFixed(2) }} |
- {{ entry.yesPayout.toFixed(2) }} |
- {{ (entry.yesReturn * 100).toFixed(2) }}% |
NO |
{{ entry.noBid }} |
- {{ entry.noWeight.toFixed(2) }} |
- {{ entry.prob.toFixed(2) }} |
- {{ entry.noPayout.toFixed(2) }} |
- {{ (entry.noReturn * 100).toFixed(2) }}% |
+
@@ -142,6 +133,7 @@ import { bids as sampleBids } from './sample-bids'
import { makeEntries } from './entries'
import { ref, computed } from '@vue/reactivity'
import { onMounted, watch } from '@vue/runtime-core'
+import EntryRow from './EntryRow.vue'
// Copy over the sample bids to seed the simulation
const bids = sampleBids.slice()
@@ -197,12 +189,29 @@ function toggleBidType() {
newBidType.value = newBidType.value === 'YES' ? 'NO' : 'YES'
}
-function submitBid() {
- const bid = {
+function makeBid(type: string, bid: number) {
+ return {
yesBid: newBidType.value == 'YES' ? newBid.value : 0,
noBid: newBidType.value == 'YES' ? 0 : newBid.value,
}
+}
+
+function submitBid() {
+ if (newBid.value <= 0) return
+ const bid = makeBid(newBidType.value, newBid.value)
bids.splice(steps.value, 0, bid)
steps.value++
+ newBid.value = 0
}
+
+// Preview the next bid before it's added
+const nextEntry = computed(() => {
+ if (newBid.value) {
+ const nextBid = makeBid(newBidType.value, newBid.value)
+ const fakeBids = [...bids.slice(0, steps.value), nextBid]
+ const entries = makeEntries(fakeBids)
+ return entries[entries.length - 1]
+ }
+ return null
+})
diff --git a/market-simulator/src/components/entries.ts b/market-simulator/src/components/entries.ts
index dc907fe6..6f9103bf 100644
--- a/market-simulator/src/components/entries.ts
+++ b/market-simulator/src/components/entries.ts
@@ -1,7 +1,7 @@
type Bid = { yesBid: number; noBid: number }
// An entry has a yes/no for bid, weight, payout, return. Also a current probability
-type Entry = {
+export type Entry = {
yesBid: number
noBid: number
yesWeight: number