@drift-labs/vaults-sdk 0.1.375 → 0.1.377

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.
@@ -10,7 +10,7 @@ export declare const calcModifiedDietz: (currentVaultEquityBaseValue: BigNum, pr
10
10
  marketIndex: number;
11
11
  amount: string;
12
12
  direction: "deposit" | "withdraw";
13
- }[]) => {
13
+ }[], startingMarketValue?: number) => {
14
14
  apy: number;
15
15
  returns: number;
16
16
  };
package/lib/math/vault.js CHANGED
@@ -12,11 +12,10 @@ const DEFAULT_MODIFIED_DIETZ_RESULT = {
12
12
  * @param vaultDeposits
13
13
  * @returns weighted APY and cumulative returns calculated using the Modified Dietz method
14
14
  */
15
- const calcModifiedDietz = (currentVaultEquityBaseValue, precisionExp, vaultDeposits) => {
15
+ const calcModifiedDietz = (currentVaultEquityBaseValue, precisionExp, vaultDeposits, startingMarketValue = 0) => {
16
16
  if (vaultDeposits.length === 0) {
17
17
  return DEFAULT_MODIFIED_DIETZ_RESULT;
18
18
  }
19
- const startingMarketValue = 0;
20
19
  const endingMarkeValue = currentVaultEquityBaseValue.toNum();
21
20
  const firstDepositTs = parseInt(vaultDeposits[vaultDeposits.length - 1].ts);
22
21
  const lastDepositTs = parseInt(vaultDeposits[0].ts);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/vaults-sdk",
3
- "version": "0.1.375",
3
+ "version": "0.1.377",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "directories": {
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "@coral-xyz/anchor": "0.28.0",
11
11
  "@drift-labs/competitions-sdk": "0.2.386",
12
- "@drift-labs/sdk": "2.87.0-beta.1",
12
+ "@drift-labs/sdk": "2.87.0-beta.2",
13
13
  "@solana/web3.js": "1.92.3",
14
14
  "commander": "^11.0.0",
15
15
  "dotenv": "^16.3.1",
package/src/math/vault.ts CHANGED
@@ -19,13 +19,13 @@ export const calcModifiedDietz = (
19
19
  marketIndex: number;
20
20
  amount: string;
21
21
  direction: 'deposit' | 'withdraw';
22
- }[]
22
+ }[],
23
+ startingMarketValue = 0
23
24
  ): { apy: number; returns: number } => {
24
25
  if (vaultDeposits.length === 0) {
25
26
  return DEFAULT_MODIFIED_DIETZ_RESULT;
26
27
  }
27
28
 
28
- const startingMarketValue = 0;
29
29
  const endingMarkeValue = currentVaultEquityBaseValue.toNum();
30
30
  const firstDepositTs = parseInt(vaultDeposits[vaultDeposits.length - 1].ts);
31
31
  const lastDepositTs = parseInt(vaultDeposits[0].ts);