line inversion fixes

This commit is contained in:
Tim
2024-05-08 15:14:40 -04:00
parent a68c4a4b05
commit 35eb18618d
6 changed files with 65 additions and 27 deletions

View File

@@ -81,16 +81,23 @@ 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<ps.length; i++) {
const p = ps[i]
let p = ps[i]
if (inverted)
p = 1/p
p *= scale
const w = ws[i]
const t = newTranche({
// todo start/end
fraction: w * MAX_FRACTION,
})
const symbol = co.selectedSymbol
console.log('symbol', symbol)
applyLine(t, order.buy, p, 0, symbol.decimals, symbol.inverted)
console.log('symbol', symbol, isMinimum, p)
applyLine(t, isMinimum, p, 0)
tranches.push(t)
}
return tranches