diagonal line support

This commit is contained in:
Tim Olson
2023-12-19 17:07:08 -04:00
parent 9199d31e77
commit 8007f63469
10 changed files with 170 additions and 52 deletions

View File

@@ -4,31 +4,43 @@
<div class="title">Line Point A</div>
<v-divider/>
<time-entry v-model="time1" class="mb-0" hide-details="true"/>
<limit-price v-model="price1" label="Price A" :required="true"/>
<limit-price v-model="price1" label="Price A" :required="true" :show-price="false"/>
<div class="title">Line Point B</div>
<v-divider/>
<time-entry v-model="time2" hide-details="true"/>
<limit-price v-model="price2" label="Price B" :required="true"/>
<div><i>Backend support for diagonal lines is coming soon...</i></div>
<limit-price v-model="price2" label="Price B" :required="true" :show-price="false"/>
<div v-if="curLimit">
<v-row>
<v-col cols="6">
<span>Current line value</span>&nbsp;<span class="text-green">{{curLimit ? curLimit.toPrecision(5) : curLimit}}</span>
</v-col>
<v-col cols="6">
<span>Current price</span>&nbsp;<route-price class="text-green"/>
</v-col>
</v-row>
</div>
{{os.limitIsMinimum}}
</order>
</template>
<script setup>
import {useOrderStore} from "@/store/store";
import {useOrderStore, useStore} from "@/store/store";
import LimitPrice from "@/components/LimitPrice.vue";
import Order from "@/components/Order.vue";
import {computed, ref} from "vue";
import {applyLimit, applyLinePoints} from "@/orderbuild.js";
import {validateRequired, validateTranches} from "@/validate.js";
import {MAX_FRACTION, newTranche} from "@/blockchain/orderlib.js";
import {applyLinePoints, linePointsValue} from "@/orderbuild.js";
import {newTranche} from "@/blockchain/orderlib.js";
import TimeEntry from "@/components/TimeEntry.vue";
import RoutePrice from "@/components/RoutePrice.vue";
const s = useStore()
const os = useOrderStore()
const time1 = ref(new Date())
const price1 = ref(null)
const time2 = ref(new Date())
const price2 = ref(null)
const curLimit = computed(()=>linePointsValue(time1.value, price1.value, time2.value, price2.value, s.time))
function buildTranches() {
const t = newTranche();
@@ -37,7 +49,7 @@ function buildTranches() {
}
function validOrder() {
return false
return time1.value && (price1.value || price1.value===0) && time2.value && (price2.value || price2.value===0)
}
</script>