@sonarwatch/portfolio-plugins 0.12.25 → 0.12.27
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/plugins/bluefin/positionFetcher.js +6 -1
- package/src/plugins/bluefin/positionFetcher.js.map +1 -1
- package/src/plugins/jupiter/exchange/perpetualFetcher.js +42 -81
- package/src/plugins/jupiter/exchange/perpetualFetcher.js.map +1 -1
- package/src/utils/name-service/nameServices.js +2 -0
- package/src/utils/name-service/nameServices.js.map +1 -1
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,14 @@
|
|
2
2
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
4
4
|
|
5
|
+
## [0.12.27](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.26...plugins-0.12.27) (2024-06-14)
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
## [0.12.26](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.25...plugins-0.12.26) (2024-06-13)
|
10
|
+
|
11
|
+
|
12
|
+
|
5
13
|
## [0.12.25](https://github.com/sonarwatch/portfolio/compare/plugins-0.12.24...plugins-0.12.25) (2024-06-13)
|
6
14
|
|
7
15
|
|
package/package.json
CHANGED
@@ -107,7 +107,12 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
107
107
|
borrowedAssets.length === 0 &&
|
108
108
|
rewardAssets.length === 0)
|
109
109
|
return;
|
110
|
-
const value =
|
110
|
+
const value = margin
|
111
|
+
.dividedBy(Math.pow(10, 9))
|
112
|
+
.plus(pnl)
|
113
|
+
.toNumber();
|
114
|
+
if (value === 0)
|
115
|
+
return;
|
111
116
|
const side = ((_3 = (_2 = (_1 = (_0 = position.data) === null || _0 === void 0 ? void 0 : _0.content) === null || _1 === void 0 ? void 0 : _1.fields) === null || _2 === void 0 ? void 0 : _2.value) === null || _3 === void 0 ? void 0 : _3.fields.isPosPositive)
|
112
117
|
? 'Long'
|
113
118
|
: 'Short';
|
@@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,WAAW;IAC5B,SAAS,EAAE,0BAAS,CAAC,GAAG;IACxB,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -47,23 +47,18 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
47
47
|
const tokensDetailsById = new Map();
|
48
48
|
const tokensDetails = yield cache.getItems(custodiesAccounts.map((acc) => acc.mint), { prefix: constants_1.tokenListsDetailsPrefix, networkId: portfolio_core_1.NetworkId.solana });
|
49
49
|
tokensDetails.forEach((tD) => tD ? tokensDetailsById.set(tD.address, tD) : undefined);
|
50
|
-
const
|
50
|
+
const positions = [];
|
51
51
|
for (const position of perpetualsPositions) {
|
52
|
-
|
52
|
+
const { collateralUsd, sizeUsd, price, side } = position;
|
53
|
+
if (sizeUsd.isLessThanOrEqualTo(0))
|
53
54
|
continue;
|
54
|
-
if (
|
55
|
+
if (side === structs_1.Side.None)
|
55
56
|
continue;
|
56
|
-
const isLong =
|
57
|
+
const isLong = side === structs_1.Side.Long;
|
57
58
|
const custody = custodyById.get(position.custody.toString());
|
58
59
|
const collateralCustody = custodyById.get(position.collateralCustody.toString());
|
59
60
|
if (!custody || !collateralCustody)
|
60
61
|
continue;
|
61
|
-
const borrowedAssets = [];
|
62
|
-
const borrowedYields = [];
|
63
|
-
const suppliedAssets = [];
|
64
|
-
const suppliedYields = [];
|
65
|
-
const rewardAssets = [];
|
66
|
-
const { collateralUsd, sizeUsd, price, cumulativeInterestSnapshot } = position;
|
67
62
|
const openingPrice = price.dividedBy(usdFactor);
|
68
63
|
const custodyPriceData = pythPricesByAccount.get(custody.oracle.oracleAccount);
|
69
64
|
const collateralCustodyPriceData = pythPricesByAccount.get(collateralCustody.oracle.oracleAccount);
|
@@ -74,89 +69,55 @@ const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* (
|
|
74
69
|
continue;
|
75
70
|
const currentPrice = new bignumber_js_1.default(custodyPriceData.price);
|
76
71
|
const leverage = sizeUsd.dividedBy(collateralUsd);
|
77
|
-
const
|
78
|
-
|
79
|
-
|
80
|
-
.dividedBy(collateralCustodyPriceData.price)
|
81
|
-
.dividedBy(usdFactor);
|
72
|
+
// const collatAmount = collateralUsd
|
73
|
+
// .dividedBy(collateralCustodyPriceData.price)
|
74
|
+
// .dividedBy(usdFactor);
|
82
75
|
const collatValue = collateralUsd.dividedBy(usdFactor).toNumber();
|
83
|
-
const custodyAmount = collatAmount.times(leverage);
|
84
|
-
const custodyValue = sizeUsd.dividedBy(usdFactor).toNumber();
|
85
|
-
const borrowFee = sizeUsd
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
76
|
+
// const custodyAmount = collatAmount.times(leverage);
|
77
|
+
// const custodyValue = sizeUsd.dividedBy(usdFactor).toNumber();
|
78
|
+
// const borrowFee = sizeUsd
|
79
|
+
// .times(
|
80
|
+
// new BigNumber(
|
81
|
+
// collateralCustody.fundingRateState.cumulativeInterestRate
|
82
|
+
// ).minus(cumulativeInterestSnapshot)
|
83
|
+
// )
|
84
|
+
// .dividedBy(10 ** 15)
|
85
|
+
// .absoluteValue();
|
86
|
+
// const openAndCloseFees = sizeUsd.times(0.001).times(2).dividedBy(usdFactor);
|
87
|
+
// const fees = borrowFee.plus(openAndCloseFees).negated().toNumber();
|
91
88
|
const priceDelta = isLong
|
92
89
|
? currentPrice.minus(openingPrice)
|
93
90
|
: openingPrice.minus(currentPrice);
|
94
91
|
const priceVar = priceDelta.dividedBy(openingPrice);
|
95
92
|
const pnl = priceVar.times(collatValue).times(leverage).toNumber();
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
},
|
93
|
+
// const value = collateralUsd.dividedBy(usdFactor).plus(pnl).toNumber();
|
94
|
+
positions.push({
|
95
|
+
collateralValue: collateralUsd.dividedBy(usdFactor).toNumber(),
|
96
|
+
liquidationPrice: null,
|
97
|
+
sizeValue: sizeUsd.toNumber(),
|
98
|
+
value: collateralUsd.dividedBy(usdFactor).plus(pnl).toNumber(),
|
99
|
+
side: isLong ? portfolio_core_1.LeverageSide.long : portfolio_core_1.LeverageSide.short,
|
100
|
+
address: custody.mint,
|
101
|
+
leverage: leverage.toNumber(),
|
106
102
|
});
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
103
|
+
}
|
104
|
+
if (positions.length === 0)
|
105
|
+
return [];
|
106
|
+
const value = (0, portfolio_core_1.getUsdValueSum)(positions.map((a) => a.value));
|
107
|
+
return [
|
108
|
+
{
|
109
|
+
type: portfolio_core_1.PortfolioElementType.leverage,
|
112
110
|
data: {
|
113
|
-
|
114
|
-
|
115
|
-
|
111
|
+
positions,
|
112
|
+
value,
|
113
|
+
collateralAssets: [],
|
116
114
|
},
|
117
|
-
|
118
|
-
rewardAssets.push({
|
119
|
-
type: 'generic',
|
120
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
121
|
-
value: pnl,
|
122
|
-
attributes: {},
|
123
|
-
data: { name: 'PNL ($)', amount: pnl, price: null },
|
124
|
-
});
|
125
|
-
rewardAssets.push({
|
126
|
-
type: 'generic',
|
127
|
-
networkId: portfolio_core_1.NetworkId.solana,
|
128
|
-
value: fees,
|
129
|
-
attributes: {},
|
130
|
-
data: { name: 'Fees O/C ($)', amount: fees, price: null },
|
131
|
-
});
|
132
|
-
if (suppliedAssets.length === 0 && borrowedAssets.length === 0)
|
133
|
-
continue;
|
134
|
-
const { borrowedValue, suppliedValue, healthRatio, rewardValue } = (0, portfolio_core_1.getElementLendingValues)(suppliedAssets, borrowedAssets, rewardAssets);
|
135
|
-
const value = collateralUsd.dividedBy(usdFactor).plus(pnl).toNumber();
|
136
|
-
const side = isLong ? 'Long' : 'Short';
|
137
|
-
elements.push({
|
138
|
-
type: portfolio_core_1.PortfolioElementType.borrowlend,
|
115
|
+
label: 'Leverage',
|
139
116
|
networkId: portfolio_core_1.NetworkId.solana,
|
140
117
|
platformId: constants_2.platformId,
|
141
|
-
label: 'Leverage',
|
142
118
|
value,
|
143
|
-
|
144
|
-
|
145
|
-
borrowedAssets,
|
146
|
-
borrowedValue,
|
147
|
-
borrowedYields,
|
148
|
-
suppliedAssets,
|
149
|
-
suppliedValue,
|
150
|
-
suppliedYields,
|
151
|
-
collateralRatio: null,
|
152
|
-
rewardAssets,
|
153
|
-
rewardValue,
|
154
|
-
healthRatio,
|
155
|
-
value,
|
156
|
-
},
|
157
|
-
});
|
158
|
-
}
|
159
|
-
return elements;
|
119
|
+
},
|
120
|
+
];
|
160
121
|
});
|
161
122
|
const fetcher = {
|
162
123
|
id: `${constants_2.platformId}-perpetual`,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"perpetualFetcher.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/jupiter/exchange/perpetualFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,oDAAyD;AACzD,kDAAiE;AACjE,wCAAuD;AAEvD,mGAAgG;AAChG,gEAA2E;AAC3E,sDAAiE;AACjE,2CAAuE;AACvE,uCAAiD;AAEjD,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,CAAC,CAAA,CAAC,CAAC;AACzC,MAAM,QAAQ,GAAoB,
|
1
|
+
{"version":3,"file":"perpetualFetcher.js","sourceRoot":"","sources":["../../../../../../../packages/plugins/src/plugins/jupiter/exchange/perpetualFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAQoC;AACpC,gEAAqC;AACrC,6CAA4C;AAG5C,oDAAyD;AACzD,kDAAiE;AACjE,wCAAuD;AAEvD,mGAAgG;AAChG,gEAA2E;AAC3E,sDAAiE;AACjE,2CAAuE;AACvE,uCAAiD;AAEjD,MAAM,SAAS,GAAG,IAAI,sBAAS,CAAC,SAAA,EAAE,EAAI,CAAC,CAAA,CAAC,CAAC;AACzC,MAAM,QAAQ,GAA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C,CAAC,CAAC,6BAAY,CAAC,KAAK;YACrD,OAAO,EAAE,OAAO,CAAC,IAAI;YACrB,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE;SAC9B,CAAC,CAAC;IACL,CAAC;IAED,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACtC,MAAM,KAAK,GAAG,IAAA,+BAAc,EAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5D,OAAO;QACL;YACE,IAAI,EAAE,qCAAoB,CAAC,QAAQ;YACnC,IAAI,EAAE;gBACJ,SAAS;gBACT,KAAK;gBACL,gBAAgB,EAAE,EAAE;aACrB;YACD,KAAK,EAAE,UAAU;YACjB,SAAS,EAAE,0BAAS,CAAC,MAAM;YAC3B,UAAU,EAAV,sBAAU;YACV,KAAK;SACN;KACF,CAAC;AACJ,CAAC,CAAA,CAAC;AAEF,MAAM,OAAO,GAAY;IACvB,EAAE,EAAE,GAAG,sBAAU,YAAY;IAC7B,SAAS,EAAE,0BAAS,CAAC,MAAM;IAC3B,QAAQ;CACT,CAAC;AAEF,kBAAe,OAAO,CAAC"}
|
@@ -5,12 +5,14 @@ const bonfida_1 = require("./services/bonfida");
|
|
5
5
|
const avalanche_1 = require("./services/avalanche");
|
6
6
|
const ens_1 = require("./services/ens");
|
7
7
|
const sui_1 = require("./services/sui");
|
8
|
+
const aptos_1 = require("./services/aptos");
|
8
9
|
const allDomains_1 = require("./services/allDomains");
|
9
10
|
exports.nameServices = [
|
10
11
|
bonfida_1.nameService,
|
11
12
|
avalanche_1.nameService,
|
12
13
|
ens_1.nameService,
|
13
14
|
sui_1.nameService,
|
15
|
+
aptos_1.nameService,
|
14
16
|
// Please leave allDomainsNameService at the end.
|
15
17
|
allDomains_1.nameService,
|
16
18
|
];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nameServices.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/name-service/nameServices.ts"],"names":[],"mappings":";;;AACA,gDAAuE;AACvE,oDAA2E;AAC3E,wCAA+D;AAC/D,wCAA+D;AAC/D,sDAA6E;AAEhE,QAAA,YAAY,GAAkB;IACzC,qBAAkB;IAClB,uBAAoB;IACpB,iBAAc;IACd,iBAAc;IACd,iDAAiD;IACjD,wBAAqB;CACtB,CAAC"}
|
1
|
+
{"version":3,"file":"nameServices.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/utils/name-service/nameServices.ts"],"names":[],"mappings":";;;AACA,gDAAuE;AACvE,oDAA2E;AAC3E,wCAA+D;AAC/D,wCAA+D;AAC/D,4CAAmE;AACnE,sDAA6E;AAEhE,QAAA,YAAY,GAAkB;IACzC,qBAAkB;IAClB,uBAAoB;IACpB,iBAAc;IACd,iBAAc;IACd,mBAAgB;IAChB,iDAAiD;IACjD,wBAAqB;CACtB,CAAC"}
|