order sharing

This commit is contained in:
tim
2025-04-22 16:15:14 -04:00
parent 14b8b50812
commit 38fb66c694
17 changed files with 239 additions and 33 deletions

View File

@@ -21,7 +21,7 @@
<td class="weight" style="vertical-align: bottom">{{ allocationTexts[higherIndex] }}</td>
</tr>
<tr v-for="i in innerIndexes" class="ml-5">
<td class="pl-5">{{ prices[i] }}</td>
<td class="pl-5">{{ toPrecision(prices[i],6) }}</td>
<td class="weight">{{ allocationTexts[i] }}</td>
</tr>
</template>
@@ -54,6 +54,7 @@ import {computed, ref} from "vue";
import {allocationText, HLine} from "@/charts/shape.js";
import OneTimeHint from "@/components/OneTimeHint.vue";
import {track} from "@/track.js";
import {toPrecision, toPrecisionOrNull} from "@/misc.js";
const s = useStore()
const os = useOrderStore()
@@ -138,10 +139,8 @@ const priceEndpoints = computed({
function update(a, b) {
_priceEndpoints.value = [a, b]
const newBuilder = {...props.builder}
newBuilder.priceA = a
newBuilder.priceB = b
emit('update:builder', newBuilder)
props.builder.priceA = a
props.builder.priceB = b
}
const flipped = computed(()=>{
@@ -151,7 +150,7 @@ const flipped = computed(()=>{
})
const higherPrice = computed({
get() { return flipped.value ? priceA.value : priceB.value },
get() { return toPrecisionOrNull(flipped.value ? priceA.value : priceB.value, 6) },
set(v) {
if (flipped.value)
priceA.value = v
@@ -172,9 +171,7 @@ const innerIndexes = computed(()=>{
})
const lowerPrice = computed({
get() {
return !flipped.value ? priceA.value : priceB.value
},
get() {return toPrecisionOrNull(!flipped.value ? priceA.value : priceB.value, 6)},
set(v) {
if (!flipped.value)
priceA.value = v