@jackwener/opencli 1.7.1 → 1.7.2

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 (54) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/cli-manifest.json +386 -1
  4. package/clis/binance/asks.js +21 -0
  5. package/clis/binance/commands.test.js +70 -0
  6. package/clis/binance/depth.js +21 -0
  7. package/clis/binance/gainers.js +22 -0
  8. package/clis/binance/klines.js +21 -0
  9. package/clis/binance/losers.js +22 -0
  10. package/clis/binance/pairs.js +21 -0
  11. package/clis/binance/price.js +18 -0
  12. package/clis/binance/prices.js +19 -0
  13. package/clis/binance/ticker.js +21 -0
  14. package/clis/binance/top.js +21 -0
  15. package/clis/binance/trades.js +20 -0
  16. package/clis/twitter/lists-parser.js +77 -0
  17. package/clis/twitter/lists.d.ts +5 -0
  18. package/clis/twitter/lists.js +62 -0
  19. package/clis/twitter/lists.test.js +50 -0
  20. package/clis/weibo/feed.js +18 -5
  21. package/clis/zsxq/topic.js +5 -3
  22. package/clis/zsxq/topic.test.js +4 -3
  23. package/clis/zsxq/utils.js +1 -1
  24. package/dist/src/cli.js +108 -0
  25. package/dist/src/discovery.d.ts +5 -2
  26. package/dist/src/discovery.js +7 -35
  27. package/dist/src/engine.test.js +29 -1
  28. package/dist/src/main.js +6 -5
  29. package/package.json +3 -3
  30. package/scripts/fetch-adapters.js +59 -28
  31. package/dist/src/clis/binance/asks.d.ts +0 -1
  32. package/dist/src/clis/binance/asks.js +0 -20
  33. package/dist/src/clis/binance/commands.test.d.ts +0 -3
  34. package/dist/src/clis/binance/commands.test.js +0 -58
  35. package/dist/src/clis/binance/depth.d.ts +0 -1
  36. package/dist/src/clis/binance/depth.js +0 -20
  37. package/dist/src/clis/binance/gainers.d.ts +0 -1
  38. package/dist/src/clis/binance/gainers.js +0 -21
  39. package/dist/src/clis/binance/klines.d.ts +0 -1
  40. package/dist/src/clis/binance/klines.js +0 -20
  41. package/dist/src/clis/binance/losers.d.ts +0 -1
  42. package/dist/src/clis/binance/losers.js +0 -21
  43. package/dist/src/clis/binance/pairs.d.ts +0 -1
  44. package/dist/src/clis/binance/pairs.js +0 -20
  45. package/dist/src/clis/binance/price.d.ts +0 -1
  46. package/dist/src/clis/binance/price.js +0 -17
  47. package/dist/src/clis/binance/prices.d.ts +0 -1
  48. package/dist/src/clis/binance/prices.js +0 -18
  49. package/dist/src/clis/binance/ticker.d.ts +0 -1
  50. package/dist/src/clis/binance/ticker.js +0 -20
  51. package/dist/src/clis/binance/top.d.ts +0 -1
  52. package/dist/src/clis/binance/top.js +0 -20
  53. package/dist/src/clis/binance/trades.d.ts +0 -1
  54. package/dist/src/clis/binance/trades.js +0 -19
package/README.md CHANGED
@@ -198,7 +198,7 @@ To load the source Browser Bridge extension:
198
198
  | **bilibili** | `hot` `search` `history` `feed` `ranking` `download` `comments` `dynamic` `favorite` `following` `me` `subtitle` `user-videos` |
199
199
  | **tieba** | `hot` `posts` `search` `read` |
200
200
  | **hupu** | `hot` `search` `detail` `mentions` `reply` `like` `unlike` |
201
- | **twitter** | `trending` `search` `timeline` `bookmarks` `post` `download` `profile` `article` `like` `likes` `notifications` `reply` `reply-dm` `thread` `follow` `unfollow` `followers` `following` `block` `unblock` `bookmark` `unbookmark` `delete` `hide-reply` `accept` |
201
+ | **twitter** | `trending` `search` `timeline` `lists` `bookmarks` `post` `download` `profile` `article` `like` `likes` `notifications` `reply` `reply-dm` `thread` `follow` `unfollow` `followers` `following` `block` `unblock` `bookmark` `unbookmark` `delete` `hide-reply` `accept` |
202
202
  | **reddit** | `hot` `frontpage` `popular` `search` `subreddit` `read` `user` `user-posts` `user-comments` `upvote` `upvoted` `save` `saved` `comment` `subscribe` |
203
203
  | **zhihu** | `hot` `search` `question` `download` `follow` `like` `favorite` `comment` `answer` |
204
204
  | **amazon** | `bestsellers` `search` `product` `offer` `discussion` `movers-shakers` `new-releases` |
package/README.zh-CN.md CHANGED
@@ -184,7 +184,7 @@ npm link
184
184
 
185
185
  | 站点 | 命令 | 模式 |
186
186
  |------|------|------|
187
- | **twitter** | `trending` `bookmarks` `profile` `search` `timeline` `thread` `following` `followers` `notifications` `post` `reply` `delete` `like` `article` `follow` `unfollow` `bookmark` `unbookmark` `download` `accept` `reply-dm` `block` `unblock` `hide-reply` | 浏览器 |
187
+ | **twitter** | `trending` `search` `timeline` `lists` `bookmarks` `profile` `thread` `following` `followers` `notifications` `post` `reply` `delete` `like` `article` `follow` `unfollow` `bookmark` `unbookmark` `download` `accept` `reply-dm` `block` `unblock` `hide-reply` | 浏览器 |
188
188
  | **reddit** | `hot` `frontpage` `popular` `search` `subreddit` `read` `user` `user-posts` `user-comments` `upvote` `save` `comment` `subscribe` `saved` `upvoted` | 浏览器 |
189
189
  | **tieba** | `hot` `posts` `search` `read` | 浏览器 |
190
190
  | **hupu** | `hot` `search` `detail` `mentions` `reply` `like` `unlike` | 浏览器 |
package/cli-manifest.json CHANGED
@@ -1632,6 +1632,340 @@
1632
1632
  "sourceFile": "bilibili/user-videos.js",
1633
1633
  "navigateBefore": "https://www.bilibili.com"
1634
1634
  },
1635
+ {
1636
+ "site": "binance",
1637
+ "name": "asks",
1638
+ "description": "Order book ask prices for a trading pair",
1639
+ "domain": "data-api.binance.vision",
1640
+ "strategy": "public",
1641
+ "browser": false,
1642
+ "args": [
1643
+ {
1644
+ "name": "symbol",
1645
+ "type": "str",
1646
+ "required": true,
1647
+ "positional": true,
1648
+ "help": "Trading pair symbol (e.g. BTCUSDT, ETHUSDT)"
1649
+ },
1650
+ {
1651
+ "name": "limit",
1652
+ "type": "int",
1653
+ "default": 10,
1654
+ "required": false,
1655
+ "help": "Number of price levels (5, 10, 20, 50, 100)"
1656
+ }
1657
+ ],
1658
+ "columns": [
1659
+ "rank",
1660
+ "ask_price",
1661
+ "ask_qty"
1662
+ ],
1663
+ "type": "js",
1664
+ "modulePath": "binance/asks.js",
1665
+ "sourceFile": "binance/asks.js"
1666
+ },
1667
+ {
1668
+ "site": "binance",
1669
+ "name": "depth",
1670
+ "description": "Order book bid prices for a trading pair",
1671
+ "domain": "data-api.binance.vision",
1672
+ "strategy": "public",
1673
+ "browser": false,
1674
+ "args": [
1675
+ {
1676
+ "name": "symbol",
1677
+ "type": "str",
1678
+ "required": true,
1679
+ "positional": true,
1680
+ "help": "Trading pair symbol (e.g. BTCUSDT, ETHUSDT)"
1681
+ },
1682
+ {
1683
+ "name": "limit",
1684
+ "type": "int",
1685
+ "default": 10,
1686
+ "required": false,
1687
+ "help": "Number of price levels (5, 10, 20, 50, 100)"
1688
+ }
1689
+ ],
1690
+ "columns": [
1691
+ "rank",
1692
+ "bid_price",
1693
+ "bid_qty"
1694
+ ],
1695
+ "type": "js",
1696
+ "modulePath": "binance/depth.js",
1697
+ "sourceFile": "binance/depth.js"
1698
+ },
1699
+ {
1700
+ "site": "binance",
1701
+ "name": "gainers",
1702
+ "description": "Top gaining trading pairs by 24h price change",
1703
+ "domain": "data-api.binance.vision",
1704
+ "strategy": "public",
1705
+ "browser": false,
1706
+ "args": [
1707
+ {
1708
+ "name": "limit",
1709
+ "type": "int",
1710
+ "default": 10,
1711
+ "required": false,
1712
+ "help": "Number of trading pairs"
1713
+ }
1714
+ ],
1715
+ "columns": [
1716
+ "rank",
1717
+ "symbol",
1718
+ "price",
1719
+ "change_24h",
1720
+ "volume"
1721
+ ],
1722
+ "type": "js",
1723
+ "modulePath": "binance/gainers.js",
1724
+ "sourceFile": "binance/gainers.js"
1725
+ },
1726
+ {
1727
+ "site": "binance",
1728
+ "name": "klines",
1729
+ "description": "Candlestick/kline data for a trading pair",
1730
+ "domain": "data-api.binance.vision",
1731
+ "strategy": "public",
1732
+ "browser": false,
1733
+ "args": [
1734
+ {
1735
+ "name": "symbol",
1736
+ "type": "str",
1737
+ "required": true,
1738
+ "positional": true,
1739
+ "help": "Trading pair symbol (e.g. BTCUSDT, ETHUSDT)"
1740
+ },
1741
+ {
1742
+ "name": "interval",
1743
+ "type": "str",
1744
+ "default": "1d",
1745
+ "required": false,
1746
+ "help": "Kline interval (1m, 5m, 15m, 1h, 4h, 1d, 1w, 1M)"
1747
+ },
1748
+ {
1749
+ "name": "limit",
1750
+ "type": "int",
1751
+ "default": 10,
1752
+ "required": false,
1753
+ "help": "Number of klines (max 1000)"
1754
+ }
1755
+ ],
1756
+ "columns": [
1757
+ "open",
1758
+ "high",
1759
+ "low",
1760
+ "close",
1761
+ "volume"
1762
+ ],
1763
+ "type": "js",
1764
+ "modulePath": "binance/klines.js",
1765
+ "sourceFile": "binance/klines.js"
1766
+ },
1767
+ {
1768
+ "site": "binance",
1769
+ "name": "losers",
1770
+ "description": "Top losing trading pairs by 24h price change",
1771
+ "domain": "data-api.binance.vision",
1772
+ "strategy": "public",
1773
+ "browser": false,
1774
+ "args": [
1775
+ {
1776
+ "name": "limit",
1777
+ "type": "int",
1778
+ "default": 10,
1779
+ "required": false,
1780
+ "help": "Number of trading pairs"
1781
+ }
1782
+ ],
1783
+ "columns": [
1784
+ "rank",
1785
+ "symbol",
1786
+ "price",
1787
+ "change_24h",
1788
+ "volume"
1789
+ ],
1790
+ "type": "js",
1791
+ "modulePath": "binance/losers.js",
1792
+ "sourceFile": "binance/losers.js"
1793
+ },
1794
+ {
1795
+ "site": "binance",
1796
+ "name": "pairs",
1797
+ "description": "List active trading pairs on Binance",
1798
+ "domain": "data-api.binance.vision",
1799
+ "strategy": "public",
1800
+ "browser": false,
1801
+ "args": [
1802
+ {
1803
+ "name": "limit",
1804
+ "type": "int",
1805
+ "default": 20,
1806
+ "required": false,
1807
+ "help": "Number of trading pairs"
1808
+ }
1809
+ ],
1810
+ "columns": [
1811
+ "symbol",
1812
+ "base",
1813
+ "quote",
1814
+ "status"
1815
+ ],
1816
+ "type": "js",
1817
+ "modulePath": "binance/pairs.js",
1818
+ "sourceFile": "binance/pairs.js"
1819
+ },
1820
+ {
1821
+ "site": "binance",
1822
+ "name": "price",
1823
+ "description": "Quick price check for a trading pair",
1824
+ "domain": "data-api.binance.vision",
1825
+ "strategy": "public",
1826
+ "browser": false,
1827
+ "args": [
1828
+ {
1829
+ "name": "symbol",
1830
+ "type": "str",
1831
+ "required": true,
1832
+ "positional": true,
1833
+ "help": "Trading pair symbol (e.g. BTCUSDT, ETHUSDT)"
1834
+ }
1835
+ ],
1836
+ "columns": [
1837
+ "symbol",
1838
+ "price",
1839
+ "change",
1840
+ "change_pct",
1841
+ "high",
1842
+ "low",
1843
+ "volume",
1844
+ "quote_volume",
1845
+ "trades"
1846
+ ],
1847
+ "type": "js",
1848
+ "modulePath": "binance/price.js",
1849
+ "sourceFile": "binance/price.js"
1850
+ },
1851
+ {
1852
+ "site": "binance",
1853
+ "name": "prices",
1854
+ "description": "Latest prices for all trading pairs",
1855
+ "domain": "data-api.binance.vision",
1856
+ "strategy": "public",
1857
+ "browser": false,
1858
+ "args": [
1859
+ {
1860
+ "name": "limit",
1861
+ "type": "int",
1862
+ "default": 20,
1863
+ "required": false,
1864
+ "help": "Number of prices"
1865
+ }
1866
+ ],
1867
+ "columns": [
1868
+ "rank",
1869
+ "symbol",
1870
+ "price"
1871
+ ],
1872
+ "type": "js",
1873
+ "modulePath": "binance/prices.js",
1874
+ "sourceFile": "binance/prices.js"
1875
+ },
1876
+ {
1877
+ "site": "binance",
1878
+ "name": "ticker",
1879
+ "description": "24h ticker statistics for top trading pairs by volume",
1880
+ "domain": "data-api.binance.vision",
1881
+ "strategy": "public",
1882
+ "browser": false,
1883
+ "args": [
1884
+ {
1885
+ "name": "limit",
1886
+ "type": "int",
1887
+ "default": 20,
1888
+ "required": false,
1889
+ "help": "Number of tickers"
1890
+ }
1891
+ ],
1892
+ "columns": [
1893
+ "symbol",
1894
+ "price",
1895
+ "change_pct",
1896
+ "high",
1897
+ "low",
1898
+ "volume",
1899
+ "quote_vol",
1900
+ "trades"
1901
+ ],
1902
+ "type": "js",
1903
+ "modulePath": "binance/ticker.js",
1904
+ "sourceFile": "binance/ticker.js"
1905
+ },
1906
+ {
1907
+ "site": "binance",
1908
+ "name": "top",
1909
+ "description": "Top trading pairs by 24h volume on Binance",
1910
+ "domain": "data-api.binance.vision",
1911
+ "strategy": "public",
1912
+ "browser": false,
1913
+ "args": [
1914
+ {
1915
+ "name": "limit",
1916
+ "type": "int",
1917
+ "default": 20,
1918
+ "required": false,
1919
+ "help": "Number of trading pairs"
1920
+ }
1921
+ ],
1922
+ "columns": [
1923
+ "rank",
1924
+ "symbol",
1925
+ "price",
1926
+ "change_24h",
1927
+ "high",
1928
+ "low",
1929
+ "volume"
1930
+ ],
1931
+ "type": "js",
1932
+ "modulePath": "binance/top.js",
1933
+ "sourceFile": "binance/top.js"
1934
+ },
1935
+ {
1936
+ "site": "binance",
1937
+ "name": "trades",
1938
+ "description": "Recent trades for a trading pair",
1939
+ "domain": "data-api.binance.vision",
1940
+ "strategy": "public",
1941
+ "browser": false,
1942
+ "args": [
1943
+ {
1944
+ "name": "symbol",
1945
+ "type": "str",
1946
+ "required": true,
1947
+ "positional": true,
1948
+ "help": "Trading pair symbol (e.g. BTCUSDT, ETHUSDT)"
1949
+ },
1950
+ {
1951
+ "name": "limit",
1952
+ "type": "int",
1953
+ "default": 20,
1954
+ "required": false,
1955
+ "help": "Number of trades (max 1000)"
1956
+ }
1957
+ ],
1958
+ "columns": [
1959
+ "id",
1960
+ "price",
1961
+ "qty",
1962
+ "quote_qty",
1963
+ "buyer_maker"
1964
+ ],
1965
+ "type": "js",
1966
+ "modulePath": "binance/trades.js",
1967
+ "sourceFile": "binance/trades.js"
1968
+ },
1635
1969
  {
1636
1970
  "site": "bloomberg",
1637
1971
  "name": "businessweek",
@@ -13249,6 +13583,40 @@
13249
13583
  "sourceFile": "twitter/likes.js",
13250
13584
  "navigateBefore": "https://x.com"
13251
13585
  },
13586
+ {
13587
+ "site": "twitter",
13588
+ "name": "lists",
13589
+ "description": "Get Twitter/X lists for a user",
13590
+ "domain": "x.com",
13591
+ "strategy": "cookie",
13592
+ "browser": true,
13593
+ "args": [
13594
+ {
13595
+ "name": "user",
13596
+ "type": "string",
13597
+ "required": false,
13598
+ "positional": true,
13599
+ "help": ""
13600
+ },
13601
+ {
13602
+ "name": "limit",
13603
+ "type": "int",
13604
+ "default": 50,
13605
+ "required": false,
13606
+ "help": ""
13607
+ }
13608
+ ],
13609
+ "columns": [
13610
+ "name",
13611
+ "members",
13612
+ "followers",
13613
+ "mode"
13614
+ ],
13615
+ "type": "js",
13616
+ "modulePath": "twitter/lists.js",
13617
+ "sourceFile": "twitter/lists.js",
13618
+ "navigateBefore": "https://x.com"
13619
+ },
13252
13620
  {
13253
13621
  "site": "twitter",
13254
13622
  "name": "notifications",
@@ -14048,11 +14416,22 @@
14048
14416
  {
14049
14417
  "site": "weibo",
14050
14418
  "name": "feed",
14051
- "description": "Weibo home timeline (posts from followed users)",
14419
+ "description": "Fetch Weibo timeline (for-you or following)",
14052
14420
  "domain": "weibo.com",
14053
14421
  "strategy": "cookie",
14054
14422
  "browser": true,
14055
14423
  "args": [
14424
+ {
14425
+ "name": "type",
14426
+ "type": "str",
14427
+ "default": "for-you",
14428
+ "required": false,
14429
+ "help": "Timeline type: for-you (algorithmic) or following (chronological)",
14430
+ "choices": [
14431
+ "for-you",
14432
+ "following"
14433
+ ]
14434
+ },
14056
14435
  {
14057
14436
  "name": "limit",
14058
14437
  "type": "int",
@@ -17088,6 +17467,12 @@
17088
17467
  "positional": true,
17089
17468
  "help": "Topic ID"
17090
17469
  },
17470
+ {
17471
+ "name": "group_id",
17472
+ "type": "str",
17473
+ "required": false,
17474
+ "help": "Group ID (optional; defaults to active group in Chrome)"
17475
+ },
17091
17476
  {
17092
17477
  "name": "comment_limit",
17093
17478
  "type": "int",
@@ -0,0 +1,21 @@
1
+ import { cli, Strategy } from '@jackwener/opencli/registry';
2
+
3
+ cli({
4
+ site: 'binance',
5
+ name: 'asks',
6
+ description: 'Order book ask prices for a trading pair',
7
+ domain: 'data-api.binance.vision',
8
+ strategy: Strategy.PUBLIC,
9
+ browser: false,
10
+ args: [
11
+ { name: 'symbol', type: 'str', required: true, positional: true, help: 'Trading pair symbol (e.g. BTCUSDT, ETHUSDT)' },
12
+ { name: 'limit', type: 'int', default: 10, help: 'Number of price levels (5, 10, 20, 50, 100)' },
13
+ ],
14
+ columns: ['rank', 'ask_price', 'ask_qty'],
15
+ pipeline: [
16
+ { fetch: { url: 'https://data-api.binance.vision/api/v3/depth?symbol=${{ args.symbol }}&limit=${{ args.limit }}' } },
17
+ { select: 'asks' },
18
+ { map: { rank: '${{ index + 1 }}', ask_price: '${{ item.0 }}', ask_qty: '${{ item.1 }}' } },
19
+ { limit: '${{ args.limit }}' },
20
+ ],
21
+ });
@@ -0,0 +1,70 @@
1
+ import { getRegistry } from '@jackwener/opencli/registry';
2
+ import { afterEach, describe, expect, it, vi } from 'vitest';
3
+ import { executePipeline } from '@jackwener/opencli/pipeline';
4
+
5
+ // Import all binance adapters to register them
6
+ import './top.js';
7
+ import './gainers.js';
8
+ import './pairs.js';
9
+
10
+ function loadPipeline(name) {
11
+ const cmd = getRegistry().get(`binance/${name}`);
12
+ if (!cmd?.pipeline) throw new Error(`Command binance/${name} not found or has no pipeline`);
13
+ return cmd.pipeline;
14
+ }
15
+
16
+ function mockJsonOnce(payload) {
17
+ vi.stubGlobal('fetch', vi.fn().mockResolvedValue({
18
+ ok: true,
19
+ status: 200,
20
+ statusText: 'OK',
21
+ json: vi.fn().mockResolvedValue(payload),
22
+ }));
23
+ }
24
+
25
+ afterEach(() => {
26
+ vi.unstubAllGlobals();
27
+ vi.restoreAllMocks();
28
+ });
29
+
30
+ describe('binance adapters', () => {
31
+ it('sorts top pairs by numeric quote volume', async () => {
32
+ mockJsonOnce([
33
+ { symbol: 'SMALL', lastPrice: '1', priceChangePercent: '1.2', highPrice: '1', lowPrice: '1', quoteVolume: '9.9' },
34
+ { symbol: 'LARGE', lastPrice: '2', priceChangePercent: '2.3', highPrice: '2', lowPrice: '2', quoteVolume: '100.0' },
35
+ { symbol: 'MID', lastPrice: '3', priceChangePercent: '3.4', highPrice: '3', lowPrice: '3', quoteVolume: '11.0' },
36
+ ]);
37
+
38
+ const result = await executePipeline(null, loadPipeline('top'), { args: { limit: 3 } });
39
+
40
+ expect(result.map((item) => item.symbol)).toEqual(['LARGE', 'MID', 'SMALL']);
41
+ expect(result.map((item) => item.rank)).toEqual([1, 2, 3]);
42
+ });
43
+
44
+ it('sorts gainers by numeric percent change', async () => {
45
+ mockJsonOnce([
46
+ { symbol: 'TEN', lastPrice: '1', priceChangePercent: '10.0', quoteVolume: '100' },
47
+ { symbol: 'NINE', lastPrice: '1', priceChangePercent: '9.5', quoteVolume: '100' },
48
+ { symbol: 'HUNDRED', lastPrice: '1', priceChangePercent: '100.0', quoteVolume: '100' },
49
+ ]);
50
+
51
+ const result = await executePipeline(null, loadPipeline('gainers'), { args: { limit: 3 } });
52
+
53
+ expect(result.map((item) => item.symbol)).toEqual(['HUNDRED', 'TEN', 'NINE']);
54
+ });
55
+
56
+ it('keeps only TRADING pairs', async () => {
57
+ mockJsonOnce({
58
+ symbols: [
59
+ { symbol: 'BTCUSDT', baseAsset: 'BTC', quoteAsset: 'USDT', status: 'TRADING' },
60
+ { symbol: 'OLDPAIR', baseAsset: 'OLD', quoteAsset: 'USDT', status: 'BREAK' },
61
+ ],
62
+ });
63
+
64
+ const result = await executePipeline(null, loadPipeline('pairs'), { args: { limit: 10 } });
65
+
66
+ expect(result).toEqual([
67
+ { symbol: 'BTCUSDT', base: 'BTC', quote: 'USDT', status: 'TRADING' },
68
+ ]);
69
+ });
70
+ });
@@ -0,0 +1,21 @@
1
+ import { cli, Strategy } from '@jackwener/opencli/registry';
2
+
3
+ cli({
4
+ site: 'binance',
5
+ name: 'depth',
6
+ description: 'Order book bid prices for a trading pair',
7
+ domain: 'data-api.binance.vision',
8
+ strategy: Strategy.PUBLIC,
9
+ browser: false,
10
+ args: [
11
+ { name: 'symbol', type: 'str', required: true, positional: true, help: 'Trading pair symbol (e.g. BTCUSDT, ETHUSDT)' },
12
+ { name: 'limit', type: 'int', default: 10, help: 'Number of price levels (5, 10, 20, 50, 100)' },
13
+ ],
14
+ columns: ['rank', 'bid_price', 'bid_qty'],
15
+ pipeline: [
16
+ { fetch: { url: 'https://data-api.binance.vision/api/v3/depth?symbol=${{ args.symbol }}&limit=${{ args.limit }}' } },
17
+ { select: 'bids' },
18
+ { map: { rank: '${{ index + 1 }}', bid_price: '${{ item.0 }}', bid_qty: '${{ item.1 }}' } },
19
+ { limit: '${{ args.limit }}' },
20
+ ],
21
+ });
@@ -0,0 +1,22 @@
1
+ import { cli, Strategy } from '@jackwener/opencli/registry';
2
+
3
+ cli({
4
+ site: 'binance',
5
+ name: 'gainers',
6
+ description: 'Top gaining trading pairs by 24h price change',
7
+ domain: 'data-api.binance.vision',
8
+ strategy: Strategy.PUBLIC,
9
+ browser: false,
10
+ args: [
11
+ { name: 'limit', type: 'int', default: 10, help: 'Number of trading pairs' },
12
+ ],
13
+ columns: ['rank', 'symbol', 'price', 'change_24h', 'volume'],
14
+ pipeline: [
15
+ { fetch: { url: 'https://data-api.binance.vision/api/v3/ticker/24hr' } },
16
+ { filter: 'item.priceChangePercent' },
17
+ { map: { symbol: '${{ item.symbol }}', price: '${{ item.lastPrice }}', change_24h: '${{ item.priceChangePercent }}', volume: '${{ item.quoteVolume }}', sort_change: '${{ Number(item.priceChangePercent) }}' } },
18
+ { sort: { by: 'sort_change', order: 'desc' } },
19
+ { map: { rank: '${{ index + 1 }}', symbol: '${{ item.symbol }}', price: '${{ item.lastPrice }}', change_24h: '${{ item.priceChangePercent }}', volume: '${{ item.quoteVolume }}' } },
20
+ { limit: '${{ args.limit }}' },
21
+ ],
22
+ });
@@ -0,0 +1,21 @@
1
+ import { cli, Strategy } from '@jackwener/opencli/registry';
2
+
3
+ cli({
4
+ site: 'binance',
5
+ name: 'klines',
6
+ description: 'Candlestick/kline data for a trading pair',
7
+ domain: 'data-api.binance.vision',
8
+ strategy: Strategy.PUBLIC,
9
+ browser: false,
10
+ args: [
11
+ { name: 'symbol', type: 'str', required: true, positional: true, help: 'Trading pair symbol (e.g. BTCUSDT, ETHUSDT)' },
12
+ { name: 'interval', type: 'str', default: '1d', help: 'Kline interval (1m, 5m, 15m, 1h, 4h, 1d, 1w, 1M)' },
13
+ { name: 'limit', type: 'int', default: 10, help: 'Number of klines (max 1000)' },
14
+ ],
15
+ columns: ['open', 'high', 'low', 'close', 'volume'],
16
+ pipeline: [
17
+ { fetch: { url: 'https://data-api.binance.vision/api/v3/klines?symbol=${{ args.symbol }}&interval=${{ args.interval }}&limit=${{ args.limit }}' } },
18
+ { map: { open: '${{ item.1 }}', high: '${{ item.2 }}', low: '${{ item.3 }}', close: '${{ item.4 }}', volume: '${{ item.5 }}' } },
19
+ { limit: '${{ args.limit }}' },
20
+ ],
21
+ });
@@ -0,0 +1,22 @@
1
+ import { cli, Strategy } from '@jackwener/opencli/registry';
2
+
3
+ cli({
4
+ site: 'binance',
5
+ name: 'losers',
6
+ description: 'Top losing trading pairs by 24h price change',
7
+ domain: 'data-api.binance.vision',
8
+ strategy: Strategy.PUBLIC,
9
+ browser: false,
10
+ args: [
11
+ { name: 'limit', type: 'int', default: 10, help: 'Number of trading pairs' },
12
+ ],
13
+ columns: ['rank', 'symbol', 'price', 'change_24h', 'volume'],
14
+ pipeline: [
15
+ { fetch: { url: 'https://data-api.binance.vision/api/v3/ticker/24hr' } },
16
+ { filter: 'item.priceChangePercent' },
17
+ { map: { symbol: '${{ item.symbol }}', price: '${{ item.lastPrice }}', change_24h: '${{ item.priceChangePercent }}', volume: '${{ item.quoteVolume }}', sort_change: '${{ Number(item.priceChangePercent) }}' } },
18
+ { sort: { by: 'sort_change' } },
19
+ { map: { rank: '${{ index + 1 }}', symbol: '${{ item.symbol }}', price: '${{ item.lastPrice }}', change_24h: '${{ item.priceChangePercent }}', volume: '${{ item.quoteVolume }}' } },
20
+ { limit: '${{ args.limit }}' },
21
+ ],
22
+ });
@@ -0,0 +1,21 @@
1
+ import { cli, Strategy } from '@jackwener/opencli/registry';
2
+
3
+ cli({
4
+ site: 'binance',
5
+ name: 'pairs',
6
+ description: 'List active trading pairs on Binance',
7
+ domain: 'data-api.binance.vision',
8
+ strategy: Strategy.PUBLIC,
9
+ browser: false,
10
+ args: [
11
+ { name: 'limit', type: 'int', default: 20, help: 'Number of trading pairs' },
12
+ ],
13
+ columns: ['symbol', 'base', 'quote', 'status'],
14
+ pipeline: [
15
+ { fetch: { url: 'https://data-api.binance.vision/api/v3/exchangeInfo' } },
16
+ { select: 'symbols' },
17
+ { filter: 'item.status === \'TRADING\'' },
18
+ { map: { symbol: '${{ item.symbol }}', base: '${{ item.baseAsset }}', quote: '${{ item.quoteAsset }}', status: '${{ item.status }}' } },
19
+ { limit: '${{ args.limit }}' },
20
+ ],
21
+ });
@@ -0,0 +1,18 @@
1
+ import { cli, Strategy } from '@jackwener/opencli/registry';
2
+
3
+ cli({
4
+ site: 'binance',
5
+ name: 'price',
6
+ description: 'Quick price check for a trading pair',
7
+ domain: 'data-api.binance.vision',
8
+ strategy: Strategy.PUBLIC,
9
+ browser: false,
10
+ args: [
11
+ { name: 'symbol', type: 'str', required: true, positional: true, help: 'Trading pair symbol (e.g. BTCUSDT, ETHUSDT)' },
12
+ ],
13
+ columns: ['symbol', 'price', 'change', 'change_pct', 'high', 'low', 'volume', 'quote_volume', 'trades'],
14
+ pipeline: [
15
+ { fetch: { url: 'https://data-api.binance.vision/api/v3/ticker/24hr?symbol=${{ args.symbol }}' } },
16
+ { map: { symbol: '${{ item.symbol }}', price: '${{ item.lastPrice }}', change: '${{ item.priceChange }}', change_pct: '${{ item.priceChangePercent }}', high: '${{ item.highPrice }}', low: '${{ item.lowPrice }}', volume: '${{ item.volume }}', quote_volume: '${{ item.quoteVolume }}', trades: '${{ item.count }}' } },
17
+ ],
18
+ });