bugfix for limit/diagonal tranche building
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {uint32max, uint64max} from "@/misc.js";
|
||||
import {encodeIEE754} from "@/common.js";
|
||||
import {DEFAULT_SLIPPAGE} from "@/orderbuild.js";
|
||||
import {DEFAULT_SLIPPAGE, MIN_SLIPPAGE} from "@/orderbuild.js";
|
||||
|
||||
export const MAX_FRACTION = 65535;
|
||||
export const NO_CONDITIONAL_ORDER = uint64max;
|
||||
@@ -82,15 +82,13 @@ export function newTranche({
|
||||
rateLimitFraction = 0,
|
||||
rateLimitPeriod = 0,
|
||||
} = {}) {
|
||||
if( minIntercept === 0 && minSlope === 0 && maxIntercept === 0 && maxSlope === 0 )
|
||||
marketOrder = true
|
||||
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}`)
|
||||
throw Error('Cannot set line information on a market order')
|
||||
if (slippage === 0)
|
||||
slippage = DEFAULT_SLIPPAGE
|
||||
}
|
||||
else if (slippage < MIN_SLIPPAGE)
|
||||
slippage = MIN_SLIPPAGE
|
||||
minIntercept = encodeIEE754(slippage) // this is the slippage field for market orders
|
||||
minSlope = 0
|
||||
maxIntercept = 0
|
||||
|
||||
Reference in New Issue
Block a user