@aicoin/opendata-mcp 1.0.17 → 1.0.18

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