diff --git a/src/charts/chart.js b/src/charts/chart.js index bdf8a6e..90d5ecd 100644 --- a/src/charts/chart.js +++ b/src/charts/chart.js @@ -247,7 +247,7 @@ export function createShape(shapeType, points, options={}, ...callbacks) { // programatically adds a shape to the chart let shapeId try { - console.log('creating shape', points, options) + // console.log('creating shape', points, options) if (points.time || points.price) shapeId = chart.createShape(points, options) else if (points.length === 1) diff --git a/src/charts/ohlc.js b/src/charts/ohlc.js index 8b91a6f..beb39d8 100644 --- a/src/charts/ohlc.js +++ b/src/charts/ohlc.js @@ -181,7 +181,7 @@ export async function loadOHLC (symbol, contract, from, to, tvRes) { switch (row.length) { case 1: if (row[0].length !== 0) - console.log(`Warning: weird nonempty row at OHLC line ${lineNum}: ${line}`) + console.log(`Warning: weird nonempty row at OHLC line ${lineNum}: "${line}"`) break case 2: time = parseInt(row[0]) diff --git a/src/charts/ordershapes.js b/src/charts/ordershapes.js index c3ab262..4689d12 100644 --- a/src/charts/ordershapes.js +++ b/src/charts/ordershapes.js @@ -68,7 +68,7 @@ class TrancheShapes { * 10 ** -(amountIsBase ? this.symbol.base.d : this.symbol.quote.d) const weight = Number(filledAmount) / Number(this.status.order.amount) const amountSymbol = amountIsBase ? this.symbol.base.s : this.symbol.quote.s - console.log('fillpoint', buy, filledAmount, this.status.order, this.symbol) + // console.log('fillpoint', buy, filledAmount, this.status.order, this.symbol) const time = f.time const out = Number(f.filledOut) / (1-this.status.order.route.fee/1000000) let price = out / Number(f.filledIn) @@ -89,7 +89,7 @@ class TrancheShapes { const symbol = this.symbol const scale = 10**symbol.decimals; const buy = status.order.tokenIn === this.symbol.quote.a - const inverted = buy === symbol.inverted + const inverted = buy amount = Number(amount) * 10 ** -(buy ? this.symbol.base.d : this.symbol.quote.d) const amountSymbol = buy ? this.symbol.base.s : this.symbol.quote.s diff --git a/src/charts/shape.js b/src/charts/shape.js index 33c50e7..8ce40ad 100644 --- a/src/charts/shape.js +++ b/src/charts/shape.js @@ -42,7 +42,7 @@ export function allocationText(weight, amount, symbol, separator = ' ') { const hasAmount = amount !== null && amount !== undefined && amount > 0 if (hasAmount) amount = Number(amount) - const hasWeight = weight !== null && weight !== undefined + const hasWeight = weight !== null && weight !== undefined && weight !== 1 if (hasWeight) weight = Number(weight) let text = '' diff --git a/src/components/PairPrice.vue b/src/components/PairPrice.vue index 88430fd..e8bcab0 100644 --- a/src/components/PairPrice.vue +++ b/src/components/PairPrice.vue @@ -38,13 +38,13 @@ const pair = computed(() => { function pairPrice(chainId, baseToken, quoteToken, price) { if (price === null || price === undefined) return null - const decimals = baseToken.d - quoteToken.d + const decimals = quoteToken.d - baseToken.d // console.log('pairPrice', chainId, baseToken, quoteToken, price, decimals) - // console.log('adjusted pairPrice', price) if (decimals >= 0) price /= 10 ** decimals else price *= 10 ** -decimals + // console.log('adjusted pairPrice', price) if (inversionPreference(chainId, baseToken, quoteToken)) price = 1 / price // console.log('inverted?', price) diff --git a/src/components/Status.vue b/src/components/Status.vue index 1a666d2..89a1d8f 100644 --- a/src/components/Status.vue +++ b/src/components/Status.vue @@ -97,11 +97,11 @@ + :show-btn="true"/> + :show-btn="true"/> diff --git a/src/components/chart/ChartOrder.vue b/src/components/chart/ChartOrder.vue index fe70864..1b16075 100644 --- a/src/components/chart/ChartOrder.vue +++ b/src/components/chart/ChartOrder.vue @@ -156,7 +156,7 @@ const maxAmount = computed(()=>{ return null const balance = s.balances[token.a] if( !balance ) - return 0 + return null const divisor = os.amountIsTotal ? 1 : os.tranches return balance / 10**token.d / divisor }) @@ -165,7 +165,7 @@ const available = computed(()=>{ return max === null ? '' : `Available: ${maxAmount.value} ${tokenIn.value.s}` }) -const lastMaxValue = ref(null) +const lastMaxValue = ref(-1) function setMax() { let amount = maxAmount.value diff --git a/src/orderbuild.js b/src/orderbuild.js index 7a9df98..d036e05 100644 --- a/src/orderbuild.js +++ b/src/orderbuild.js @@ -139,11 +139,11 @@ export function linePointsValue(time0, price0, time1, price1, unixTime = null) { export function applyLinePoint(tranche, symbol, buy, price0) { - console.log('applyLinePoint', buy?'BUY':'SELL', symbol, price0) + const orig = price0 price0 *= 10 ** -symbol.decimals - const inverted = buy === symbol.inverted - if (inverted) + if (buy) price0 = 1/price0 + console.log('applyLinePoint', buy?'BUY':'SELL', symbol, orig, price0) applyLine(tranche, symbol, buy, price0, 0) } @@ -152,8 +152,7 @@ export function applyLinePoints(tranche, symbol, buy, time0, price0, time1, pric const scale = 10 ** -symbol.decimals price0 *= scale price1 *= scale - const inverted = buy === symbol.inverted - if (inverted) { + if (buy) { price0 = 1/price0 price1 = 1/price1 } @@ -165,7 +164,7 @@ export function applyLinePoints(tranche, symbol, buy, time0, price0, time1, pric function applyLine(tranche, symbol, buy, intercept, slope, isMaximum=false) { let m = slope let b = intercept - console.log('applyLine current line value', isMaximum?'min':'max', m*timestamp()+b, 1./(m*timestamp()+b)) + console.log('applyLine current line value', isMaximum?'max':'min', m*timestamp()+b, 1./(m*timestamp()+b)) m = encodeIEE754(m) b = encodeIEE754(b) if (isMaximum) {