@sonarwatch/portfolio-plugins 0.12.37 → 0.12.38

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. package/CHANGELOG.md +1843 -1839
  2. package/README.md +3 -3
  3. package/package.json +1 -1
  4. package/src/plugins/balancer/helpers/pools.js +21 -21
  5. package/src/plugins/drift/constants.d.ts +1 -0
  6. package/src/plugins/drift/constants.js +2 -1
  7. package/src/plugins/drift/constants.js.map +1 -1
  8. package/src/plugins/drift/depositsFetcher.js +63 -1
  9. package/src/plugins/drift/depositsFetcher.js.map +1 -1
  10. package/src/plugins/drift/filters.d.ts +1 -0
  11. package/src/plugins/drift/filters.js +4 -1
  12. package/src/plugins/drift/filters.js.map +1 -1
  13. package/src/plugins/drift/index.js +2 -1
  14. package/src/plugins/drift/index.js.map +1 -1
  15. package/src/plugins/drift/perpHelpers/amm.d.ts +74 -0
  16. package/src/plugins/drift/perpHelpers/amm.js +567 -0
  17. package/src/plugins/drift/perpHelpers/amm.js.map +1 -0
  18. package/src/plugins/drift/perpHelpers/assert.d.ts +1 -0
  19. package/src/plugins/drift/perpHelpers/assert.js +10 -0
  20. package/src/plugins/drift/perpHelpers/assert.js.map +1 -0
  21. package/src/plugins/drift/perpHelpers/constants.d.ts +27 -0
  22. package/src/plugins/drift/perpHelpers/constants.js +35 -0
  23. package/src/plugins/drift/perpHelpers/constants.js.map +1 -0
  24. package/src/plugins/drift/perpHelpers/convert.d.ts +0 -0
  25. package/src/plugins/drift/perpHelpers/convert.js +2 -0
  26. package/src/plugins/drift/perpHelpers/convert.js.map +1 -0
  27. package/src/plugins/drift/perpHelpers/getOraclePrice.d.ts +4 -0
  28. package/src/plugins/drift/perpHelpers/getOraclePrice.js +61 -0
  29. package/src/plugins/drift/perpHelpers/getOraclePrice.js.map +1 -0
  30. package/src/plugins/drift/perpHelpers/getPerpMarket.d.ts +4 -0
  31. package/src/plugins/drift/perpHelpers/getPerpMarket.js +33 -0
  32. package/src/plugins/drift/perpHelpers/getPerpMarket.js.map +1 -0
  33. package/src/plugins/drift/perpHelpers/margin.d.ts +10 -0
  34. package/src/plugins/drift/perpHelpers/margin.js +82 -0
  35. package/src/plugins/drift/perpHelpers/margin.js.map +1 -0
  36. package/src/plugins/drift/perpHelpers/math.d.ts +4 -0
  37. package/src/plugins/drift/perpHelpers/math.js +29 -0
  38. package/src/plugins/drift/perpHelpers/math.js.map +1 -0
  39. package/src/plugins/drift/perpHelpers/oracle.d.ts +6 -0
  40. package/src/plugins/drift/perpHelpers/oracle.js +54 -0
  41. package/src/plugins/drift/perpHelpers/oracle.js.map +1 -0
  42. package/src/plugins/drift/perpHelpers/orders.d.ts +2 -0
  43. package/src/plugins/drift/perpHelpers/orders.js +9 -0
  44. package/src/plugins/drift/perpHelpers/orders.js.map +1 -0
  45. package/src/plugins/drift/perpHelpers/position.d.ts +44 -0
  46. package/src/plugins/drift/perpHelpers/position.js +184 -0
  47. package/src/plugins/drift/perpHelpers/position.js.map +1 -0
  48. package/src/plugins/drift/perpHelpers/prelaunchOracle.d.ts +3 -0
  49. package/src/plugins/drift/perpHelpers/prelaunchOracle.js +20 -0
  50. package/src/plugins/drift/perpHelpers/prelaunchOracle.js.map +1 -0
  51. package/src/plugins/drift/perpHelpers/pyth.d.ts +5 -0
  52. package/src/plugins/drift/perpHelpers/pyth.js +42 -0
  53. package/src/plugins/drift/perpHelpers/pyth.js.map +1 -0
  54. package/src/plugins/drift/perpHelpers/repeg.d.ts +14 -0
  55. package/src/plugins/drift/perpHelpers/repeg.js +162 -0
  56. package/src/plugins/drift/perpHelpers/repeg.js.map +1 -0
  57. package/src/plugins/drift/perpHelpers/switchboard.d.ts +3 -0
  58. package/src/plugins/drift/perpHelpers/switchboard.js +31 -0
  59. package/src/plugins/drift/perpHelpers/switchboard.js.map +1 -0
  60. package/src/plugins/drift/perpHelpers/types.d.ts +28 -0
  61. package/src/plugins/drift/perpHelpers/types.js +19 -0
  62. package/src/plugins/drift/perpHelpers/types.js.map +1 -0
  63. package/src/plugins/drift/prepMarketsJob.d.ts +3 -0
  64. package/src/plugins/drift/prepMarketsJob.js +38 -0
  65. package/src/plugins/drift/prepMarketsJob.js.map +1 -0
  66. package/src/plugins/drift/struct.d.ts +82 -76
  67. package/src/plugins/drift/struct.js +79 -74
  68. package/src/plugins/drift/struct.js.map +1 -1
  69. package/src/plugins/drift/types.d.ts +1 -0
  70. package/src/plugins/jupiter/exchange/perpetualFetcher.js +3 -6
  71. package/src/plugins/jupiter/exchange/perpetualFetcher.js.map +1 -1
  72. package/src/plugins/jupiter/exchange/valueAverageFetcher.js.map +1 -1
  73. package/src/plugins/jupiter/helpers.d.ts +2 -2
  74. package/src/plugins/jupiter/helpers.js.map +1 -1
  75. package/src/plugins/sushiswap/helpers.js +24 -24
  76. package/src/plugins/uniswap-v2/helpers.js +22 -22
  77. package/src/plugins/zeta/airdropFetcher.js +14 -14
  78. package/src/utils/sei/constants.js +8 -8
  79. package/src/utils/sei/getQueryBalanceByOwner.js +4 -4
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # @sonarwatch/portfolio-plugins
2
-
3
- This library is @sonarwatch/portfolio-plugins
1
+ # @sonarwatch/portfolio-plugins
2
+
3
+ This library is @sonarwatch/portfolio-plugins
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonarwatch/portfolio-plugins",
3
- "version": "0.12.37",
3
+ "version": "0.12.38",
4
4
  "type": "commonjs",
5
5
  "types": "./src/index.d.ts",
6
6
  "peerDependencies": {
@@ -36,27 +36,27 @@ exports.getBalancerPoolsV2 = void 0;
36
36
  const graphql_request_1 = __importStar(require("graphql-request"));
37
37
  function getBalancerPoolsV2(url) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
- const query = (0, graphql_request_1.gql) `
40
- query pools {
41
- pools(
42
- first: 1000
43
- orderBy: totalLiquidity
44
- orderDirection: desc
45
- where: { totalLiquidity_gt: "500" }
46
- ) {
47
- id
48
- address
49
- symbol
50
- totalLiquidity
51
- totalShares
52
- tokens {
53
- balance
54
- decimals
55
- symbol
56
- address
57
- }
58
- }
59
- }
39
+ const query = (0, graphql_request_1.gql) `
40
+ query pools {
41
+ pools(
42
+ first: 1000
43
+ orderBy: totalLiquidity
44
+ orderDirection: desc
45
+ where: { totalLiquidity_gt: "500" }
46
+ ) {
47
+ id
48
+ address
49
+ symbol
50
+ totalLiquidity
51
+ totalShares
52
+ tokens {
53
+ balance
54
+ decimals
55
+ symbol
56
+ address
57
+ }
58
+ }
59
+ }
60
60
  `;
61
61
  const res = yield (0, graphql_request_1.default)(url, query);
62
62
  const pools = res.pools;
@@ -8,6 +8,7 @@ export declare const platform: Platform;
8
8
  export declare const prefixSpotMarkets = "drift-spotMarkets";
9
9
  export declare const driftProgram: PublicKey;
10
10
  export declare const preMarketPriceKey = "premarketPrice";
11
+ export declare const perpMarketsIndexesKey = "perp-markets-indexes";
11
12
  export declare const airdropUrl = "https://airdrop.drift.trade/eligibility/";
12
13
  export declare const distributorPid = "E7HtfkEMhmn9uwL7EFNydcXBWy5WCYN1vFmKKjipEH1x";
13
14
  export declare const driftDecimals = 6;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.driftMint = exports.driftDecimals = exports.distributorPid = exports.airdropUrl = exports.preMarketPriceKey = exports.driftProgram = exports.prefixSpotMarkets = exports.platform = exports.platformWebsite = exports.platformImage = exports.platformName = exports.platformId = void 0;
3
+ exports.driftMint = exports.driftDecimals = exports.distributorPid = exports.airdropUrl = exports.perpMarketsIndexesKey = exports.preMarketPriceKey = exports.driftProgram = exports.prefixSpotMarkets = exports.platform = exports.platformWebsite = exports.platformImage = exports.platformName = exports.platformId = void 0;
4
4
  const web3_js_1 = require("@solana/web3.js");
5
5
  exports.platformId = 'drift';
6
6
  exports.platformName = 'Drift';
@@ -16,6 +16,7 @@ exports.platform = {
16
16
  exports.prefixSpotMarkets = `${exports.platformId}-spotMarkets`;
17
17
  exports.driftProgram = new web3_js_1.PublicKey('dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH');
18
18
  exports.preMarketPriceKey = 'premarketPrice';
19
+ exports.perpMarketsIndexesKey = 'perp-markets-indexes';
19
20
  exports.airdropUrl = 'https://airdrop.drift.trade/eligibility/';
20
21
  exports.distributorPid = 'E7HtfkEMhmn9uwL7EFNydcXBWy5WCYN1vFmKKjipEH1x';
21
22
  exports.driftDecimals = 6;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,YAAY,GAAG,OAAO,CAAC;AACvB,QAAA,aAAa,GAAG,6CAA6C,CAAC;AAC9D,QAAA,eAAe,GAAG,0BAA0B,CAAC;AAC7C,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,oBAAY;IAClB,KAAK,EAAE,qBAAa;IACpB,WAAW,EAAE,OAAO;IACpB,OAAO,EAAE,uBAAe;CACzB,CAAC;AACW,QAAA,iBAAiB,GAAG,GAAG,kBAAU,cAAc,CAAC;AAEhD,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,iBAAiB,GAAG,gBAAgB,CAAC;AAErC,QAAA,UAAU,GAAG,0CAA0C,CAAC;AACxD,QAAA,cAAc,GAAG,8CAA8C,CAAC;AAChE,QAAA,aAAa,GAAG,CAAC,CAAC;AAClB,QAAA,SAAS,GAAG,8CAA8C,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/constants.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAG/B,QAAA,UAAU,GAAG,OAAO,CAAC;AACrB,QAAA,YAAY,GAAG,OAAO,CAAC;AACvB,QAAA,aAAa,GAAG,6CAA6C,CAAC;AAC9D,QAAA,eAAe,GAAG,0BAA0B,CAAC;AAC7C,QAAA,QAAQ,GAAa;IAChC,EAAE,EAAE,kBAAU;IACd,IAAI,EAAE,oBAAY;IAClB,KAAK,EAAE,qBAAa;IACpB,WAAW,EAAE,OAAO;IACpB,OAAO,EAAE,uBAAe;CACzB,CAAC;AACW,QAAA,iBAAiB,GAAG,GAAG,kBAAU,cAAc,CAAC;AAEhD,QAAA,YAAY,GAAG,IAAI,mBAAS,CACvC,6CAA6C,CAC9C,CAAC;AAEW,QAAA,iBAAiB,GAAG,gBAAgB,CAAC;AACrC,QAAA,qBAAqB,GAAG,sBAAsB,CAAC;AAE/C,QAAA,UAAU,GAAG,0CAA0C,CAAC;AACxD,QAAA,cAAc,GAAG,8CAA8C,CAAC;AAChE,QAAA,aAAa,GAAG,CAAC,CAAC;AAClB,QAAA,SAAS,GAAG,8CAA8C,CAAC"}
@@ -21,6 +21,11 @@ const helpers_1 = require("./helpers");
21
21
  const solana_1 = require("../../utils/solana");
22
22
  const clients_1 = require("../../utils/clients");
23
23
  const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
24
+ const position_1 = require("./perpHelpers/position");
25
+ const constants_2 = require("./perpHelpers/constants");
26
+ const types_1 = require("./perpHelpers/types");
27
+ const getOraclePrice_1 = require("./perpHelpers/getOraclePrice");
28
+ const getPerpMarket_1 = require("./perpHelpers/getPerpMarket");
24
29
  const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
25
30
  const client = (0, clients_1.getClientSolana)();
26
31
  const spotMarketsItems = yield cache.getAllItems({
@@ -82,6 +87,14 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
82
87
  } while (parsedAccount[parsedAccount.length]);
83
88
  if (!userAccounts)
84
89
  return elements;
90
+ const perpMarketIndexesArr = yield cache.getItem(constants_1.perpMarketsIndexesKey, {
91
+ prefix: constants_1.platformId,
92
+ networkId: portfolio_core_1.NetworkId.solana,
93
+ });
94
+ const perpMarketAddressByIndex = new Map();
95
+ perpMarketIndexesArr === null || perpMarketIndexesArr === void 0 ? void 0 : perpMarketIndexesArr.forEach(([index, address]) => {
96
+ perpMarketAddressByIndex.set(index, address);
97
+ });
85
98
  // One user can have multiple sub-account
86
99
  for (const userAccount of userAccounts) {
87
100
  if (!userAccount)
@@ -92,6 +105,46 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
92
105
  const suppliedYields = [];
93
106
  const rewardAssets = [];
94
107
  const marketIndexRef = 0;
108
+ const unsettledAssets = [];
109
+ for (const perpPosition of userAccount.perpPositions) {
110
+ if (perpPosition.baseAssetAmount.isZero())
111
+ continue;
112
+ const perpMarketAddress = perpMarketAddressByIndex.get(perpPosition.marketIndex);
113
+ if (!perpMarketAddress)
114
+ continue;
115
+ const market = yield (0, getPerpMarket_1.getPerpMarket)(perpMarketAddress, client);
116
+ if (!market)
117
+ continue;
118
+ const oraclePriceData = yield (0, getOraclePrice_1.getOraclePrice)(market.amm.oracle.toString(), market.amm.oracleSource, client);
119
+ const pnl = new bignumber_js_1.default((0, position_1.calculatePositionPNL)(market, perpPosition, oraclePriceData).toString())
120
+ .div(constants_2.PRICE_PRECISION_BIG_NUMBER)
121
+ .toNumber();
122
+ const side = (0, position_1.positionCurrentDirection)(perpPosition) === types_1.PositionDirection.LONG
123
+ ? portfolio_core_1.LeverageSide.long
124
+ : portfolio_core_1.LeverageSide.short;
125
+ // console.log('market:', market.pubkey);
126
+ // // console.log('entryPrice', calculateEntryPrice(perpPosition));
127
+ // console.log('perpPosition:', perpPosition.baseAssetAmount.toString());
128
+ // console.log('pnl:', pnl.toString());
129
+ // console.log('baseAssetValue:', baseAssetValue.toString());
130
+ // console.log(
131
+ // 'quoteEntryAmount:',
132
+ // perpPosition.quoteEntryAmount.toString()
133
+ // );
134
+ // console.log('-----');
135
+ const asset = {
136
+ type: portfolio_core_1.PortfolioAssetType.generic,
137
+ networkId: portfolio_core_1.NetworkId.solana,
138
+ value: pnl,
139
+ data: {
140
+ name: (0, solana_1.u8ArrayToString)(market.name),
141
+ },
142
+ attributes: {
143
+ tags: [side],
144
+ },
145
+ };
146
+ unsettledAssets.push(asset);
147
+ }
95
148
  // Each account has up to 8 SpotPositions
96
149
  for (const spotPosition of userAccount.spotPositions) {
97
150
  if (spotPosition.scaledBalance.isZero())
@@ -141,7 +194,12 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
141
194
  }
142
195
  if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
143
196
  continue;
144
- const { borrowedValue, suppliedValue, value, healthRatio, rewardValue } = (0, portfolio_core_1.getElementLendingValues)({ suppliedAssets, borrowedAssets, rewardAssets });
197
+ const { borrowedValue, suppliedValue, value, healthRatio, rewardValue, unsettledValue, } = (0, portfolio_core_1.getElementLendingValues)({
198
+ suppliedAssets,
199
+ borrowedAssets,
200
+ rewardAssets,
201
+ unsettledAssets,
202
+ });
145
203
  elements.push({
146
204
  type: portfolio_core_1.PortfolioElementType.borrowlend,
147
205
  networkId: portfolio_core_1.NetworkId.solana,
@@ -158,6 +216,10 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
158
216
  rewardAssets,
159
217
  rewardValue,
160
218
  healthRatio,
219
+ unsettled: {
220
+ assets: unsettledAssets,
221
+ value: unsettledValue,
222
+ },
161
223
  value,
162
224
  },
163
225
  name: (0, solana_1.u8ArrayToString)(userAccount.name),
@@ -1 +1 @@
1
- {"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAUoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,2CAA0E;AAC1E,qCAIkB;AAClB,uCAMmB;AAEnB,+CAG4B;AAC5B,iDAAsD;AACtD,qGAA6E;AAE7E,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBA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AC5B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"depositsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/depositsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAaoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,2CAKqB;AACrB,qCAKkB;AAClB,uCAMmB;AAEnB,+CAI4B;AAC5B,iDAAsD;AACtD,qGAA6E;AAC7E,qDAGgC;AAChC,uDAAqE;AACrE,+CAAwD;AACxD,iEAA8D;AAC9D,+DAA4D;AAE5D,MAAM,QAAQ,GAAoB,CAAO,KAAa,EAAE,KAAY,EAAE,EAAE;IACtE,MAAM,MAAM,GAAG,IAAA,yBAAe,GAAE,CAAC;IAEjC,MAAM,gBAAgB,GAAG,MAAM,KAAK,CAAC,WAAW,CAAqB;QACnE,MAAM,EAAE,6BAAiB;QACzB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;IAEH,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAE7C,MAAM,iBAAiB,GAAoC,IAAI,GAAG,EAAE,CAAC;IACrE,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,MAAM,mCAAmC,GAAgB,EAAE,CAAC;IAC5D,KAAK,MAAM,cAAc,IAAI,gBAAgB,EAAE,CAAC;QAC9C,mCAAmC,CAAC,cAAc,CAAC,WAAW,CAAC;YAC7D,IAAA,mDAAyC,EACvC,wBAAY,EACZ,IAAI,mBAAS,CAAC,KAAK,CAAC,EACpB,cAAc,CAAC,WAAW,CAC3B,CAAC;QACJ,iBAAiB,CAAC,GAAG,CAAC,cAAc,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAClE,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACnD,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AC;AAEF,kBAAe,OAAO,CAAC"}
@@ -1,3 +1,4 @@
1
1
  import { GetProgramAccountsFilter } from '@solana/web3.js';
2
2
  export declare const accountsFilter: (owner: string) => GetProgramAccountsFilter[];
3
3
  export declare const marketFilter: GetProgramAccountsFilter[];
4
+ export declare const perpMarketsFilters: GetProgramAccountsFilter[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.marketFilter = exports.accountsFilter = void 0;
3
+ exports.perpMarketsFilters = exports.marketFilter = exports.accountsFilter = void 0;
4
4
  const struct_1 = require("./struct");
5
5
  const accountsFilter = (owner) => [
6
6
  {
@@ -20,4 +20,7 @@ exports.accountsFilter = accountsFilter;
20
20
  exports.marketFilter = [
21
21
  { dataSize: struct_1.spotMarketStruct.byteSize },
22
22
  ];
23
+ exports.perpMarketsFilters = [
24
+ { dataSize: struct_1.perpMarketStruct.byteSize },
25
+ ];
23
26
  //# sourceMappingURL=filters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/filters.ts"],"names":[],"mappings":";;;AACA,qCAA4C;AAErC,MAAM,cAAc,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC3E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,aAAa;SACrB;KACF;IACD;QACE,MAAM,EAAE;YACN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,KAAK;SACb;KACF;CACF,CAAC;AAbW,QAAA,cAAc,kBAazB;AAEW,QAAA,YAAY,GAA+B;IACtD,EAAE,QAAQ,EAAE,yBAAgB,CAAC,QAAQ,EAAE;CACxC,CAAC"}
1
+ {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/filters.ts"],"names":[],"mappings":";;;AACA,qCAA8D;AAEvD,MAAM,cAAc,GAAG,CAAC,KAAa,EAA8B,EAAE,CAAC;IAC3E;QACE,MAAM,EAAE;YACN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,aAAa;SACrB;KACF;IACD;QACE,MAAM,EAAE;YACN,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,KAAK;SACb;KACF;CACF,CAAC;AAbW,QAAA,cAAc,kBAazB;AAEW,QAAA,YAAY,GAA+B;IACtD,EAAE,QAAQ,EAAE,yBAAgB,CAAC,QAAQ,EAAE;CACxC,CAAC;AAEW,QAAA,kBAAkB,GAA+B;IAC5D,EAAE,QAAQ,EAAE,yBAAgB,CAAC,QAAQ,EAAE;CACxC,CAAC"}
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.airdropFetcher = exports.fetchers = exports.jobs = exports.platforms = void 0;
7
7
  const constants_1 = require("./constants");
8
8
  const spotMarketsJob_1 = __importDefault(require("./spotMarketsJob"));
9
+ const prepMarketsJob_1 = __importDefault(require("./prepMarketsJob"));
9
10
  const depositsFetcher_1 = __importDefault(require("./depositsFetcher"));
10
11
  const premarketJob_1 = __importDefault(require("./premarketJob"));
11
12
  const airdropFetcher_1 = __importDefault(require("./airdropFetcher"));
12
13
  exports.platforms = [constants_1.platform];
13
- exports.jobs = [spotMarketsJob_1.default, premarketJob_1.default];
14
+ exports.jobs = [spotMarketsJob_1.default, premarketJob_1.default, prepMarketsJob_1.default];
14
15
  exports.fetchers = [depositsFetcher_1.default, airdropFetcher_1.default];
15
16
  var helpersAirdrop_1 = require("./helpersAirdrop");
16
17
  Object.defineProperty(exports, "airdropFetcher", { enumerable: true, get: function () { return helpersAirdrop_1.airdropFetcher; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAC9C,wEAAgD;AAChD,kEAA0C;AAC1C,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,wBAAc,EAAE,sBAAY,CAAC,CAAC;AAC7C,QAAA,QAAQ,GAAc,CAAC,yBAAe,EAAE,wBAAc,CAAC,CAAC;AACrE,mDAAkD;AAAzC,gHAAA,cAAc,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/drift/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,sEAA8C;AAC9C,sEAA8C;AAC9C,wEAAgD;AAChD,kEAA0C;AAC1C,sEAA8C;AAEjC,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,wBAAc,EAAE,sBAAY,EAAE,wBAAc,CAAC,CAAC;AAC7D,QAAA,QAAQ,GAAc,CAAC,yBAAe,EAAE,wBAAc,CAAC,CAAC;AACrE,mDAAkD;AAAzC,gHAAA,cAAc,OAAA"}
@@ -0,0 +1,74 @@
1
+ import BN from 'bn.js';
2
+ import { AMM, PerpMarket } from '../struct';
3
+ import { AssetType, OraclePriceData, PositionDirection, SwapDirection } from './types';
4
+ export declare function calculateUpdatedAMMSpreadReserves(amm: AMM, direction: PositionDirection, oraclePriceData: OraclePriceData): {
5
+ baseAssetReserve: BN;
6
+ quoteAssetReserve: BN;
7
+ sqrtK: BN;
8
+ newPeg: BN;
9
+ };
10
+ export declare function calculateUpdatedAMM(amm: AMM, oraclePriceData: OraclePriceData): AMM;
11
+ export declare function calculateOptimalPegAndBudget(amm: AMM, oraclePriceData: OraclePriceData): [BN, BN, BN, boolean];
12
+ export declare function calculateSpreadReserves(amm: AMM, oraclePriceData: OraclePriceData, now?: BN): {
13
+ baseAssetReserve: BN;
14
+ quoteAssetReserve: BN;
15
+ }[];
16
+ /**
17
+ * Helper function calculating constant product curve output. Agnostic to whether input asset is quote or base
18
+ *
19
+ * @param inputAssetReserve
20
+ * @param swapAmount
21
+ * @param swapDirection
22
+ * @param invariant
23
+ * @returns newInputAssetReserve and newOutputAssetReserve after swap. : Precision AMM_RESERVE_PRECISION
24
+ */
25
+ export declare function calculateSwapOutput(inputAssetReserve: BN, swapAmount: BN, swapDirection: SwapDirection, invariant: BN): [BN, BN];
26
+ /**
27
+ * Translate long/shorting quote/base asset into amm operation
28
+ *
29
+ * @param inputAssetType
30
+ * @param positionDirection
31
+ */
32
+ export declare function getSwapDirection(inputAssetType: AssetType, positionDirection: PositionDirection): SwapDirection;
33
+ /**
34
+ * Helper function calculating terminal price of amm
35
+ *
36
+ * @param market
37
+ * @returns cost : Precision PRICE_PRECISION
38
+ */
39
+ export declare function calculateTerminalPrice(market: PerpMarket): BN;
40
+ export declare function calculateMaxBaseAssetAmountToTrade(amm: AMM, limit_price: BN, direction: PositionDirection, oraclePriceData: OraclePriceData, now?: BN): [BN, PositionDirection];
41
+ export declare function calculateQuoteAssetAmountSwapped(quoteAssetReserves: BN, pegMultiplier: BN, swapDirection: SwapDirection): BN;
42
+ export declare function calculateMaxBaseAssetAmountFillable(amm: AMM, orderDirection: PositionDirection): BN;
43
+ export declare function calculateAmmReservesAfterSwap(amm: Pick<AMM, 'pegMultiplier' | 'quoteAssetReserve' | 'sqrtK' | 'baseAssetReserve'>, inputAssetType: AssetType, swapAmount: BN, swapDirection: SwapDirection): [BN, BN];
44
+ export declare function calculateSpreadBN(baseSpread: number, lastOracleReservePriceSpreadPct: BN, lastOracleConfPct: BN, maxSpread: number, quoteAssetReserve: BN, terminalQuoteAssetReserve: BN, pegMultiplier: BN, baseAssetAmountWithAmm: BN, reservePrice: BN, totalFeeMinusDistributions: BN, netRevenueSinceLastFunding: BN, baseAssetReserve: BN, minBaseAssetReserve: BN, maxBaseAssetReserve: BN, markStd: BN, oracleStd: BN, longIntensity: BN, shortIntensity: BN, volume24H: BN, returnTerms?: boolean): number[] | {
45
+ longVolSpread: number;
46
+ shortVolSpread: number;
47
+ longSpreadwPS: number;
48
+ shortSpreadwPS: number;
49
+ maxTargetSpread: number;
50
+ inventorySpreadScale: number;
51
+ longSpreadwInvScale: number;
52
+ shortSpreadwInvScale: number;
53
+ effectiveLeverage: number;
54
+ effectiveLeverageCapped: number;
55
+ longSpreadwEL: number;
56
+ shortSpreadwEL: number;
57
+ revenueRetreatAmount: number;
58
+ halfRevenueRetreatAmount: number;
59
+ longSpreadwRevRetreat: number;
60
+ shortSpreadwRevRetreat: number;
61
+ longSpreadwOffsetShrink: number;
62
+ shortSpreadwOffsetShrink: number;
63
+ totalSpread: number;
64
+ longSpread: number;
65
+ shortSpread: number;
66
+ };
67
+ export declare function calculateSpread(amm: AMM, oraclePriceData: OraclePriceData, now?: BN, reservePrice?: BN): [number, number];
68
+ export declare function calculateVolSpreadBN(lastOracleConfPct: BN, reservePrice: BN, markStd: BN, oracleStd: BN, longIntensity: BN, shortIntensity: BN, volume24H: BN): [BN, BN];
69
+ export declare function calculatePrice(baseAssetReserves: BN, quoteAssetReserves: BN, pegMultiplier: BN): BN;
70
+ export declare function calculateEffectiveLeverage(baseSpread: number, quoteAssetReserve: BN, terminalQuoteAssetReserve: BN, pegMultiplier: BN, netBaseAssetAmount: BN, reservePrice: BN, totalFeeMinusDistributions: BN): number;
71
+ export declare function calculateInventoryScale(baseAssetAmountWithAmm: BN, baseAssetReserve: BN, minBaseAssetReserve: BN, maxBaseAssetReserve: BN, directionalSpread: number, maxSpread: number): number;
72
+ export declare function calculateInventoryLiquidityRatio(baseAssetAmountWithAmm: BN, baseAssetReserve: BN, minBaseAssetReserve: BN, maxBaseAssetReserve: BN): BN;
73
+ export declare function calculateMarketOpenBidAsk(baseAssetReserve: BN, minBaseAssetReserve: BN, maxBaseAssetReserve: BN, stepSize?: BN): [BN, BN];
74
+ export declare function calculateReferencePriceOffset(reservePrice: BN, last24hAvgFundingRate: BN, liquidityFraction: BN, oracleTwapFast: BN, markTwapFast: BN, oracleTwapSlow: BN, markTwapSlow: BN, maxOffsetPct: number): BN;