price handling fixes affecting orderbuild, pairprice, ordershapes, etc
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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])
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = ''
|
||||
|
||||
Reference in New Issue
Block a user