TimedOrder submission works
This commit is contained in:
@@ -29,7 +29,7 @@ import {useOrderStore} from "@/store/store";
|
||||
import LimitPrice from "@/components/LimitPrice.vue";
|
||||
import Order from "@/components/Order.vue";
|
||||
import {computed, ref} from "vue";
|
||||
import {limitConstraint, maxFraction} from "@/orderbuild.js";
|
||||
import {applyLimit, maxFraction} from "@/orderbuild.js";
|
||||
import {validateRequired, validateTranches} from "@/validate.js";
|
||||
|
||||
const os = useOrderStore()
|
||||
@@ -82,7 +82,7 @@ function buildTranches() {
|
||||
const mf = Number(maxFraction)
|
||||
for( let i=0; i<n; i++ ) {
|
||||
// todo optional deadline
|
||||
const cs = [limitConstraint(rungs.value[i])]
|
||||
const cs = [applyLimit(rungs.value[i])]
|
||||
const fraction = Math.min(mf, Math.ceil(mf * fractions.value[i]) )
|
||||
ts.push([fraction, cs])
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ function placeOrder() {
|
||||
const route = os.route
|
||||
const amt = FixedNumber.fromString(os.totalAmount.toString(), {decimals: os.amountToken.decimals}).value
|
||||
const ts = props.tranches()
|
||||
const order = newOrder(tokenIn, tokenOut, route.exchange, route.fee, amt, os.amountIsInput, ts)
|
||||
const order = newOrder(tokenIn, tokenOut, route.exchange, route.fee, amt, os.amountIsInput, ts) // todo: minAmount, outputToOwner, chainOrder
|
||||
pendOrder(order)
|
||||
router.push('/orders')
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
import {routeInverted, SingletonCoroutine, vAutoSelect} from "@/misc.js";
|
||||
import Order from "@/components/Order.vue";
|
||||
import LimitPrice from "@/components/LimitPrice.vue";
|
||||
import {timesliceTranches, limitConstraint} from "@/orderbuild.js";
|
||||
import {timesliceTranches, applyLimit} from "@/orderbuild.js";
|
||||
import Tranches from "@/components/Tranches.vue";
|
||||
import {useOrderStore} from "@/store/store.js";
|
||||
|
||||
@@ -18,10 +18,11 @@ const os = useOrderStore()
|
||||
|
||||
function buildTranches() {
|
||||
const ts = timesliceTranches();
|
||||
const priceConstraint = limitConstraint();
|
||||
if( priceConstraint !== null )
|
||||
const os = useOrderStore()
|
||||
const price = os.limitPrice
|
||||
if( price )
|
||||
for( let i=0; i<ts.length; i++)
|
||||
ts[i][1].push(priceConstraint)
|
||||
applyLimit(ts[i], price)
|
||||
return ts
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user