@reserve-protocol/dtf-rebalance-lib 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -171,7 +171,7 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
171
171
  // make it an eject auction if there is 1 bps or more of value to eject
172
172
  if (portionBeingEjected.gte(1e-4)) {
173
173
  round = AuctionRound.EJECT;
174
- rebalanceTarget = progression.add(portionBeingEjected.mul(1.5)); // set rebalanceTarget to 50% more than needed, to ensure ejection completes
174
+ rebalanceTarget = progression.add(portionBeingEjected.mul(1.2)); // set rebalanceTarget to 20% more than needed to ensure ejection completes
175
175
  if (rebalanceTarget.gt(numbers_1.ONE)) {
176
176
  rebalanceTarget = numbers_1.ONE;
177
177
  }
@@ -181,7 +181,7 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
181
181
  round = AuctionRound.PROGRESS;
182
182
  rebalanceTarget = initialProgression.add(numbers_1.ONE.sub(initialProgression).mul(finalStageAt));
183
183
  if (rebalanceTarget.gte(numbers_1.ONE)) {
184
- round = AuctionRound.FINAL;
184
+ throw new Error('something has gone very wrong');
185
185
  }
186
186
  }
187
187
  // {1}
@@ -297,7 +297,7 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
297
297
  if (pricesD27.high > initialPrice.high) {
298
298
  pricesD27.high = initialPrice.high;
299
299
  }
300
- if (pricesD27.low == pricesD27.high) {
300
+ if (pricesD27.low == pricesD27.high && priceError[i].gt(numbers_1.ZERO)) {
301
301
  throw new Error('no price range');
302
302
  }
303
303
  return pricesD27;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reserve-protocol/dtf-rebalance-lib",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "Rebalancing library for DTFs in typescript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -266,7 +266,7 @@ export const getOpenAuction = (
266
266
  if (portionBeingEjected.gte(1e-4)) {
267
267
  round = AuctionRound.EJECT
268
268
 
269
- rebalanceTarget = progression.add(portionBeingEjected.mul(1.5)) // set rebalanceTarget to 50% more than needed, to ensure ejection completes
269
+ rebalanceTarget = progression.add(portionBeingEjected.mul(1.2)) // set rebalanceTarget to 20% more than needed to ensure ejection completes
270
270
  if (rebalanceTarget.gt(ONE)) {
271
271
  rebalanceTarget = ONE
272
272
  }
@@ -276,7 +276,7 @@ export const getOpenAuction = (
276
276
 
277
277
  rebalanceTarget = initialProgression.add(ONE.sub(initialProgression).mul(finalStageAt))
278
278
  if (rebalanceTarget.gte(ONE)) {
279
- round = AuctionRound.FINAL
279
+ throw new Error('something has gone very wrong')
280
280
  }
281
281
  }
282
282
 
@@ -425,7 +425,7 @@ export const getOpenAuction = (
425
425
  pricesD27.high = initialPrice.high
426
426
  }
427
427
 
428
- if (pricesD27.low == pricesD27.high) {
428
+ if (pricesD27.low == pricesD27.high && priceError[i].gt(ZERO)) {
429
429
  throw new Error('no price range')
430
430
  }
431
431