@reserve-protocol/dtf-rebalance-lib 0.0.12 → 0.0.14

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.
@@ -59,7 +59,7 @@ exports.getTargetBasket = getTargetBasket;
59
59
  * @param _priceError {1} Price error to use for each token during auction pricing; should be smaller than price error during startRebalance
60
60
  * @param _finalStageAt {1} The % rebalanced from the initial Folio to determine when is the final stage of the rebalance
61
61
  */
62
- const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket = [], _folio, _decimals, _prices, _priceError, _finalStageAt, logging = false) => {
62
+ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket = [], _folio, _decimals, _prices, _priceError, _finalStageAt, logging) => {
63
63
  if (logging) {
64
64
  console.log('getOpenAuction', rebalance, _supply, _initialFolio, _targetBasket, _folio, _decimals, _prices, _priceError, _finalStageAt);
65
65
  }
@@ -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;
@@ -193,11 +200,6 @@ const getOpenAuction = (rebalance, _supply, _initialFolio = [], _targetBasket =
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);
@@ -20,7 +20,7 @@ const numbers_1 = require("./numbers");
20
20
  * @param _dtfPrice {USD/wholeShare} DTF price
21
21
  * @param weightControl TRACKING=false, NATIVE=true
22
22
  */
23
- const getStartRebalance = (_supply, tokens, decimals, _targetBasket, _prices, _priceError, _dtfPrice, weightControl, logging = false) => {
23
+ const getStartRebalance = (_supply, tokens, decimals, _targetBasket, _prices, _priceError, _dtfPrice, weightControl, logging) => {
24
24
  if (logging) {
25
25
  console.log('getStartRebalance', _supply, tokens, decimals, _targetBasket, _prices, _priceError, _dtfPrice, weightControl);
26
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reserve-protocol/dtf-rebalance-lib",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Rebalancing library for DTFs in typescript",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -111,7 +111,7 @@ export const getOpenAuction = (
111
111
  _prices: number[],
112
112
  _priceError: number[],
113
113
  _finalStageAt: number,
114
- logging: boolean = false
114
+ logging?: boolean
115
115
  ): [OpenAuctionArgs, AuctionMetrics] => {
116
116
  if (logging) {
117
117
  console.log('getOpenAuction', rebalance, _supply, _initialFolio, _targetBasket, _folio, _decimals, _prices, _priceError, _finalStageAt)
@@ -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)) {
@@ -290,11 +298,6 @@ export const getOpenAuction = (
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}
@@ -37,7 +37,7 @@ export const getStartRebalance = (
37
37
  _priceError: number[],
38
38
  _dtfPrice: number,
39
39
  weightControl: boolean,
40
- logging: boolean = false
40
+ logging?: boolean
41
41
  ): StartRebalanceArgsPartial => {
42
42
  if (logging) {
43
43
  console.log('getStartRebalance', _supply, tokens, decimals, _targetBasket, _prices, _priceError, _dtfPrice, weightControl)