Gradient strategy support#337
Conversation
| const EXP_ONE_DIV_RR = EXP_ONE / RR; // = 2 ^ 31 | ||
| const EXP_ONE_DIV_MM = EXP_ONE / MM; // = 2 ^ 79 | ||
|
|
||
| enum GradientType { |
There was a problem hiding this comment.
Consider using const enum GradientType instead.
- enum creates a self calling function
- const enum creates numbers
| LINEAR_INCREASE, | ||
| LINEAR_DECREASE, |
There was a problem hiding this comment.
Couldn't Linear_Increase and Linear_Decrease be derived from startPrice and endPrice ? So we would only have LINEAR, LINEAR_INV or EXPONENTIAL
There was a problem hiding this comment.
this simply reflects the contracts API
| if (new Decimal(budget).isNegative()) { | ||
| throw new Error('budgets cannot be negative'); | ||
| } | ||
| if (endTime <= startTime) { |
There was a problem hiding this comment.
Isn't endTime === 0 && startTime === 0 a valid value (empty order) ?
| token0, | ||
| token1, | ||
| strategies.map(encodedStrategyStrToBN), | ||
| (parsedCache.gradientStrategiesByPair[key] ?? []).map( |
There was a problem hiding this comment.
Can we make the field gradientStrategiesByPair optional ? It would prevent app with existing cache to break
|
When trying to create a strategy I get this error: Logs: {
"0": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"1": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"2": "0",
"3": "0",
"4": "0",
"5": 1,
"6": 0,
"7": 1000000000,
"8": "2540.121098406958",
"9": "2332.2930085372978",
"10": "1",
"11": 1,
"12": 1776729600,
"13": 1778457600
}for the value 7, I set a date bigger than 0 to avoid the error where endTime is equal to stateTime |
When the rates of an order are all but zero (typically in a strategy where only the other order is valid), you should avoid encoding it |
|
add gradientTradingFeePPMByPair as gradient pairs can have their own fees |
|
Wrong handling the startTime/endTime terminology - it should be translated to startTime and expiry, where expiry is calculated from end - start. |
missing: trading through gradient strategies, and using batcher to trade through both types of strategies