diff --git a/src/blockchain/orderlib.js b/src/blockchain/orderlib.js index fdc9ed1..17e319c 100644 --- a/src/blockchain/orderlib.js +++ b/src/blockchain/orderlib.js @@ -151,10 +151,12 @@ export function parseOrderStatus(chainId, status) { filledIn = BigInt(filledIn) filledOut = BigInt(filledOut) trancheStatus = trancheStatus.map((obj)=>parseTrancheStatus(obj)) - return { + const result = { chainId, order, fillFeeHalfBps, state, startTime, startPrice, ocoGroup, filledIn, filledOut, trancheStatus, - } + }; + console.log('SwapOrderStatus', result) + return result } function parseTrancheStatus(obj) { @@ -205,20 +207,18 @@ export function parseTranche(tranche) { rateLimitPeriod, startTime, endTime, - minIntercept, - minSlope, - maxIntercept, - maxSlope, + minLine, + maxLine, ] = tranche - minIntercept = decodeIEE754(minIntercept) - minSlope = decodeIEE754(minSlope) - maxIntercept = decodeIEE754(maxIntercept) - maxSlope = decodeIEE754(maxSlope) - return { + minLine = {intercept: minLine.intercept, slope: minLine.slope } + maxLine = {intercept: maxLine.intercept, slope: maxLine.slope } + const result = { fraction, startTimeIsRelative, endTimeIsRelative, minIsBarrier, maxIsBarrier, marketOrder, minIsRatio, maxIsRatio, rateLimitFraction, rateLimitPeriod, - startTime, endTime, minIntercept, minSlope, maxIntercept, maxSlope, + startTime, endTime, minLine, maxLine, } + console.log('parseTranche', tranche, result) + return result } diff --git a/src/components/DiagonalOrder.vue b/src/components/DiagonalOrder.vue index 3df20ae..583b36d 100644 --- a/src/components/DiagonalOrder.vue +++ b/src/components/DiagonalOrder.vue @@ -28,7 +28,7 @@ import {useOrderStore, useStore} from "@/store/store"; import LimitPrice from "@/components/LimitPrice.vue"; import Order from "@/components/Order.vue"; import {computed, ref} from "vue"; -import {applyLinePoints, linePointsValue} from "@/orderbuild.js"; +import {applyLinePoints, linePointsValue, useChartOrderStore} from "@/orderbuild.js"; import {newTranche} from "@/blockchain/orderlib.js"; import TimeEntry from "@/components/TimeEntry.vue"; import RoutePrice from "@/components/RoutePrice.vue"; @@ -47,7 +47,8 @@ const curLimit = computed(()=>linePointsValue(time1.value, price1.value, time2.v function buildTranches() { const t = newTranche(); - applyLinePoints(t, time1.value, price1.value, time2.value, price2.value) + const co = useChartOrderStore(); + applyLinePoints(t, co.selectedSymbol, os.buy, time1.value, price1.value, time2.value, price2.value) return [t] } diff --git a/src/components/Status.vue b/src/components/Status.vue index 7f9ae4d..54f1ce3 100644 --- a/src/components/Status.vue +++ b/src/components/Status.vue @@ -124,11 +124,11 @@
market order
diff --git a/src/components/chart/DiagonalBuilder.vue b/src/components/chart/DiagonalBuilder.vue index fc7ebee..ed65cb7 100644 --- a/src/components/chart/DiagonalBuilder.vue +++ b/src/components/chart/DiagonalBuilder.vue @@ -136,9 +136,6 @@ function buildTranches() { const lb = _endpoints.value[1] const ws = weights.value const symbol = co.selectedSymbol - const inverted = symbol.inverted - const scale = 10 ** -symbol.decimals - const isMinimum = inverted === order.buy for (let i = 0; i < ws.length; i++) { const w = ws[i] const t = newTranche({fraction: w * MAX_FRACTION}) @@ -153,15 +150,7 @@ function buildTranches() { // console.log('tranche start/end', // t.startTime === DISTANT_PAST ? 'PAST' : t.startTime, // t.endTime === DISTANT_FUTURE ? 'FUTURE' : t.endTime) - if (inverted) { - // invert prices - line[1] = 1/line[1] - line[3] = 1/line[3] - } - // scale to pool decimals - line[1] *= scale - line[3] *= scale - applyLinePoints(t, isMinimum, ...line) + applyLinePoints(t, symbol, order.buy, ...line) tranches.push(t) } return tranches diff --git a/src/components/chart/LimitBuilder.vue b/src/components/chart/LimitBuilder.vue index d914345..21f4de9 100644 --- a/src/components/chart/LimitBuilder.vue +++ b/src/components/chart/LimitBuilder.vue @@ -81,23 +81,16 @@ function buildTranches() { console.log('buildTranches', builder, order, tranches) const ps = prices.value const ws = weights.value - const symbol = co.selectedSymbol - const scale = 10 ** -symbol.decimals - const inverted = symbol.inverted - const isMinimum = inverted === order.buy for(let i=0; i