orderbuilding fixes for new line price semantics

This commit is contained in:
tim
2024-09-04 02:47:39 -04:00
parent 5afdc83957
commit 93dfb8bdcd
6 changed files with 29 additions and 43 deletions

View File

@@ -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<ps.length; 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, isMinimum, p)
applyLine(t, isMinimum, p, 0)
console.log('symbol', symbol, p)
applyLine(t, symbol, order.buy, p, 0)
tranches.push(t)
}
return tranches