@sonarwatch/portfolio-core 0.12.10 → 0.12.12

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/CHANGELOG.md CHANGED
@@ -2,10 +2,18 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
- ## [0.12.10](https://github.com/sonarwatch/portfolio/compare/core-0.12.9...core-0.12.10) (2024-06-03)
5
+ ## [0.12.12](https://github.com/sonarwatch/portfolio/compare/core-0.12.11...core-0.12.12) (2024-06-04)
6
6
 
7
7
 
8
8
 
9
+ ## [0.12.11](https://github.com/sonarwatch/portfolio/compare/core-0.12.10...core-0.12.11) (2024-06-04)
10
+
11
+
12
+
13
+ ## [0.12.10](https://github.com/sonarwatch/portfolio/compare/core-0.12.9...core-0.12.10) (2024-06-03)
14
+
15
+
16
+
9
17
  ## [0.12.9](https://github.com/sonarwatch/portfolio/compare/core-0.12.8...core-0.12.9) (2024-06-03)
10
18
 
11
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-core",
3
- "version": "0.12.10",
3
+ "version": "0.12.12",
4
4
  "type": "commonjs",
5
5
  "types": "./src/index.d.ts",
6
6
  "dependencies": {
package/src/Yield.d.ts CHANGED
@@ -13,11 +13,19 @@ export declare function aprToApy(apr: number, compoundFrequency?: number): numbe
13
13
  */
14
14
  export declare function apyToApr(apy: number, compoundFrequency?: number): number;
15
15
  /**
16
- * Represents the yield information including APR and APY.
16
+ * Represents a yield information with APR and APY (as fraction).
17
17
  * If negative, it means that it costs money to hold the asset.
18
18
  */
19
19
  export type Yield = {
20
+ /**
21
+ * APR (Annual Percentage Rate) as fraction.
22
+ * 0.25 means 25% APR
23
+ */
20
24
  apr: number;
25
+ /**
26
+ * APY (Annual Percentage Yield) as fraction.
27
+ * 0.28 means 28% APY
28
+ */
21
29
  apy: number;
22
30
  };
23
31
  /**
@@ -25,10 +33,10 @@ export type Yield = {
25
33
  * @param apr The Annual Percentage Rate.
26
34
  * @returns The Yield object with the calculated APY.
27
35
  */
28
- export declare const createYieldFromApr: (apr: number) => Yield;
36
+ export declare const yieldFromApr: (apr: number) => Yield;
29
37
  /**
30
38
  * Creates a Yield object from the given APY.
31
39
  * @param apy The Annual Percentage Yield.
32
40
  * @returns The Yield object with the calculated APR.
33
41
  */
34
- export declare const createYieldFromApy: (apy: number) => Yield;
42
+ export declare const yieldFromApy: (apy: number) => Yield;
package/src/Yield.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createYieldFromApy = exports.createYieldFromApr = exports.apyToApr = exports.aprToApy = void 0;
3
+ exports.yieldFromApy = exports.yieldFromApr = exports.apyToApr = exports.aprToApy = void 0;
4
4
  /**
5
5
  * Calculates the Annual Percentage Yield (APY) based on the Annual Percentage Rate (APR).
6
6
  * @param apr The Annual Percentage Rate.
@@ -26,19 +26,19 @@ exports.apyToApr = apyToApr;
26
26
  * @param apr The Annual Percentage Rate.
27
27
  * @returns The Yield object with the calculated APY.
28
28
  */
29
- const createYieldFromApr = (apr) => ({
29
+ const yieldFromApr = (apr) => ({
30
30
  apr,
31
31
  apy: aprToApy(apr),
32
32
  });
33
- exports.createYieldFromApr = createYieldFromApr;
33
+ exports.yieldFromApr = yieldFromApr;
34
34
  /**
35
35
  * Creates a Yield object from the given APY.
36
36
  * @param apy The Annual Percentage Yield.
37
37
  * @returns The Yield object with the calculated APR.
38
38
  */
39
- const createYieldFromApy = (apy) => ({
39
+ const yieldFromApy = (apy) => ({
40
40
  apr: apyToApr(apy),
41
41
  apy,
42
42
  });
43
- exports.createYieldFromApy = createYieldFromApy;
43
+ exports.yieldFromApy = yieldFromApy;
44
44
  //# sourceMappingURL=Yield.js.map
package/src/Yield.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Yield.js","sourceRoot":"","sources":["../../../../packages/core/src/Yield.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