@typus/typus-perp-sdk 1.0.68 → 1.0.70
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/dist/src/api/sentio.js +12 -9
- package/package.json +1 -1
package/dist/src/api/sentio.js
CHANGED
|
@@ -104,7 +104,7 @@ function getTradingVolumeFromSentio(fromTimestamp, interval, toTimestamp) {
|
|
|
104
104
|
requestData = {
|
|
105
105
|
timeRange: {
|
|
106
106
|
start: "".concat(fromTimestamp),
|
|
107
|
-
end: "".concat(toTimestamp !== null && toTimestamp !== void 0 ? toTimestamp :
|
|
107
|
+
end: "".concat(toTimestamp !== null && toTimestamp !== void 0 ? toTimestamp : now()),
|
|
108
108
|
step: 3600 * interval,
|
|
109
109
|
},
|
|
110
110
|
limit: 30 * 24,
|
|
@@ -170,6 +170,9 @@ function getTradingVolumeFromSentio(fromTimestamp, interval, toTimestamp) {
|
|
|
170
170
|
});
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
+
function now() {
|
|
174
|
+
return Math.round(Date.now() / 1000);
|
|
175
|
+
}
|
|
173
176
|
function getTlpFeeFromSentio(fromTimestamp, toTimestamp) {
|
|
174
177
|
return __awaiter(this, void 0, void 0, function () {
|
|
175
178
|
var apiUrl, requestData, jsonData, response, data, first, last, fee;
|
|
@@ -180,7 +183,7 @@ function getTlpFeeFromSentio(fromTimestamp, toTimestamp) {
|
|
|
180
183
|
requestData = {
|
|
181
184
|
timeRange: {
|
|
182
185
|
start: "".concat(fromTimestamp),
|
|
183
|
-
end: "".concat(toTimestamp !== null && toTimestamp !== void 0 ? toTimestamp :
|
|
186
|
+
end: "".concat(toTimestamp !== null && toTimestamp !== void 0 ? toTimestamp : now()),
|
|
184
187
|
step: 3600,
|
|
185
188
|
},
|
|
186
189
|
limit: 20,
|
|
@@ -234,7 +237,7 @@ function getTotalVolumeFromSentio(fromTimestamp, toTimestamp) {
|
|
|
234
237
|
requestData = {
|
|
235
238
|
timeRange: {
|
|
236
239
|
start: "".concat(fromTimestamp),
|
|
237
|
-
end: "".concat(toTimestamp !== null && toTimestamp !== void 0 ? toTimestamp :
|
|
240
|
+
end: "".concat(toTimestamp !== null && toTimestamp !== void 0 ? toTimestamp : now()),
|
|
238
241
|
step: 3600,
|
|
239
242
|
},
|
|
240
243
|
limit: 1,
|
|
@@ -288,7 +291,7 @@ function getAccumulatedUser() {
|
|
|
288
291
|
requestData = {
|
|
289
292
|
timeRange: {
|
|
290
293
|
start: "now-1h",
|
|
291
|
-
end:
|
|
294
|
+
end: now(),
|
|
292
295
|
step: 3600,
|
|
293
296
|
timezone: "Asia/Taipei",
|
|
294
297
|
},
|
|
@@ -356,7 +359,7 @@ function getTlpPriceFromSentio(fromTimestamp, toTimestamp) {
|
|
|
356
359
|
requestData = {
|
|
357
360
|
timeRange: {
|
|
358
361
|
start: "".concat(fromTimestamp),
|
|
359
|
-
end: "".concat(toTimestamp !== null && toTimestamp !== void 0 ? toTimestamp :
|
|
362
|
+
end: "".concat(toTimestamp !== null && toTimestamp !== void 0 ? toTimestamp : now()),
|
|
360
363
|
step: 3600,
|
|
361
364
|
},
|
|
362
365
|
limit: 30 * 24,
|
|
@@ -391,7 +394,7 @@ function getTlpPriceFromSentio(fromTimestamp, toTimestamp) {
|
|
|
391
394
|
data = _a.sent();
|
|
392
395
|
samples = data.results[0].matrix.samples;
|
|
393
396
|
// console.log(samples[0].values);
|
|
394
|
-
return [2 /*return*/, samples];
|
|
397
|
+
return [2 /*return*/, samples[0].values];
|
|
395
398
|
}
|
|
396
399
|
});
|
|
397
400
|
});
|
|
@@ -399,6 +402,6 @@ function getTlpPriceFromSentio(fromTimestamp, toTimestamp) {
|
|
|
399
402
|
// getVolumeFromSentio();
|
|
400
403
|
// getAccumulatedUser();
|
|
401
404
|
// getTradingVolumeFromSentio(1747008000, 1, 1747011600);
|
|
402
|
-
//
|
|
403
|
-
//
|
|
404
|
-
// getTlpFeeFromSentio(
|
|
405
|
+
// getTlpPriceFromSentio(now() - 3600 * 24 * 30).then((x) => console.dir(x, { depth: null }));
|
|
406
|
+
// getTotalVolumeFromSentio(now() - 3600 * 24 * 30).then((x) => console.log(x));
|
|
407
|
+
// getTlpFeeFromSentio(now() - 3600 * 24 * 30).then((x) => console.log(x));
|