Show which shares will be bought
This commit is contained in:
parent
c4f70015d5
commit
f4c5bf6d2c
|
@ -20,7 +20,7 @@
|
||||||
<input name="certainty" v-model="certainty" type="number" min="0" max="1" step="0.001"
|
<input name="certainty" v-model="certainty" type="number" min="0" max="1" step="0.001"
|
||||||
placeholder="fraction like 0.5" />
|
placeholder="fraction like 0.5" />
|
||||||
<label>you receive:</label>
|
<label>you receive:</label>
|
||||||
<label>{{ format(shares) }} shares @ 🗲{{ format(price) }}</label>
|
<label>{{ format(shares) }} {{ selected }} shares @ 🗲{{ format(price) }}</label>
|
||||||
<label>you pay:</label>
|
<label>you pay:</label>
|
||||||
<label>🗲{{ format(cost) }}</label>
|
<label>🗲{{ format(cost) }}</label>
|
||||||
<label>if you win:</label>
|
<label>if you win:</label>
|
||||||
|
@ -38,8 +38,8 @@ const route = useRoute()
|
||||||
const marketId = route.params.id
|
const marketId = route.params.id
|
||||||
const selected = ref(null)
|
const selected = ref(null)
|
||||||
const showForm = computed(() => selected.value !== null)
|
const showForm = computed(() => selected.value !== null)
|
||||||
const yesClass = computed(() => selected.value === 'yes' ? ['active'] : [])
|
const yesClass = computed(() => selected.value === 'YES' ? ['active'] : [])
|
||||||
const noClass = computed(() => selected.value === 'no' ? ['active'] : [])
|
const noClass = computed(() => selected.value === 'NO' ? ['active'] : [])
|
||||||
|
|
||||||
// how much wants the user bet?
|
// how much wants the user bet?
|
||||||
const stake = ref(null)
|
const stake = ref(null)
|
||||||
|
@ -83,15 +83,15 @@ const noShareId = computed(() => {
|
||||||
return market?.value.Shares.find(s => s.Description === 'NO').Id
|
return market?.value.Shares.find(s => s.Description === 'NO').Id
|
||||||
})
|
})
|
||||||
const shareId = computed(() => {
|
const shareId = computed(() => {
|
||||||
return selected.value === 'yes' ? yesShareId.value : noShareId.value
|
return selected.value === 'YES' ? yesShareId.value : noShareId.value
|
||||||
})
|
})
|
||||||
|
|
||||||
const toggleYes = () => {
|
const toggleYes = () => {
|
||||||
selected.value = selected.value === 'yes' ? null : 'yes'
|
selected.value = selected.value === 'YES' ? null : 'YES'
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleNo = () => {
|
const toggleNo = () => {
|
||||||
selected.value = selected.value === 'no' ? null : 'no'
|
selected.value = selected.value === 'NO' ? null : 'NO'
|
||||||
}
|
}
|
||||||
|
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
|
|
Loading…
Reference in New Issue