Parse example bets from spreadsheet
This commit is contained in:
parent
f51a0ef1ae
commit
81c6da7c58
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
.DS_Store
|
|
@ -3,11 +3,11 @@
|
|||
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
|
||||
import HelloWorld from './components/HelloWorld.vue'
|
||||
import LoginExample from './components/LoginExample.vue'
|
||||
import Simulator from './components/Simulator.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<img alt="Vue logo" src="./assets/logo.png" />
|
||||
<LoginExample />
|
||||
<Simulator />
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
|
34
market-simulator/src/components/Simulator.vue
Normal file
34
market-simulator/src/components/Simulator.vue
Normal file
|
@ -0,0 +1,34 @@
|
|||
<template>
|
||||
<div class="overflow-x-auto px-12">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Order #</th>
|
||||
<th>Yes bid</th>
|
||||
<th>No Bid</th>
|
||||
<th>Implied Probability</th>
|
||||
<th>Payout</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(entry, i) in entries">
|
||||
<th>{{ i }}</th>
|
||||
<td>{{ entry.yesBid || '' }}</td>
|
||||
<td>{{ entry.noBid || '' }}</td>
|
||||
<td>{{ entry.prob }}</td>
|
||||
<td>{{ entry.payout }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { bids } from './orders'
|
||||
|
||||
const entries = bids.map((bid) => ({
|
||||
...bid,
|
||||
prob: 0.646,
|
||||
payout: 1.23,
|
||||
}))
|
||||
</script>
|
58
market-simulator/src/components/orders.ts
Normal file
58
market-simulator/src/components/orders.ts
Normal file
|
@ -0,0 +1,58 @@
|
|||
const data = `1,9
|
||||
8,
|
||||
,1
|
||||
1,
|
||||
,1
|
||||
1,
|
||||
,5
|
||||
5,
|
||||
,5
|
||||
5,
|
||||
,1
|
||||
1,
|
||||
100,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
10,
|
||||
,10
|
||||
`
|
||||
|
||||
// Parse data into Yes/No orders
|
||||
// E.g. `8,\n,1\n1,` =>
|
||||
// [{yesBid: 8, noBid: 0}, {yesBid: 0, noBid: 1}, {yesBid: 1, noBid: 0}]
|
||||
export const bids = data.split('\n').map((line) => {
|
||||
const [yesBid, noBid] = line.split(',')
|
||||
return {
|
||||
yesBid: parseInt(yesBid || '0'),
|
||||
noBid: parseInt(noBid || '0'),
|
||||
}
|
||||
})
|
Loading…
Reference in New Issue
Block a user