diff --git a/src/components/TimedOrderEntry.vue b/src/components/TimedOrderEntry.vue index b0c132c..b95bbd9 100644 --- a/src/components/TimedOrderEntry.vue +++ b/src/components/TimedOrderEntry.vue @@ -255,8 +255,8 @@ async function placeOrder() { // build tranches const n = tranches.value // num tranches const ts = [] - let duration = timeUnitIndex === 0 ? interval.value * 60 : // minutes - timeUnitIndex === 1 ? interval.value * 60 * 60 : // hours + let duration = timeUnitIndex.value === 0 ? interval.value * 60 : // minutes + timeUnitIndex.value === 1 ? interval.value * 60 * 60 : // hours interval.value * 24 * 60 * 60; // days let window if (!intervalIsTotal.value) { @@ -269,9 +269,11 @@ async function placeOrder() { const ceil = oneHundredPercent % BigInt(n) ? 1n : 0n const amtPerTranche = oneHundredPercent / BigInt(n) + ceil duration -= 15 // subtract 15 seconds so the last tranche completes before the deadline + console.log('duration', duration) for (let i = 0; i < n; i++) { - const start = Math.floor(i * (duration / n)) + const start = Math.floor(i * (duration / (n-1))) const end = start + window + console.log('tranche window', start, end, (end-start)/60) const cs = [newTimeConstraint(TimeMode.SinceOrderStart, start, TimeMode.SinceOrderStart, end)] ts.push([amtPerTranche, cs]) }