@typus/typus-perp-sdk 1.0.82 → 1.0.83
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.d.ts
CHANGED
|
@@ -32,4 +32,4 @@ export declare function getTlpPriceFromSentio(fromTimestamp?: number, toTimestam
|
|
|
32
32
|
value: number;
|
|
33
33
|
}[]>;
|
|
34
34
|
export declare function getUserPnlFromSentio(startTimestamp: number, endTimestamp: number, userAddress?: string): Promise<any[]>;
|
|
35
|
-
export declare function getLeaderboardFromSentio(
|
|
35
|
+
export declare function getLeaderboardFromSentio(startTs: number, endTs: number): Promise<any[]>;
|
package/dist/src/api/sentio.js
CHANGED
|
@@ -523,17 +523,18 @@ function getUserPnlFromSentio(startTimestamp, endTimestamp, userAddress) {
|
|
|
523
523
|
});
|
|
524
524
|
});
|
|
525
525
|
}
|
|
526
|
-
function getLeaderboardFromSentio(
|
|
526
|
+
function getLeaderboardFromSentio(startTs, endTs) {
|
|
527
527
|
return __awaiter(this, void 0, void 0, function () {
|
|
528
|
-
var apiUrl, requestData, jsonData, response, data;
|
|
528
|
+
var apiUrl, size, requestData, jsonData, response, data;
|
|
529
529
|
return __generator(this, function (_a) {
|
|
530
530
|
switch (_a.label) {
|
|
531
531
|
case 0:
|
|
532
532
|
apiUrl = "https://app.sentio.xyz/api/v1/analytics/typus/typus_perp_mainnet/sql/execute";
|
|
533
|
+
size = (10 * (endTs - startTs)) / 60 / 60 / 24;
|
|
533
534
|
requestData = {
|
|
534
535
|
version: 25,
|
|
535
536
|
sqlQuery: {
|
|
536
|
-
sql: "\n WITH\n event AS (\n SELECT\n timestamp,\n toDate(timestamp - INTERVAL 3 HOUR) AS logical_date,\n toDate(timestamp - INTERVAL 3 HOUR) AS date,\n filled_price * filled_size AS volume,\n distinct_id\n FROM OrderFilled\n ),\n sum_vol AS (\n SELECT\n logical_date,\n distinct_id,\n sum(volume) AS total_volume\n FROM event\n GROUP BY logical_date, distinct_id\n ),\n ranked AS (\n SELECT\n *,\n row_number() OVER (PARTITION BY logical_date ORDER BY total_volume DESC) AS rk\n FROM sum_vol\n ),\n top10 AS (\n SELECT *\n FROM ranked\n WHERE rk <= 10\n ),\n top10_sum AS (\n SELECT\n logical_date,\n sum(total_volume) AS top10_total_volume\n FROM top10\n GROUP BY logical_date\n )\n SELECT\n toDateTime(logical_date + INTERVAL 3 HOUR) AS Date,\n t.distinct_id as Address,\n t.total_volume as Trading_Vol,\n cast(t.total_volume AS Decimal256(18)) / cast(s.top10_total_volume AS Decimal256(18)) AS Volume_Share_Top10,\n Volume_Share_Top10 * 150 as PrizePool_Share\n FROM top10 t\n JOIN top10_sum s ON t.logical_date = s.logical_date\n ORDER BY\n Date DESC,\n t.rk ASC,\n Volume_Share_Top10\n\n ",
|
|
537
|
+
sql: "\n WITH\n event AS (\n SELECT\n timestamp,\n toDate(timestamp - INTERVAL 3 HOUR) AS logical_date,\n toDate(timestamp - INTERVAL 3 HOUR) AS date,\n filled_price * filled_size AS volume,\n distinct_id\n FROM OrderFilled\n ),\n sum_vol AS (\n SELECT\n logical_date,\n distinct_id,\n sum(volume) AS total_volume\n FROM event\n GROUP BY logical_date, distinct_id\n ),\n ranked AS (\n SELECT\n *,\n row_number() OVER (PARTITION BY logical_date ORDER BY total_volume DESC) AS rk\n FROM sum_vol\n ),\n top10 AS (\n SELECT *\n FROM ranked\n WHERE rk <= 10\n ),\n top10_sum AS (\n SELECT\n logical_date,\n sum(total_volume) AS top10_total_volume\n FROM top10\n GROUP BY logical_date\n )\n SELECT\n toDateTime(logical_date + INTERVAL 3 HOUR) AS Date,\n t.distinct_id as Address,\n t.total_volume as Trading_Vol,\n cast(t.total_volume AS Decimal256(18)) / cast(s.top10_total_volume AS Decimal256(18)) AS Volume_Share_Top10,\n Volume_Share_Top10 * 150 as PrizePool_Share\n FROM top10 t\n JOIN top10_sum s ON t.logical_date = s.logical_date\n WHERE Date >= ".concat(startTs, " AND Date < ").concat(endTs, "\n ORDER BY\n Date DESC,\n t.rk ASC,\n Volume_Share_Top10\n\n "),
|
|
537
538
|
size: size,
|
|
538
539
|
},
|
|
539
540
|
};
|
|
@@ -568,4 +569,4 @@ function getLeaderboardFromSentio(size) {
|
|
|
568
569
|
// getTlpFeeFromSentio(0).then((x) => console.log(x));
|
|
569
570
|
// getUserPnlFromSentio(parseTimestamp("2025-06-24 11:00:00"), parseTimestamp("2025-07-08 11:00:00")).then((x) => console.log(x));
|
|
570
571
|
// getMinuteTradingVolumeFromSentio("SUI", 30, 10).then((x) => console.log(x));
|
|
571
|
-
// getLeaderboardFromSentio(
|
|
572
|
+
// getLeaderboardFromSentio(1753142400, 1753401600).then((x) => console.log(x, x.length));
|