@reserve-protocol/dtf-rebalance-lib 0.1.6 → 0.2.0

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.
@@ -11,6 +11,7 @@ export declare enum AuctionRound {
11
11
  * @param absoluteProgression {1} The progression of the auction on an absolute scale
12
12
  * @param relativeProgression {1} The relative progression of the auction
13
13
  * @param target {1} The target of the auction on an absolute scale
14
+ * @param relativeTarget {1} The relative target of the auction
14
15
  * @param auctionSize {USD} The total value on sale in the auction
15
16
  * @param surplusTokens The list of tokens in surplus
16
17
  * @param deficitTokens The list of tokens in deficit
@@ -21,6 +22,7 @@ export interface AuctionMetrics {
21
22
  absoluteProgression: number;
22
23
  relativeProgression: number;
23
24
  target: number;
25
+ relativeTarget: number;
24
26
  auctionSize: number;
25
27
  surplusTokens: string[];
26
28
  deficitTokens: string[];
@@ -198,12 +198,14 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
198
198
  }
199
199
  }
200
200
  }
201
- if (rebalanceTarget.lte(numbers_1.ZERO) || rebalanceTarget.gt(numbers_1.ONE)) {
201
+ if (rebalanceTarget.lte(numbers_1.ZERO) || rebalanceTarget.lt(initialProgression) || rebalanceTarget.gt(numbers_1.ONE)) {
202
202
  throw new Error("something has gone very wrong");
203
203
  }
204
+ const relativeTarget = rebalanceTarget.sub(initialProgression).div(numbers_1.ONE.sub(initialProgression));
204
205
  if (debug) {
205
206
  console.log("round", round);
206
207
  console.log("rebalanceTarget", rebalanceTarget.toString());
208
+ console.log("relativeTarget", relativeTarget.toString());
207
209
  }
208
210
  // {1}
209
211
  const delta = numbers_1.ONE.sub(rebalanceTarget);
@@ -399,6 +401,7 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
399
401
  absoluteProgression: progression.toNumber(),
400
402
  relativeProgression: relativeProgression.toNumber(),
401
403
  target: rebalanceTarget.toNumber(),
404
+ relativeTarget: relativeTarget.toNumber(),
402
405
  auctionSize: valueBeingTraded.toNumber(),
403
406
  surplusTokens: surplusTokens,
404
407
  deficitTokens: deficitTokens,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reserve-protocol/dtf-rebalance-lib",
3
- "version": "0.1.6",
3
+ "version": "0.2.0",
4
4
  "description": "Rebalancing library for DTFs in typescript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",