order building fixes
This commit is contained in:
@@ -139,15 +139,17 @@ export function applyLine(tranche, intercept, slope, isMinimum = null) {
|
||||
|
||||
|
||||
export function applyLine2(tranche, isMinimum, intercept, slope, poolDecimals, inverted) {
|
||||
// console.log('intercept, slope', intercept, slope)
|
||||
console.log('intercept, slope', intercept, slope)
|
||||
// intercept and slope are still in "human" units of decimal-adjusted prices
|
||||
const scale = 10 ** -poolDecimals
|
||||
let m = inverted ? -scale / slope : slope / scale
|
||||
let b = inverted ? scale / intercept : intercept / scale
|
||||
let m = slope === 0 ? 0 : inverted ? -scale / slope : scale * slope
|
||||
let b = inverted ? scale / intercept : scale * intercept
|
||||
const cur = b + timestamp() * m
|
||||
console.log('inverted b, m, cur', inverted, b, m, cur)
|
||||
m = encodeIEE754(m)
|
||||
b = encodeIEE754(b)
|
||||
if (inverted)
|
||||
isMinimum = !isMinimum
|
||||
if (isMinimum) {
|
||||
tranche.minIntercept = b;
|
||||
tranche.minSlope = m;
|
||||
|
||||
Reference in New Issue
Block a user