@reserve-protocol/dtf-rebalance-lib 0.0.13 → 0.0.15

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.
@@ -175,6 +175,13 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
175
175
  : progression.sub(initialProgression).div(numbers_1.ONE.sub(initialProgression));
176
176
  let rebalanceTarget = numbers_1.ONE;
177
177
  let round = AuctionRound.FINAL;
178
+ if (logging) {
179
+ console.log('initialProgression', initialProgression.toString());
180
+ console.log('progression', progression.toString());
181
+ console.log('relativeProgression', relativeProgression.toString());
182
+ console.log('portionBeingEjected', portionBeingEjected.toString());
183
+ console.log('finalStageAt', finalStageAt.toString());
184
+ }
178
185
  // make it an eject auction if there is 1 bps or more of value to eject
179
186
  if (portionBeingEjected.gte(1e-4)) {
180
187
  round = AuctionRound.EJECT;
@@ -187,17 +194,12 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
187
194
  // wiggle room to prevent having to re-run an auction at the same stage after price movement
188
195
  round = AuctionRound.PROGRESS;
189
196
  rebalanceTarget = initialProgression.add(numbers_1.ONE.sub(initialProgression).mul(finalStageAt));
190
- if (rebalanceTarget.gte(numbers_1.ONE)) {
197
+ if (rebalanceTarget.gt(numbers_1.ONE)) {
191
198
  throw new Error('something has gone very wrong');
192
199
  }
193
200
  }
194
201
  if (logging) {
195
202
  console.log('rebalanceTarget', rebalanceTarget.toString());
196
- console.log('initialProgression', initialProgression.toString());
197
- console.log('progression', progression.toString());
198
- console.log('relativeProgression', relativeProgression.toString());
199
- console.log('portionBeingEjected', portionBeingEjected.toString());
200
- console.log('finalStageAt', finalStageAt.toString());
201
203
  }
202
204
  // {1}
203
205
  const delta = numbers_1.ONE.sub(rebalanceTarget);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reserve-protocol/dtf-rebalance-lib",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "Rebalancing library for DTFs in typescript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -269,6 +269,14 @@ export const getOpenAuction = (
269
269
 
270
270
  let rebalanceTarget = ONE
271
271
  let round: AuctionRound = AuctionRound.FINAL
272
+
273
+ if (logging) {
274
+ console.log('initialProgression', initialProgression.toString())
275
+ console.log('progression', progression.toString())
276
+ console.log('relativeProgression', relativeProgression.toString())
277
+ console.log('portionBeingEjected', portionBeingEjected.toString())
278
+ console.log('finalStageAt', finalStageAt.toString())
279
+ }
272
280
 
273
281
  // make it an eject auction if there is 1 bps or more of value to eject
274
282
  if (portionBeingEjected.gte(1e-4)) {
@@ -283,18 +291,13 @@ export const getOpenAuction = (
283
291
  round = AuctionRound.PROGRESS
284
292
 
285
293
  rebalanceTarget = initialProgression.add(ONE.sub(initialProgression).mul(finalStageAt))
286
- if (rebalanceTarget.gte(ONE)) {
294
+ if (rebalanceTarget.gt(ONE)) {
287
295
  throw new Error('something has gone very wrong')
288
296
  }
289
297
  }
290
298
 
291
299
  if (logging) {
292
300
  console.log('rebalanceTarget', rebalanceTarget.toString())
293
- console.log('initialProgression', initialProgression.toString())
294
- console.log('progression', progression.toString())
295
- console.log('relativeProgression', relativeProgression.toString())
296
- console.log('portionBeingEjected', portionBeingEjected.toString())
297
- console.log('finalStageAt', finalStageAt.toString())
298
301
  }
299
302
 
300
303
  // {1}