shufflecom-calculations 6.12.0 → 6.12.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shufflecom-calculations",
3
- "version": "6.12.0",
3
+ "version": "6.12.1",
4
4
  "description": "",
5
5
  "types": "lib/index.d.ts",
6
6
  "main": "lib/index.js",
@@ -19,5 +19,5 @@
19
19
  },
20
20
  "author": "",
21
21
  "license": "ISC",
22
- "gitHead": "6656b3e0dc340fe986901432c7fdf076d838c304"
22
+ "gitHead": "150cf4b9aac66f07c03577e943656c61b9daf3b3"
23
23
  }
@@ -2,9 +2,6 @@ import BigNumber from 'bignumber.js';
2
2
 
3
3
  export const STONKS_MIN_TAKE_PROFIT_MULTIPLIER = BigNumber(1.05);
4
4
 
5
- export const STONKS_TP_MIN_PROXIMITY_TO_ENTRY = BigNumber(0.001);
6
- export const STONKS_TP_MIN_PROXIMITY_TO_BUST = BigNumber(0.001);
7
-
8
5
  // Extra decimal precision carried internally, used only to detect bust price colliding with
9
6
  // entry price at high leverage / low price.
10
7
  export const STONKS_INTERNAL_PRICE_DECIMAL_PLACES = 10;
@@ -13,8 +10,6 @@ export const STONKS_INTERNAL_PRICE_DECIMAL_PLACES = 10;
13
10
  export const STONKS_MIN_LEVERAGE = BigNumber(1);
14
11
  export const STONKS_MAX_LEVERAGE = BigNumber(1000);
15
12
 
16
- export const STONKS_MAX_ACTIVE_BETS_PER_ACCOUNT = 20;
17
-
18
13
  export const STONKS_START_PRICE = BigNumber(1000);
19
14
  export const STONKS_VOLATILITY = 0.001;
20
15
 
@@ -39,6 +34,3 @@ export const STONKS_CHECKPOINT_INTERVAL_TICKS = 500;
39
34
  export const STONKS_PRICE_BAR_INTERVAL_TICKS = 5_000 / STONKS_TICK_DURATION_MS;
40
35
 
41
36
  export const STONKS_PROFIT_FEE_RATE = BigNumber(0.05);
42
-
43
- // Keep well under 2^53: contracts cross into Redis Lua's tonumber(), which loses precision above that (unlike BigNumber here)
44
- export const STONKS_CONTRACT_SCALE = BigNumber(10).pow(6);
@@ -57,22 +57,9 @@ describe('StonksRules', () => {
57
57
  });
58
58
 
59
59
  describe('isValidTakeProfitMultiplier', () => {
60
- it('requires the multiplier to exceed the configured floor', () => {
61
- expect(StonksRules.isValidTakeProfitMultiplier(STONKS_MIN_TAKE_PROFIT_MULTIPLIER)).toBe(false);
62
- expect(StonksRules.isValidTakeProfitMultiplier(STONKS_MIN_TAKE_PROFIT_MULTIPLIER.plus('0.01'))).toBe(true);
63
- });
64
- });
65
-
66
- describe('isTakeProfitFarEnoughFromEntry / isTakeProfitFarEnoughFromBust', () => {
67
- it('rejects an implied price too close to entry or too close to bust', () => {
68
- const entryPrice = number(100);
69
- const bustPrice = number(90);
70
-
71
- expect(StonksRules.isTakeProfitFarEnoughFromEntry(entryPrice, number('100.0001'))).toBe(false);
72
- expect(StonksRules.isTakeProfitFarEnoughFromEntry(entryPrice, number(110))).toBe(true);
73
-
74
- expect(StonksRules.isTakeProfitFarEnoughFromBust(entryPrice, bustPrice, number('90.0001'))).toBe(false);
75
- expect(StonksRules.isTakeProfitFarEnoughFromBust(entryPrice, bustPrice, number(110))).toBe(true);
60
+ it('requires the multiplier to be at or above the configured floor', () => {
61
+ expect(StonksRules.isValidTakeProfitMultiplier(STONKS_MIN_TAKE_PROFIT_MULTIPLIER.minus('0.01'))).toBe(false);
62
+ expect(StonksRules.isValidTakeProfitMultiplier(STONKS_MIN_TAKE_PROFIT_MULTIPLIER)).toBe(true);
76
63
  });
77
64
  });
78
65
 
@@ -8,8 +8,6 @@ import {
8
8
  STONKS_ROUND_DURATION_MS,
9
9
  STONKS_ROUND_TICK_COUNT,
10
10
  STONKS_TICK_DURATION_MS,
11
- STONKS_TP_MIN_PROXIMITY_TO_BUST,
12
- STONKS_TP_MIN_PROXIMITY_TO_ENTRY,
13
11
  } from './constants';
14
12
 
15
13
  export enum StonksDirection {
@@ -75,15 +73,7 @@ export class StonksRules {
75
73
  }
76
74
 
77
75
  static isValidTakeProfitMultiplier(takeProfitMultiplier: BigNumber): boolean {
78
- return takeProfitMultiplier.isGreaterThan(STONKS_MIN_TAKE_PROFIT_MULTIPLIER);
79
- }
80
-
81
- static isTakeProfitFarEnoughFromEntry(entryPrice: BigNumber, takeProfitImpliedPrice: BigNumber): boolean {
82
- return takeProfitImpliedPrice.minus(entryPrice).abs().dividedBy(entryPrice).isGreaterThanOrEqualTo(STONKS_TP_MIN_PROXIMITY_TO_ENTRY);
83
- }
84
-
85
- static isTakeProfitFarEnoughFromBust(entryPrice: BigNumber, bustPrice: BigNumber, takeProfitImpliedPrice: BigNumber): boolean {
86
- return takeProfitImpliedPrice.minus(bustPrice).abs().dividedBy(entryPrice).isGreaterThanOrEqualTo(STONKS_TP_MIN_PROXIMITY_TO_BUST);
76
+ return takeProfitMultiplier.isGreaterThanOrEqualTo(STONKS_MIN_TAKE_PROFIT_MULTIPLIER);
87
77
  }
88
78
 
89
79
  static isBustPriceDistinctFromEntry(entryPrice: BigNumber, bustPrice: BigNumber): boolean {