@pioneer-platform/markets 8.1.44 → 8.1.45
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/lib/index.js +17 -10
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -116,15 +116,16 @@ var build_balances = function (marketInfoCoinCap, marketInfoCoinGecko, pubkeys)
|
|
|
116
116
|
_a.label = 3;
|
|
117
117
|
case 3:
|
|
118
118
|
if (!!marketInfoCoinGecko) return [3 /*break*/, 5];
|
|
119
|
-
return [4 /*yield*/, get_assets_coingecko()
|
|
119
|
+
return [4 /*yield*/, get_assets_coingecko()
|
|
120
|
+
// console.log(Object.keys(marketInfoCoinCap))
|
|
121
|
+
// console.log(Object.keys(marketInfoCoinGecko))
|
|
122
|
+
// console.log(Object.keys(marketInfoCoinCap).length)
|
|
123
|
+
// console.log(Object.keys(marketInfoCoinGecko).length)
|
|
124
|
+
];
|
|
120
125
|
case 4:
|
|
121
126
|
marketInfoCoinGecko = _a.sent();
|
|
122
127
|
_a.label = 5;
|
|
123
128
|
case 5:
|
|
124
|
-
console.log(Object.keys(marketInfoCoinCap));
|
|
125
|
-
console.log(Object.keys(marketInfoCoinGecko));
|
|
126
|
-
console.log(Object.keys(marketInfoCoinCap).length);
|
|
127
|
-
console.log(Object.keys(marketInfoCoinGecko).length);
|
|
128
129
|
valuesUsd = {};
|
|
129
130
|
totalValueUsd = 0;
|
|
130
131
|
outputBalances = [];
|
|
@@ -132,24 +133,30 @@ var build_balances = function (marketInfoCoinCap, marketInfoCoinGecko, pubkeys)
|
|
|
132
133
|
unPricedTokens = [];
|
|
133
134
|
for (i = 0; i < pubkeys.length; i++) {
|
|
134
135
|
entry = pubkeys[i];
|
|
135
|
-
console.log("entry: ", entry);
|
|
136
136
|
coincap = marketInfoCoinCap[entry.ticker];
|
|
137
137
|
coingecko = marketInfoCoinGecko[entry.ticker];
|
|
138
|
-
log.info("coincap: ",
|
|
139
|
-
log.info("coingecko: ",
|
|
138
|
+
// log.info("coincap: ",coincap)
|
|
139
|
+
// log.info("coingecko: ",coingecko)
|
|
140
140
|
if (!coincap && !coingecko) {
|
|
141
141
|
console.error("unknown token! ", entry.symbol);
|
|
142
142
|
unknownTokens.push(entry);
|
|
143
143
|
}
|
|
144
144
|
if (coincap && coincap.priceUsd) {
|
|
145
145
|
entry.priceUsd = coincap.priceUsd;
|
|
146
|
-
entry.
|
|
146
|
+
entry.rank = coincap.rank;
|
|
147
|
+
entry.name = coincap.name;
|
|
148
|
+
// entry.marketInfo = coincap
|
|
147
149
|
entry.marketInfo.source = "coincap";
|
|
148
150
|
}
|
|
149
151
|
//preference coinGecko as more accurate
|
|
150
152
|
if (coingecko && coingecko.current_price) {
|
|
153
|
+
entry.alias = [];
|
|
154
|
+
if (entry.name)
|
|
155
|
+
entry.alias.push(entry.name);
|
|
151
156
|
entry.priceUsd = coingecko.current_price;
|
|
152
|
-
entry.
|
|
157
|
+
entry.name = coingecko.id;
|
|
158
|
+
entry.alias = entry.alias.push(coingecko.name);
|
|
159
|
+
entry.rank = coingecko.market_cap_rank;
|
|
153
160
|
entry.marketInfo.source = "coingecko";
|
|
154
161
|
}
|
|
155
162
|
if (entry.priceUsd) {
|