DCABuilder slippage parameter fix

This commit is contained in:
tim
2025-03-26 23:17:28 -04:00
parent 7d04d23a89
commit e86fbfa8e9
6 changed files with 59 additions and 11 deletions

View File

@@ -1,5 +1,6 @@
import {uint32max, uint64max} from "@/misc.js";
import {encodeIEE754} from "@/common.js";
import {DEFAULT_SLIPPAGE} from "@/orderbuild.js";
export const MAX_FRACTION = 65535;
export const NO_CONDITIONAL_ORDER = uint64max;
@@ -86,6 +87,10 @@ export function newTranche({
if( marketOrder ) {
if (minIntercept !== 0 || minSlope !== 0 || maxIntercept !== 0 || maxSlope !== 0)
console.warn('Ignoring line information in a market order')
if (slippage === 0) {
console.warn(`setting market order slippage to ${DEFAULT_SLIPPAGE}`)
slippage = DEFAULT_SLIPPAGE
}
minIntercept = encodeIEE754(slippage) // this is the slippage field for market orders
minSlope = 0
maxIntercept = 0