@aicoin/opendata-mcp 1.0.17 → 1.0.19
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/build/index.js +231 -86
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -44,14 +44,11 @@ Endpoint: ${path}`;
|
|
|
44
44
|
}
|
|
45
45
|
throw new Error(msg);
|
|
46
46
|
}
|
|
47
|
+
var FREE_KEY = "ronJ8uI0Yj2soAfGVs5H1YALUIINbE22";
|
|
48
|
+
var FREE_SECRET = "CWHZcH2us1CLSE7grroR1TpS0Z1JxTwU";
|
|
47
49
|
function getCredentials() {
|
|
48
|
-
const key = process.env.AICOIN_ACCESS_KEY_ID;
|
|
49
|
-
const secret = process.env.AICOIN_ACCESS_SECRET;
|
|
50
|
-
if (!key || !secret) {
|
|
51
|
-
throw new Error(
|
|
52
|
-
"Missing AICOIN_ACCESS_KEY_ID or AICOIN_ACCESS_SECRET. Register at https://www.aicoin.com/opendata to get your API credentials."
|
|
53
|
-
);
|
|
54
|
-
}
|
|
50
|
+
const key = process.env.AICOIN_ACCESS_KEY_ID || FREE_KEY;
|
|
51
|
+
const secret = process.env.AICOIN_ACCESS_SECRET || FREE_SECRET;
|
|
55
52
|
return { key, secret };
|
|
56
53
|
}
|
|
57
54
|
async function apiGet(path, params = {}) {
|
|
@@ -376,7 +373,9 @@ function registerCoinTools(server2) {
|
|
|
376
373
|
"Get aggregated stablecoin-margined open interest history",
|
|
377
374
|
{
|
|
378
375
|
symbol: z2.string().describe("Coin symbol, e.g. BTC"),
|
|
379
|
-
interval: z2.string().describe(
|
|
376
|
+
interval: z2.string().describe(
|
|
377
|
+
"Interval: 1m,3m,5m,15m,30m,1h,4h,6h,8h,12h,1d,1w"
|
|
378
|
+
),
|
|
380
379
|
limit: z2.string().optional().describe("Number of records, default 100"),
|
|
381
380
|
start_time: z2.string().optional().describe("Start time in ms"),
|
|
382
381
|
end_time: z2.string().optional().describe("End time in ms")
|
|
@@ -406,7 +405,9 @@ function registerCoinTools(server2) {
|
|
|
406
405
|
"Get aggregated coin-margined open interest history",
|
|
407
406
|
{
|
|
408
407
|
symbol: z2.string().describe("Coin symbol, e.g. BTC"),
|
|
409
|
-
interval: z2.string().describe(
|
|
408
|
+
interval: z2.string().describe(
|
|
409
|
+
"Interval: 1m,3m,5m,15m,30m,1h,4h,6h,8h,12h,1d,1w"
|
|
410
|
+
),
|
|
410
411
|
limit: z2.string().optional().describe("Number of records, default 100"),
|
|
411
412
|
start_time: z2.string().optional().describe("Start time in ms"),
|
|
412
413
|
end_time: z2.string().optional().describe("End time in ms")
|
|
@@ -796,14 +797,23 @@ function registerMarketTools(server2) {
|
|
|
796
797
|
"get_futures_interest",
|
|
797
798
|
"Get futures open interest data",
|
|
798
799
|
{
|
|
799
|
-
|
|
800
|
-
|
|
800
|
+
lan: z4.string().optional().describe("Language: cn or en"),
|
|
801
|
+
page: z4.string().optional().describe("Page number"),
|
|
802
|
+
pageSize: z4.string().optional().describe("Page size, max 20"),
|
|
803
|
+
currency: z4.string().optional().describe("Currency: cny or usd")
|
|
801
804
|
},
|
|
802
|
-
async ({
|
|
805
|
+
async ({ lan, page, pageSize, currency }) => {
|
|
803
806
|
try {
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
+
const params = {};
|
|
808
|
+
if (lan) params.lan = lan;
|
|
809
|
+
if (page) params.page = page;
|
|
810
|
+
if (pageSize) params.pageSize = pageSize;
|
|
811
|
+
if (currency) params.currency = currency;
|
|
812
|
+
return ok(
|
|
813
|
+
await apiGet(
|
|
814
|
+
"/api/v2/futures/interest",
|
|
815
|
+
params
|
|
816
|
+
)
|
|
807
817
|
);
|
|
808
818
|
} catch (e) {
|
|
809
819
|
return err(e);
|
|
@@ -1037,12 +1047,37 @@ function registerMarketTools(server2) {
|
|
|
1037
1047
|
coin: z4.string().describe("Coin ticker, e.g. BTC, ETH"),
|
|
1038
1048
|
entity_type: z4.string().optional().describe(
|
|
1039
1049
|
"Entity type: public-companies, eth-treasuries, etc."
|
|
1040
|
-
)
|
|
1050
|
+
),
|
|
1051
|
+
name: z4.string().optional().describe("Entity name fuzzy search"),
|
|
1052
|
+
ticker: z4.string().optional().describe("Stock ticker filter"),
|
|
1053
|
+
start_date: z4.string().optional().describe("Start date, ISO 8601"),
|
|
1054
|
+
end_date: z4.string().optional().describe("End date, ISO 8601"),
|
|
1055
|
+
page: z4.string().optional().describe("Page number, default 1"),
|
|
1056
|
+
page_size: z4.string().optional().describe("Page size, default 20, max 100"),
|
|
1057
|
+
sort_order: z4.string().optional().describe("Sort: asc or desc, default desc")
|
|
1041
1058
|
},
|
|
1042
|
-
async ({
|
|
1059
|
+
async ({
|
|
1060
|
+
coin,
|
|
1061
|
+
entity_type,
|
|
1062
|
+
name,
|
|
1063
|
+
ticker,
|
|
1064
|
+
start_date,
|
|
1065
|
+
end_date,
|
|
1066
|
+
page,
|
|
1067
|
+
page_size,
|
|
1068
|
+
sort_order
|
|
1069
|
+
}) => {
|
|
1043
1070
|
try {
|
|
1044
1071
|
const body = { coin };
|
|
1045
1072
|
if (entity_type) body.entity_type = entity_type;
|
|
1073
|
+
if (name) body.name = name;
|
|
1074
|
+
if (ticker) body.ticker = ticker;
|
|
1075
|
+
if (start_date) body.start_date = start_date;
|
|
1076
|
+
if (end_date) body.end_date = end_date;
|
|
1077
|
+
if (page) body.page = Number(page);
|
|
1078
|
+
if (page_size)
|
|
1079
|
+
body.page_size = Number(page_size);
|
|
1080
|
+
if (sort_order) body.sort_order = sort_order;
|
|
1046
1081
|
return ok(
|
|
1047
1082
|
await apiPost(
|
|
1048
1083
|
"/api/upgrade/v2/coin-treasuries/entities",
|
|
@@ -1059,19 +1094,42 @@ function registerMarketTools(server2) {
|
|
|
1059
1094
|
"Get coin treasury historical data",
|
|
1060
1095
|
{
|
|
1061
1096
|
coin: z4.string().describe("Coin ticker, e.g. BTC, ETH"),
|
|
1062
|
-
|
|
1063
|
-
|
|
1097
|
+
name: z4.string().optional().describe("Entity name filter"),
|
|
1098
|
+
type: z4.string().optional().describe("Trade type: Buy or Sell"),
|
|
1099
|
+
start_date: z4.string().optional().describe("Start date, ISO 8601"),
|
|
1100
|
+
end_date: z4.string().optional().describe("End date, ISO 8601"),
|
|
1101
|
+
page: z4.string().optional().describe("Page number, default 1"),
|
|
1102
|
+
page_size: z4.string().optional().describe("Page size, default 20"),
|
|
1103
|
+
sort_by: z4.string().optional().describe("Sort field, default date"),
|
|
1104
|
+
sort_order: z4.string().optional().describe("Sort: asc or desc, default desc")
|
|
1064
1105
|
},
|
|
1065
|
-
async ({
|
|
1106
|
+
async ({
|
|
1107
|
+
coin,
|
|
1108
|
+
name,
|
|
1109
|
+
type,
|
|
1110
|
+
start_date,
|
|
1111
|
+
end_date,
|
|
1112
|
+
page,
|
|
1113
|
+
page_size,
|
|
1114
|
+
sort_by,
|
|
1115
|
+
sort_order
|
|
1116
|
+
}) => {
|
|
1066
1117
|
try {
|
|
1067
1118
|
const body = { coin };
|
|
1068
|
-
if (
|
|
1069
|
-
|
|
1119
|
+
if (name) body.name = name;
|
|
1120
|
+
if (type) body.type = type;
|
|
1121
|
+
if (start_date) body.start_date = start_date;
|
|
1122
|
+
if (end_date) body.end_date = end_date;
|
|
1123
|
+
if (page) body.page = Number(page);
|
|
1124
|
+
if (page_size)
|
|
1125
|
+
body.page_size = Number(page_size);
|
|
1126
|
+
if (sort_by) body.sort_by = sort_by;
|
|
1127
|
+
if (sort_order) body.sort_order = sort_order;
|
|
1128
|
+
return ok(
|
|
1070
1129
|
await apiPost(
|
|
1071
1130
|
"/api/upgrade/v2/coin-treasuries/history",
|
|
1072
1131
|
body
|
|
1073
|
-
)
|
|
1074
|
-
parseMax(_max_items, 100)
|
|
1132
|
+
)
|
|
1075
1133
|
);
|
|
1076
1134
|
} catch (e) {
|
|
1077
1135
|
return err(e);
|
|
@@ -1083,19 +1141,33 @@ function registerMarketTools(server2) {
|
|
|
1083
1141
|
"Get accumulated coin treasury historical data",
|
|
1084
1142
|
{
|
|
1085
1143
|
coin: z4.string().describe("Coin ticker, e.g. BTC, ETH"),
|
|
1086
|
-
|
|
1087
|
-
|
|
1144
|
+
entity_type: z4.string().optional().describe("Entity type filter"),
|
|
1145
|
+
start_date: z4.string().optional().describe("Start date, ISO 8601"),
|
|
1146
|
+
end_date: z4.string().optional().describe("End date, ISO 8601"),
|
|
1147
|
+
interval: z4.string().optional().describe(
|
|
1148
|
+
"Interval: daily, weekly, or monthly"
|
|
1149
|
+
)
|
|
1088
1150
|
},
|
|
1089
|
-
async ({
|
|
1151
|
+
async ({
|
|
1152
|
+
coin,
|
|
1153
|
+
entity_type,
|
|
1154
|
+
start_date,
|
|
1155
|
+
end_date,
|
|
1156
|
+
interval
|
|
1157
|
+
}) => {
|
|
1090
1158
|
try {
|
|
1091
1159
|
const body = { coin };
|
|
1092
|
-
if (
|
|
1093
|
-
|
|
1160
|
+
if (entity_type)
|
|
1161
|
+
body.entity_type = entity_type;
|
|
1162
|
+
if (start_date)
|
|
1163
|
+
body.start_date = start_date;
|
|
1164
|
+
if (end_date) body.end_date = end_date;
|
|
1165
|
+
if (interval) body.interval = interval;
|
|
1166
|
+
return ok(
|
|
1094
1167
|
await apiPost(
|
|
1095
1168
|
"/api/upgrade/v2/coin-treasuries/history/accumulated",
|
|
1096
1169
|
body
|
|
1097
|
-
)
|
|
1098
|
-
parseMax(_max_items, 100)
|
|
1170
|
+
)
|
|
1099
1171
|
);
|
|
1100
1172
|
} catch (e) {
|
|
1101
1173
|
return err(e);
|
|
@@ -1244,16 +1316,11 @@ function registerFeatureTools(server2) {
|
|
|
1244
1316
|
server2.tool(
|
|
1245
1317
|
"get_ls_ratio",
|
|
1246
1318
|
"Get long/short ratio data",
|
|
1247
|
-
{
|
|
1248
|
-
|
|
1249
|
-
period: z5.string().optional().describe("Period filter")
|
|
1250
|
-
},
|
|
1251
|
-
async ({ coin, period }) => {
|
|
1319
|
+
{},
|
|
1320
|
+
async () => {
|
|
1252
1321
|
try {
|
|
1253
|
-
const params = { coin };
|
|
1254
|
-
if (period) params.period = period;
|
|
1255
1322
|
return ok(
|
|
1256
|
-
await apiGet("/api/v2/mix/ls-ratio"
|
|
1323
|
+
await apiGet("/api/v2/mix/ls-ratio")
|
|
1257
1324
|
);
|
|
1258
1325
|
} catch (e) {
|
|
1259
1326
|
return err(e);
|
|
@@ -1264,18 +1331,22 @@ function registerFeatureTools(server2) {
|
|
|
1264
1331
|
"get_liquidation_data",
|
|
1265
1332
|
"Get liquidation/forced-close data",
|
|
1266
1333
|
{
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1334
|
+
currency: z5.string().optional().describe("Currency: cny or usd, default cny"),
|
|
1335
|
+
type: z5.string().optional().describe(
|
|
1336
|
+
"Query type: 1=by coin, 2=by platform"
|
|
1337
|
+
),
|
|
1338
|
+
coinKey: z5.string().optional().describe("Coin key, used when type=1"),
|
|
1339
|
+
marketKey: z5.string().optional().describe("Market key, used when type=2")
|
|
1270
1340
|
},
|
|
1271
|
-
async ({
|
|
1341
|
+
async ({ currency, type, coinKey, marketKey }) => {
|
|
1272
1342
|
try {
|
|
1273
1343
|
const params = {};
|
|
1274
|
-
if (
|
|
1275
|
-
if (
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1344
|
+
if (currency) params.currency = currency;
|
|
1345
|
+
if (type) params.type = type;
|
|
1346
|
+
if (coinKey) params.coinKey = coinKey;
|
|
1347
|
+
if (marketKey) params.marketKey = marketKey;
|
|
1348
|
+
return ok(
|
|
1349
|
+
await apiGet("/api/v2/mix/liq", params)
|
|
1279
1350
|
);
|
|
1280
1351
|
} catch (e) {
|
|
1281
1352
|
return err(e);
|
|
@@ -1379,10 +1450,16 @@ function registerFeatureTools(server2) {
|
|
|
1379
1450
|
server2.tool(
|
|
1380
1451
|
"get_nav",
|
|
1381
1452
|
"Get navigation bar data (market overview)",
|
|
1382
|
-
{
|
|
1383
|
-
|
|
1453
|
+
{
|
|
1454
|
+
lan: z5.string().optional().describe("Language: cn or en")
|
|
1455
|
+
},
|
|
1456
|
+
async ({ lan }) => {
|
|
1384
1457
|
try {
|
|
1385
|
-
|
|
1458
|
+
const params = {};
|
|
1459
|
+
if (lan) params.lan = lan;
|
|
1460
|
+
return ok(
|
|
1461
|
+
await apiGet("/api/v2/mix/nav", params)
|
|
1462
|
+
);
|
|
1386
1463
|
} catch (e) {
|
|
1387
1464
|
return err(e);
|
|
1388
1465
|
}
|
|
@@ -1440,18 +1517,12 @@ function registerFeatureTools(server2) {
|
|
|
1440
1517
|
server2.tool(
|
|
1441
1518
|
"get_signal_alert",
|
|
1442
1519
|
"Get signal alert data",
|
|
1443
|
-
{
|
|
1444
|
-
|
|
1445
|
-
...maxItemsParam
|
|
1446
|
-
},
|
|
1447
|
-
async ({ coin, _max_items }) => {
|
|
1520
|
+
{ ...maxItemsParam },
|
|
1521
|
+
async ({ _max_items }) => {
|
|
1448
1522
|
try {
|
|
1449
|
-
const params = {};
|
|
1450
|
-
if (coin) params.coin = coin;
|
|
1451
1523
|
return okList(
|
|
1452
1524
|
await apiGet(
|
|
1453
|
-
"/api/v2/signal/signalAlert"
|
|
1454
|
-
params
|
|
1525
|
+
"/api/v2/signal/signalAlert"
|
|
1455
1526
|
),
|
|
1456
1527
|
parseMax(_max_items, 50)
|
|
1457
1528
|
);
|
|
@@ -1463,11 +1534,18 @@ function registerFeatureTools(server2) {
|
|
|
1463
1534
|
server2.tool(
|
|
1464
1535
|
"get_signal_alert_config",
|
|
1465
1536
|
"Get signal alert configuration options",
|
|
1466
|
-
{
|
|
1467
|
-
|
|
1537
|
+
{
|
|
1538
|
+
lan: z5.string().optional().describe("Language: cn or en")
|
|
1539
|
+
},
|
|
1540
|
+
async ({ lan }) => {
|
|
1468
1541
|
try {
|
|
1542
|
+
const params = {};
|
|
1543
|
+
if (lan) params.lan = lan;
|
|
1469
1544
|
return ok(
|
|
1470
|
-
await apiGet(
|
|
1545
|
+
await apiGet(
|
|
1546
|
+
"/api/v2/signal/signalAlertConf",
|
|
1547
|
+
params
|
|
1548
|
+
)
|
|
1471
1549
|
);
|
|
1472
1550
|
} catch (e) {
|
|
1473
1551
|
return err(e);
|
|
@@ -1497,11 +1575,17 @@ function registerFeatureTools(server2) {
|
|
|
1497
1575
|
"add_signal_alert",
|
|
1498
1576
|
"Add a new signal alert",
|
|
1499
1577
|
{
|
|
1500
|
-
|
|
1578
|
+
subType: z5.string().describe("Alert sub type"),
|
|
1579
|
+
symbol: z5.string().describe("Trading pair symbol"),
|
|
1580
|
+
remark: z5.string().optional().describe("Alert remark/note")
|
|
1501
1581
|
},
|
|
1502
|
-
async ({
|
|
1582
|
+
async ({ subType, symbol, remark }) => {
|
|
1503
1583
|
try {
|
|
1504
|
-
const params =
|
|
1584
|
+
const params = {
|
|
1585
|
+
subType,
|
|
1586
|
+
symbol
|
|
1587
|
+
};
|
|
1588
|
+
if (remark) params.remark = remark;
|
|
1505
1589
|
return ok(
|
|
1506
1590
|
await apiGet(
|
|
1507
1591
|
"/api/v2/signal/addSignalAlert",
|
|
@@ -1688,13 +1772,17 @@ function registerHyperliquidTools(server2) {
|
|
|
1688
1772
|
"hl_get_trader_stats",
|
|
1689
1773
|
"Get Hyperliquid trader statistics by address",
|
|
1690
1774
|
{
|
|
1691
|
-
address: z6.string().describe("Wallet address, e.g. 0x...")
|
|
1775
|
+
address: z6.string().describe("Wallet address, e.g. 0x..."),
|
|
1776
|
+
period: z6.string().optional().describe("Period in days, e.g. 7, 30")
|
|
1692
1777
|
},
|
|
1693
|
-
async ({ address }) => {
|
|
1778
|
+
async ({ address, period }) => {
|
|
1694
1779
|
try {
|
|
1780
|
+
const params = {};
|
|
1781
|
+
if (period) params.period = period;
|
|
1695
1782
|
return ok(
|
|
1696
1783
|
await apiGet(
|
|
1697
|
-
`/api/upgrade/v2/hl/traders/${address}/addr-stat
|
|
1784
|
+
`/api/upgrade/v2/hl/traders/${address}/addr-stat`,
|
|
1785
|
+
params
|
|
1698
1786
|
)
|
|
1699
1787
|
);
|
|
1700
1788
|
} catch (e) {
|
|
@@ -1734,12 +1822,20 @@ function registerHyperliquidTools(server2) {
|
|
|
1734
1822
|
"Get Hyperliquid user trade fills by wallet address",
|
|
1735
1823
|
{
|
|
1736
1824
|
address: z6.string().describe("Wallet address, e.g. 0x..."),
|
|
1825
|
+
coin: z6.string().optional().describe("Coin filter, e.g. BTC"),
|
|
1826
|
+
limit: z6.string().optional().describe("Max results"),
|
|
1737
1827
|
...maxItemsParam
|
|
1738
1828
|
},
|
|
1739
|
-
async ({ address, _max_items }) => {
|
|
1829
|
+
async ({ address, coin, limit, _max_items }) => {
|
|
1740
1830
|
try {
|
|
1831
|
+
const params = {};
|
|
1832
|
+
if (coin) params.coin = coin;
|
|
1833
|
+
if (limit) params.limit = limit;
|
|
1741
1834
|
return okList(
|
|
1742
|
-
await apiGet(
|
|
1835
|
+
await apiGet(
|
|
1836
|
+
`/api/upgrade/v2/hl/fills/${address}`,
|
|
1837
|
+
params
|
|
1838
|
+
),
|
|
1743
1839
|
parseMax(_max_items, 50)
|
|
1744
1840
|
);
|
|
1745
1841
|
} catch (e) {
|
|
@@ -1786,12 +1882,16 @@ function registerHyperliquidTools(server2) {
|
|
|
1786
1882
|
"Get Hyperliquid top trades",
|
|
1787
1883
|
{
|
|
1788
1884
|
coin: z6.string().optional().describe("Coin filter, e.g. BTC"),
|
|
1885
|
+
interval: z6.string().optional().describe("Interval, e.g. 4h, 1d"),
|
|
1886
|
+
limit: z6.string().optional().describe("Max results"),
|
|
1789
1887
|
...maxItemsParam
|
|
1790
1888
|
},
|
|
1791
|
-
async ({ coin, _max_items }) => {
|
|
1889
|
+
async ({ coin, interval, limit, _max_items }) => {
|
|
1792
1890
|
try {
|
|
1793
1891
|
const params = {};
|
|
1794
1892
|
if (coin) params.coin = coin;
|
|
1893
|
+
if (interval) params.interval = interval;
|
|
1894
|
+
if (limit) params.limit = limit;
|
|
1795
1895
|
return okList(
|
|
1796
1896
|
await apiGet(
|
|
1797
1897
|
"/api/upgrade/v2/hl/fills/top-trades",
|
|
@@ -1809,13 +1909,19 @@ function registerHyperliquidTools(server2) {
|
|
|
1809
1909
|
"Get filled orders by wallet address",
|
|
1810
1910
|
{
|
|
1811
1911
|
address: z6.string().describe("Wallet address"),
|
|
1912
|
+
coin: z6.string().optional().describe("Coin filter, e.g. BTC"),
|
|
1913
|
+
limit: z6.string().optional().describe("Max results, default 1000"),
|
|
1812
1914
|
...maxItemsParam
|
|
1813
1915
|
},
|
|
1814
|
-
async ({ address, _max_items }) => {
|
|
1916
|
+
async ({ address, coin, limit, _max_items }) => {
|
|
1815
1917
|
try {
|
|
1918
|
+
const params = {};
|
|
1919
|
+
if (coin) params.coin = coin;
|
|
1920
|
+
if (limit) params.limit = limit;
|
|
1816
1921
|
return okList(
|
|
1817
1922
|
await apiGet(
|
|
1818
|
-
`/api/upgrade/v2/hl/filled-orders/${address}/latest
|
|
1923
|
+
`/api/upgrade/v2/hl/filled-orders/${address}/latest`,
|
|
1924
|
+
params
|
|
1819
1925
|
),
|
|
1820
1926
|
parseMax(_max_items, 50)
|
|
1821
1927
|
);
|
|
@@ -1847,13 +1953,19 @@ function registerHyperliquidTools(server2) {
|
|
|
1847
1953
|
"Get latest orders by wallet address",
|
|
1848
1954
|
{
|
|
1849
1955
|
address: z6.string().describe("Wallet address"),
|
|
1956
|
+
coin: z6.string().optional().describe("Coin filter, e.g. BTC"),
|
|
1957
|
+
limit: z6.string().optional().describe("Max results, default 2000"),
|
|
1850
1958
|
...maxItemsParam
|
|
1851
1959
|
},
|
|
1852
|
-
async ({ address, _max_items }) => {
|
|
1960
|
+
async ({ address, coin, limit, _max_items }) => {
|
|
1853
1961
|
try {
|
|
1962
|
+
const params = {};
|
|
1963
|
+
if (coin) params.coin = coin;
|
|
1964
|
+
if (limit) params.limit = limit;
|
|
1854
1965
|
return okList(
|
|
1855
1966
|
await apiGet(
|
|
1856
|
-
`/api/upgrade/v2/hl/orders/${address}/latest
|
|
1967
|
+
`/api/upgrade/v2/hl/orders/${address}/latest`,
|
|
1968
|
+
params
|
|
1857
1969
|
),
|
|
1858
1970
|
parseMax(_max_items, 50)
|
|
1859
1971
|
);
|
|
@@ -1883,12 +1995,16 @@ function registerHyperliquidTools(server2) {
|
|
|
1883
1995
|
"Get top open orders on Hyperliquid",
|
|
1884
1996
|
{
|
|
1885
1997
|
coin: z6.string().optional().describe("Coin filter"),
|
|
1998
|
+
min_val: z6.string().optional().describe("Min order value filter"),
|
|
1999
|
+
limit: z6.string().optional().describe("Max results"),
|
|
1886
2000
|
...maxItemsParam
|
|
1887
2001
|
},
|
|
1888
|
-
async ({ coin, _max_items }) => {
|
|
2002
|
+
async ({ coin, min_val, limit, _max_items }) => {
|
|
1889
2003
|
try {
|
|
1890
2004
|
const params = {};
|
|
1891
2005
|
if (coin) params.coin = coin;
|
|
2006
|
+
if (min_val) params.min_val = min_val;
|
|
2007
|
+
if (limit) params.limit = limit;
|
|
1892
2008
|
return okList(
|
|
1893
2009
|
await apiGet(
|
|
1894
2010
|
"/api/upgrade/v2/hl/orders/top-open-orders",
|
|
@@ -1905,12 +2021,17 @@ function registerHyperliquidTools(server2) {
|
|
|
1905
2021
|
"hl_get_active_stats",
|
|
1906
2022
|
"Get active order statistics",
|
|
1907
2023
|
{
|
|
1908
|
-
coin: z6.string().optional().describe("Coin filter")
|
|
2024
|
+
coin: z6.string().optional().describe("Coin filter"),
|
|
2025
|
+
whale_threshold: z6.string().optional().describe(
|
|
2026
|
+
"Whale threshold (order value limitPx * sz)"
|
|
2027
|
+
)
|
|
1909
2028
|
},
|
|
1910
|
-
async ({ coin }) => {
|
|
2029
|
+
async ({ coin, whale_threshold }) => {
|
|
1911
2030
|
try {
|
|
1912
2031
|
const params = {};
|
|
1913
2032
|
if (coin) params.coin = coin;
|
|
2033
|
+
if (whale_threshold)
|
|
2034
|
+
params.whale_threshold = whale_threshold;
|
|
1914
2035
|
return ok(
|
|
1915
2036
|
await apiGet(
|
|
1916
2037
|
"/api/upgrade/v2/hl/orders/active-stats",
|
|
@@ -1950,12 +2071,20 @@ function registerHyperliquidTools(server2) {
|
|
|
1950
2071
|
"Get PNL curve data by address",
|
|
1951
2072
|
{
|
|
1952
2073
|
address: z6.string().describe("Wallet address"),
|
|
2074
|
+
period: z6.string().optional().describe(
|
|
2075
|
+
"Period in days: 0(allTime), 1, 7, 30"
|
|
2076
|
+
),
|
|
1953
2077
|
...maxItemsParam
|
|
1954
2078
|
},
|
|
1955
|
-
async ({ address, _max_items }) => {
|
|
2079
|
+
async ({ address, period, _max_items }) => {
|
|
1956
2080
|
try {
|
|
2081
|
+
const params = {};
|
|
2082
|
+
if (period) params.period = period;
|
|
1957
2083
|
return okList(
|
|
1958
|
-
await apiGet(
|
|
2084
|
+
await apiGet(
|
|
2085
|
+
`/api/upgrade/v2/hl/pnls/${address}`,
|
|
2086
|
+
params
|
|
2087
|
+
),
|
|
1959
2088
|
parseMax(_max_items, 100)
|
|
1960
2089
|
);
|
|
1961
2090
|
} catch (e) {
|
|
@@ -2018,13 +2147,19 @@ function registerHyperliquidTools(server2) {
|
|
|
2018
2147
|
"Get completed trades list by address",
|
|
2019
2148
|
{
|
|
2020
2149
|
address: z6.string().describe("Wallet address"),
|
|
2150
|
+
coin: z6.string().optional().describe("Coin filter, e.g. BTC"),
|
|
2151
|
+
limit: z6.string().optional().describe("Max results, default 100"),
|
|
2021
2152
|
...maxItemsParam
|
|
2022
2153
|
},
|
|
2023
|
-
async ({ address, _max_items }) => {
|
|
2154
|
+
async ({ address, coin, limit, _max_items }) => {
|
|
2024
2155
|
try {
|
|
2156
|
+
const params = {};
|
|
2157
|
+
if (coin) params.coin = coin;
|
|
2158
|
+
if (limit) params.limit = limit;
|
|
2025
2159
|
return okList(
|
|
2026
2160
|
await apiGet(
|
|
2027
|
-
`/api/upgrade/v2/hl/traders/${address}/completed-trades
|
|
2161
|
+
`/api/upgrade/v2/hl/traders/${address}/completed-trades`,
|
|
2162
|
+
params
|
|
2028
2163
|
),
|
|
2029
2164
|
parseMax(_max_items, 50)
|
|
2030
2165
|
);
|
|
@@ -2057,13 +2192,23 @@ function registerHyperliquidTools(server2) {
|
|
|
2057
2192
|
"Get completed position history for a coin",
|
|
2058
2193
|
{
|
|
2059
2194
|
address: z6.string().describe("Wallet address"),
|
|
2060
|
-
coin: z6.string().describe("Coin, e.g. BTC")
|
|
2195
|
+
coin: z6.string().describe("Coin, e.g. BTC"),
|
|
2196
|
+
startTime: z6.string().optional().describe(
|
|
2197
|
+
"Start time in ms, at least one of startTime/endTime required"
|
|
2198
|
+
),
|
|
2199
|
+
endTime: z6.string().optional().describe(
|
|
2200
|
+
"End time in ms, at least one of startTime/endTime required"
|
|
2201
|
+
)
|
|
2061
2202
|
},
|
|
2062
|
-
async ({ address, coin }) => {
|
|
2203
|
+
async ({ address, coin, startTime, endTime }) => {
|
|
2063
2204
|
try {
|
|
2205
|
+
const params = {};
|
|
2206
|
+
if (startTime) params.startTime = startTime;
|
|
2207
|
+
if (endTime) params.endTime = endTime;
|
|
2064
2208
|
return ok(
|
|
2065
2209
|
await apiGet(
|
|
2066
|
-
`/api/upgrade/v2/hl/traders/${address}/completed-position-history/${coin}
|
|
2210
|
+
`/api/upgrade/v2/hl/traders/${address}/completed-position-history/${coin}`,
|
|
2211
|
+
params
|
|
2067
2212
|
)
|
|
2068
2213
|
);
|
|
2069
2214
|
} catch (e) {
|