@zeroexcore/trader 1.0.0 → 1.1.3

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 (133) hide show
  1. package/README.md +12 -1
  2. package/dist/utils/perps/index.d.ts.map +1 -1
  3. package/dist/utils/perps/index.js +1 -4
  4. package/dist/utils/perps/index.js.map +1 -1
  5. package/package.json +5 -1
  6. package/dist/commands/book.d.ts +0 -3
  7. package/dist/commands/book.d.ts.map +0 -1
  8. package/dist/commands/book.js +0 -44
  9. package/dist/commands/book.js.map +0 -1
  10. package/dist/commands/nft/floor.d.ts +0 -3
  11. package/dist/commands/nft/floor.d.ts.map +0 -1
  12. package/dist/commands/nft/floor.js +0 -30
  13. package/dist/commands/nft/floor.js.map +0 -1
  14. package/dist/commands/nft/index.d.ts +0 -3
  15. package/dist/commands/nft/index.d.ts.map +0 -1
  16. package/dist/commands/nft/index.js +0 -14
  17. package/dist/commands/nft/index.js.map +0 -1
  18. package/dist/commands/nft/listings.d.ts +0 -3
  19. package/dist/commands/nft/listings.d.ts.map +0 -1
  20. package/dist/commands/nft/listings.js +0 -37
  21. package/dist/commands/nft/listings.js.map +0 -1
  22. package/dist/commands/nft/popular.d.ts +0 -3
  23. package/dist/commands/nft/popular.d.ts.map +0 -1
  24. package/dist/commands/nft/popular.js +0 -32
  25. package/dist/commands/nft/popular.js.map +0 -1
  26. package/dist/commands/nft/portfolio.d.ts +0 -3
  27. package/dist/commands/nft/portfolio.d.ts.map +0 -1
  28. package/dist/commands/nft/portfolio.js +0 -43
  29. package/dist/commands/nft/portfolio.js.map +0 -1
  30. package/dist/commands/nft/search.d.ts +0 -3
  31. package/dist/commands/nft/search.d.ts.map +0 -1
  32. package/dist/commands/nft/search.js +0 -36
  33. package/dist/commands/nft/search.js.map +0 -1
  34. package/dist/commands/nft.d.ts +0 -3
  35. package/dist/commands/nft.d.ts.map +0 -1
  36. package/dist/commands/nft.js +0 -165
  37. package/dist/commands/nft.js.map +0 -1
  38. package/dist/commands/perps/info.d.ts +0 -3
  39. package/dist/commands/perps/info.d.ts.map +0 -1
  40. package/dist/commands/perps/info.js +0 -51
  41. package/dist/commands/perps/info.js.map +0 -1
  42. package/dist/commands/perps/markets.d.ts +0 -3
  43. package/dist/commands/perps/markets.d.ts.map +0 -1
  44. package/dist/commands/perps/markets.js +0 -43
  45. package/dist/commands/perps/markets.js.map +0 -1
  46. package/dist/commands/perps.d.ts +0 -3
  47. package/dist/commands/perps.d.ts.map +0 -1
  48. package/dist/commands/perps.js +0 -186
  49. package/dist/commands/perps.js.map +0 -1
  50. package/dist/commands/positions/close.d.ts +0 -3
  51. package/dist/commands/positions/close.d.ts.map +0 -1
  52. package/dist/commands/positions/close.js +0 -31
  53. package/dist/commands/positions/close.js.map +0 -1
  54. package/dist/commands/positions/filter.d.ts +0 -3
  55. package/dist/commands/positions/filter.d.ts.map +0 -1
  56. package/dist/commands/positions/filter.js +0 -20
  57. package/dist/commands/positions/filter.js.map +0 -1
  58. package/dist/commands/positions/index.d.ts +0 -3
  59. package/dist/commands/positions/index.d.ts.map +0 -1
  60. package/dist/commands/positions/index.js +0 -22
  61. package/dist/commands/positions/index.js.map +0 -1
  62. package/dist/commands/positions/list.d.ts +0 -3
  63. package/dist/commands/positions/list.d.ts.map +0 -1
  64. package/dist/commands/positions/list.js +0 -38
  65. package/dist/commands/positions/list.js.map +0 -1
  66. package/dist/commands/positions/note.d.ts +0 -3
  67. package/dist/commands/positions/note.d.ts.map +0 -1
  68. package/dist/commands/positions/note.js +0 -19
  69. package/dist/commands/positions/note.js.map +0 -1
  70. package/dist/commands/positions/open.d.ts +0 -3
  71. package/dist/commands/positions/open.d.ts.map +0 -1
  72. package/dist/commands/positions/open.js +0 -47
  73. package/dist/commands/positions/open.js.map +0 -1
  74. package/dist/commands/positions/show.d.ts +0 -3
  75. package/dist/commands/positions/show.d.ts.map +0 -1
  76. package/dist/commands/positions/show.js +0 -46
  77. package/dist/commands/positions/show.js.map +0 -1
  78. package/dist/commands/positions/stats.d.ts +0 -3
  79. package/dist/commands/positions/stats.d.ts.map +0 -1
  80. package/dist/commands/positions/stats.js +0 -27
  81. package/dist/commands/positions/stats.js.map +0 -1
  82. package/dist/commands/positions/tag.d.ts +0 -3
  83. package/dist/commands/positions/tag.d.ts.map +0 -1
  84. package/dist/commands/positions/tag.js +0 -19
  85. package/dist/commands/positions/tag.js.map +0 -1
  86. package/dist/commands/positions/update.d.ts +0 -3
  87. package/dist/commands/positions/update.d.ts.map +0 -1
  88. package/dist/commands/positions/update.js +0 -35
  89. package/dist/commands/positions/update.js.map +0 -1
  90. package/dist/commands/positions.d.ts +0 -3
  91. package/dist/commands/positions.d.ts.map +0 -1
  92. package/dist/commands/positions.js +0 -247
  93. package/dist/commands/positions.js.map +0 -1
  94. package/dist/commands/predict/list.d.ts +0 -3
  95. package/dist/commands/predict/list.d.ts.map +0 -1
  96. package/dist/commands/predict/list.js +0 -46
  97. package/dist/commands/predict/list.js.map +0 -1
  98. package/dist/commands/predict/market.d.ts +0 -3
  99. package/dist/commands/predict/market.d.ts.map +0 -1
  100. package/dist/commands/predict/market.js +0 -37
  101. package/dist/commands/predict/market.js.map +0 -1
  102. package/dist/commands/predict/watch.d.ts +0 -3
  103. package/dist/commands/predict/watch.d.ts.map +0 -1
  104. package/dist/commands/predict/watch.js +0 -73
  105. package/dist/commands/predict/watch.js.map +0 -1
  106. package/dist/commands/predict.d.ts +0 -3
  107. package/dist/commands/predict.d.ts.map +0 -1
  108. package/dist/commands/predict.js +0 -484
  109. package/dist/commands/predict.js.map +0 -1
  110. package/dist/commands/trade/index.d.ts +0 -3
  111. package/dist/commands/trade/index.d.ts.map +0 -1
  112. package/dist/commands/trade/index.js +0 -8
  113. package/dist/commands/trade/index.js.map +0 -1
  114. package/dist/commands/trade/info.d.ts +0 -3
  115. package/dist/commands/trade/info.d.ts.map +0 -1
  116. package/dist/commands/trade/info.js +0 -37
  117. package/dist/commands/trade/info.js.map +0 -1
  118. package/dist/commands/trade/quote.d.ts +0 -3
  119. package/dist/commands/trade/quote.d.ts.map +0 -1
  120. package/dist/commands/trade/quote.js +0 -56
  121. package/dist/commands/trade/quote.js.map +0 -1
  122. package/dist/commands/trade/search.d.ts +0 -3
  123. package/dist/commands/trade/search.d.ts.map +0 -1
  124. package/dist/commands/trade/search.js +0 -22
  125. package/dist/commands/trade/search.js.map +0 -1
  126. package/dist/commands/trade/swap.d.ts +0 -3
  127. package/dist/commands/trade/swap.d.ts.map +0 -1
  128. package/dist/commands/trade/swap.js +0 -70
  129. package/dist/commands/trade/swap.js.map +0 -1
  130. package/dist/commands/trade.d.ts +0 -5
  131. package/dist/commands/trade.d.ts.map +0 -1
  132. package/dist/commands/trade.js +0 -167
  133. package/dist/commands/trade.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../src/commands/perps/info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,WAAW,SAkDpB,CAAC"}
@@ -1,51 +0,0 @@
1
- import { Command } from 'commander';
2
- import { output } from '../shared.js';
3
- export const infoCommand = new Command('info')
4
- .description('How Jupiter Perps works')
5
- .action(() => {
6
- const infoData = {
7
- markets: ['SOL-PERP', 'ETH-PERP', 'BTC-PERP'],
8
- maxLeverage: '100x',
9
- collateral: ['SOL', 'USDC', 'USDT'],
10
- fees: {
11
- openClose: '0.06% of position size',
12
- borrow: 'Hourly rate based on utilization',
13
- },
14
- positions: {
15
- long: 'Profit when price goes UP',
16
- short: 'Profit when price goes DOWN',
17
- },
18
- liquidation: {
19
- trigger: 'Losses exceed collateral margin',
20
- note: 'Higher leverage = closer liquidation price',
21
- advice: 'Set stop-losses to protect capital',
22
- },
23
- warning: 'Leverage amplifies both gains AND losses. Start small (2-5x) until you understand the mechanics.',
24
- tradeUrl: 'https://jup.ag/perps',
25
- };
26
- output(infoData, () => [
27
- 'JUPITER PERPETUALS - QUICK GUIDE',
28
- '',
29
- 'MARKETS: SOL-PERP, ETH-PERP, BTC-PERP',
30
- 'LEVERAGE: Up to 100x',
31
- 'COLLATERAL: SOL, USDC, or USDT',
32
- '',
33
- 'FEES:',
34
- ' Open/Close: 0.06% of position size',
35
- ' Borrow: Hourly rate based on utilization',
36
- '',
37
- 'LONG = Profit when price goes UP',
38
- 'SHORT = Profit when price goes DOWN',
39
- '',
40
- 'LIQUIDATION:',
41
- ' Happens when losses exceed collateral margin',
42
- ' Higher leverage = closer liquidation price',
43
- ' Set stop-losses to protect capital',
44
- '',
45
- 'WARNING: Leverage amplifies both gains AND losses',
46
- 'Start small (2-5x) until you understand the mechanics',
47
- '',
48
- 'Trade at: https://jup.ag/perps',
49
- ].join('\n'));
50
- });
51
- //# sourceMappingURL=info.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"info.js","sourceRoot":"","sources":["../../../src/commands/perps/info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC3C,WAAW,CAAC,yBAAyB,CAAC;KACtC,MAAM,CAAC,GAAG,EAAE;IACX,MAAM,QAAQ,GAAG;QACf,OAAO,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC;QAC7C,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC;QACnC,IAAI,EAAE;YACJ,SAAS,EAAE,wBAAwB;YACnC,MAAM,EAAE,kCAAkC;SAC3C;QACD,SAAS,EAAE;YACT,IAAI,EAAE,2BAA2B;YACjC,KAAK,EAAE,6BAA6B;SACrC;QACD,WAAW,EAAE;YACX,OAAO,EAAE,iCAAiC;YAC1C,IAAI,EAAE,4CAA4C;YAClD,MAAM,EAAE,oCAAoC;SAC7C;QACD,OAAO,EAAE,kGAAkG;QAC3G,QAAQ,EAAE,sBAAsB;KACjC,CAAC;IAEF,MAAM,CAAC,QAAQ,EAAE,GAAG,EAAE,CACpB;QACE,kCAAkC;QAClC,EAAE;QACF,uCAAuC;QACvC,sBAAsB;QACtB,gCAAgC;QAChC,EAAE;QACF,OAAO;QACP,sCAAsC;QACtC,4CAA4C;QAC5C,EAAE;QACF,kCAAkC;QAClC,qCAAqC;QACrC,EAAE;QACF,cAAc;QACd,gDAAgD;QAChD,8CAA8C;QAC9C,sCAAsC;QACtC,EAAE;QACF,mDAAmD;QACnD,uDAAuD;QACvD,EAAE;QACF,gCAAgC;KACjC,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const marketsCommand: Command;
3
- //# sourceMappingURL=markets.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markets.d.ts","sourceRoot":"","sources":["../../../src/commands/perps/markets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,cAAc,SAyCvB,CAAC"}
@@ -1,43 +0,0 @@
1
- import { Connection } from '@solana/web3.js';
2
- import { Command } from 'commander';
3
- import { getAllCustodyInfo } from '../../utils/perps/index.js';
4
- import { output, error } from '../shared.js';
5
- import { getRpcUrl } from '../../config.js';
6
- export const marketsCommand = new Command('markets')
7
- .description('View available perps markets and fees')
8
- .action(async () => {
9
- try {
10
- const rpcUrl = getRpcUrl();
11
- const connection = new Connection(rpcUrl);
12
- const custodies = await getAllCustodyInfo(connection);
13
- const marketsData = custodies.map((c) => ({
14
- market: c.name,
15
- maxLeverage: `${c.maxLeverage}x`,
16
- openFeePct: (c.openFeeBps / 100).toFixed(2),
17
- closeFeePct: (c.closeFeeBps / 100).toFixed(2),
18
- }));
19
- output({
20
- markets: marketsData,
21
- tradeUrl: 'https://jup.ag/perps',
22
- }, () => {
23
- const lines = [
24
- 'Jupiter Perpetuals Markets',
25
- '',
26
- 'Market Max Lev Open Fee Close Fee',
27
- '----------- -------- ---------- ----------',
28
- ];
29
- for (const c of custodies) {
30
- const maxLev = `${c.maxLeverage}x`.padEnd(8);
31
- const openFee = `${(c.openFeeBps / 100).toFixed(2)}%`.padEnd(10);
32
- const closeFee = `${(c.closeFeeBps / 100).toFixed(2)}%`;
33
- lines.push(`${c.name.padEnd(11)} ${maxLev} ${openFee} ${closeFee}`);
34
- }
35
- lines.push('', 'Trade at: https://jup.ag/perps');
36
- return lines.join('\n');
37
- });
38
- }
39
- catch (e) {
40
- error('Failed to fetch markets', e.message);
41
- }
42
- });
43
- //# sourceMappingURL=markets.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markets.js","sourceRoot":"","sources":["../../../src/commands/perps/markets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC;KACjD,WAAW,CAAC,uCAAuC,CAAC;KACpD,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;QAC3B,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QAE1C,MAAM,SAAS,GAAG,MAAM,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAEtD,MAAM,WAAW,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;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AC,yBAAyB,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const perpsCommand: Command;
3
- //# sourceMappingURL=perps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"perps.d.ts","sourceRoot":"","sources":["../../src/commands/perps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,eAAO,MAAM,YAAY,SAC6C,CAAC"}
@@ -1,186 +0,0 @@
1
- import { Connection, PublicKey } from '@solana/web3.js';
2
- import { Command } from 'commander';
3
- import { getPoolStats, getAllCustodyInfo, getOpenPositions, } from '../utils/perps/index.js';
4
- import { output, error, requirePassword, getRpcUrl } from './shared.js';
5
- import { getWalletAddress } from '../utils/wallet.js';
6
- export const perpsCommand = new Command('perps')
7
- .description('Jupiter Perpetuals - leverage trading on SOL/ETH/BTC');
8
- perpsCommand
9
- .command('pool')
10
- .description('View JLP pool stats and AUM')
11
- .action(async () => {
12
- try {
13
- const rpcUrl = getRpcUrl();
14
- const connection = new Connection(rpcUrl);
15
- const stats = await getPoolStats(connection);
16
- output({
17
- aumUsd: stats.aumUsd.toFixed(2),
18
- aumFormatted: `$${stats.aumUsd.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`,
19
- markets: ['SOL-PERP', 'ETH-PERP', 'BTC-PERP'],
20
- maxLeverage: '100x',
21
- fees: '0.06%',
22
- }, () => [
23
- 'Jupiter Perpetuals Pool Stats',
24
- '',
25
- `Pool AUM: $${stats.aumUsd.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`,
26
- '',
27
- 'Available Markets: SOL-PERP, ETH-PERP, BTC-PERP',
28
- 'Max Leverage: Up to 100x',
29
- 'Fees: 0.06% open/close',
30
- ].join('\n'));
31
- }
32
- catch (e) {
33
- error('Failed to fetch pool stats', e.message);
34
- }
35
- });
36
- perpsCommand
37
- .command('markets')
38
- .description('View available perps markets and fees')
39
- .action(async () => {
40
- try {
41
- const rpcUrl = getRpcUrl();
42
- const connection = new Connection(rpcUrl);
43
- const custodies = await getAllCustodyInfo(connection);
44
- const marketsData = custodies.map((c) => ({
45
- market: c.name,
46
- maxLeverage: `${c.maxLeverage}x`,
47
- openFeePct: (c.openFeeBps / 100).toFixed(2),
48
- closeFeePct: (c.closeFeeBps / 100).toFixed(2),
49
- }));
50
- output({
51
- markets: marketsData,
52
- tradeUrl: 'https://jup.ag/perps',
53
- }, () => {
54
- const lines = [
55
- 'Jupiter Perpetuals Markets',
56
- '',
57
- 'Market Max Lev Open Fee Close Fee',
58
- '----------- -------- ---------- ----------',
59
- ];
60
- for (const c of custodies) {
61
- const maxLev = `${c.maxLeverage}x`.padEnd(8);
62
- const openFee = `${(c.openFeeBps / 100).toFixed(2)}%`.padEnd(10);
63
- const closeFee = `${(c.closeFeeBps / 100).toFixed(2)}%`;
64
- lines.push(`${c.name.padEnd(11)} ${maxLev} ${openFee} ${closeFee}`);
65
- }
66
- lines.push('', 'Trade at: https://jup.ag/perps');
67
- return lines.join('\n');
68
- });
69
- }
70
- catch (e) {
71
- error('Failed to fetch markets', e.message);
72
- }
73
- });
74
- perpsCommand
75
- .command('positions')
76
- .description('View your open perps positions')
77
- .option('-w, --wallet <address>', 'Wallet address (defaults to configured wallet)')
78
- .action(async (options) => {
79
- try {
80
- const rpcUrl = getRpcUrl();
81
- const connection = new Connection(rpcUrl);
82
- let walletAddress = options.wallet;
83
- if (!walletAddress) {
84
- const password = requirePassword();
85
- walletAddress = getWalletAddress(password);
86
- }
87
- const positions = await getOpenPositions(connection, new PublicKey(walletAddress));
88
- if (positions.length === 0) {
89
- output({
90
- wallet: walletAddress,
91
- positions: [],
92
- message: 'No open perps positions found',
93
- tradeUrl: 'https://jup.ag/perps',
94
- }, () => [
95
- `Perps Positions for ${walletAddress.slice(0, 8)}...`,
96
- '',
97
- 'No open perps positions found',
98
- '',
99
- 'Open a position at: https://jup.ag/perps',
100
- ].join('\n'));
101
- return;
102
- }
103
- const positionsData = positions.map((pos) => ({
104
- market: pos.custody,
105
- side: pos.side,
106
- sizeUsd: pos.sizeUsd.toFixed(2),
107
- collateralUsd: pos.collateralUsd.toFixed(2),
108
- leverage: pos.leverage.toFixed(1),
109
- entryPrice: pos.entryPrice.toFixed(2),
110
- publicKey: pos.publicKey,
111
- }));
112
- output({
113
- wallet: walletAddress,
114
- positions: positionsData,
115
- }, () => {
116
- const lines = [
117
- `Perps Positions for ${walletAddress.slice(0, 8)}...`,
118
- '',
119
- 'Market Side Size Collateral Leverage Entry',
120
- '------- ------ ------------ ------------ --------- ----------',
121
- ];
122
- for (const pos of positions) {
123
- const side = pos.side.toUpperCase().padEnd(6);
124
- const size = `$${pos.sizeUsd.toFixed(2)}`.padEnd(12);
125
- const collateral = `$${pos.collateralUsd.toFixed(2)}`.padEnd(12);
126
- const leverage = `${pos.leverage.toFixed(1)}x`.padEnd(9);
127
- const entry = `$${pos.entryPrice.toFixed(2)}`;
128
- lines.push(`${pos.custody.padEnd(7)} ${side} ${size} ${collateral} ${leverage} ${entry}`);
129
- }
130
- return lines.join('\n');
131
- });
132
- }
133
- catch (e) {
134
- error('Failed to fetch positions', e.message);
135
- }
136
- });
137
- perpsCommand
138
- .command('info')
139
- .description('How Jupiter Perps works')
140
- .action(() => {
141
- const infoData = {
142
- markets: ['SOL-PERP', 'ETH-PERP', 'BTC-PERP'],
143
- maxLeverage: '100x',
144
- collateral: ['SOL', 'USDC', 'USDT'],
145
- fees: {
146
- openClose: '0.06% of position size',
147
- borrow: 'Hourly rate based on utilization',
148
- },
149
- positions: {
150
- long: 'Profit when price goes UP',
151
- short: 'Profit when price goes DOWN',
152
- },
153
- liquidation: {
154
- trigger: 'Losses exceed collateral margin',
155
- note: 'Higher leverage = closer liquidation price',
156
- advice: 'Set stop-losses to protect capital',
157
- },
158
- warning: 'Leverage amplifies both gains AND losses. Start small (2-5x) until you understand the mechanics.',
159
- tradeUrl: 'https://jup.ag/perps',
160
- };
161
- output(infoData, () => [
162
- 'JUPITER PERPETUALS - QUICK GUIDE',
163
- '',
164
- 'MARKETS: SOL-PERP, ETH-PERP, BTC-PERP',
165
- 'LEVERAGE: Up to 100x',
166
- 'COLLATERAL: SOL, USDC, or USDT',
167
- '',
168
- 'FEES:',
169
- ' Open/Close: 0.06% of position size',
170
- ' Borrow: Hourly rate based on utilization',
171
- '',
172
- 'LONG = Profit when price goes UP',
173
- 'SHORT = Profit when price goes DOWN',
174
- '',
175
- 'LIQUIDATION:',
176
- ' Happens when losses exceed collateral margin',
177
- ' Higher leverage = closer liquidation price',
178
- ' Set stop-losses to protect capital',
179
- '',
180
- 'WARNING: Leverage amplifies both gains AND losses',
181
- 'Start small (2-5x) until you understand the mechanics',
182
- '',
183
- 'Trade at: https://jup.ag/perps',
184
- ].join('\n'));
185
- });
186
- //# sourceMappingURL=perps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"perps.js","sourceRoot":"","sources":["../../src/commands/perps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,GAEjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KAC7C,WAAW,CAAC,sDAAsD,CAAC,CAAC;AAEvE,YAAY;KACT,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,IAAI,CAAC;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C,EAAE;QACF,mDAAmD;QACnD,uDAAuD;QACvD,EAAE;QACF,gCAAgC;KACjC,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const closeCommand: Command;
3
- //# sourceMappingURL=close.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../../src/commands/positions/close.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,YAAY,SA+BrB,CAAC"}
@@ -1,31 +0,0 @@
1
- import { Command } from 'commander';
2
- import { closePosition } from '../../utils/positions.js';
3
- import { output } from '../shared.js';
4
- export const closeCommand = new Command('close')
5
- .argument('<position-id>', 'Position ID')
6
- .argument('<exit-price>', 'Exit price')
7
- .argument('<exit-amount>', 'Exit amount')
8
- .description('Close an open position')
9
- .option('-n, --notes <notes>', 'Exit notes')
10
- .option('--tx <signature>', 'Exit transaction signature')
11
- .action((positionId, exitPrice, exitAmount, options) => {
12
- const position = closePosition(positionId, parseFloat(exitPrice), parseFloat(exitAmount), {
13
- exitTxSignature: options.tx,
14
- notes: options.notes,
15
- });
16
- if (position) {
17
- output(position, () => {
18
- let md = `# Position Closed\n\n`;
19
- md += `**${position.tokenSymbol}** (${position.type.toUpperCase()})\n\n`;
20
- md += `- ID: ${position.id}\n`;
21
- md += `- Entry: $${position.entryPrice} x ${position.entryAmount} = $${position.entryValueUsd.toFixed(2)}\n`;
22
- md += `- Exit: $${position.exitPrice} x ${position.exitAmount} = $${position.exitValueUsd?.toFixed(2)}\n`;
23
- md += `- PnL: $${position.pnl?.toFixed(2)} (${position.pnlPercent?.toFixed(2)}%)\n`;
24
- return md;
25
- });
26
- }
27
- else {
28
- output({ error: 'Position not found', positionId }, () => `Error: Position not found: ${positionId}`);
29
- }
30
- });
31
- //# sourceMappingURL=close.js.map
@@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;YAC7G,EAAE,IAAI,YAAY,QAAQ,CAAC,SAAS,MAAM,QAAQ,CAAC,UAAU,OAAO,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;YAC1G,EAAE,IAAI,WAAW,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;YACpF,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,EAAE,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,CAAC,8BAA8B,UAAU,EAAE,CAAC,CAAC;IACxG,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const filterCommand: Command;
3
- //# sourceMappingURL=filter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/commands/positions/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,aAAa,SAetB,CAAC"}
@@ -1,20 +0,0 @@
1
- import { Command } from 'commander';
2
- import { getPositionsByTag } from '../../utils/positions.js';
3
- import { output } from '../shared.js';
4
- export const filterCommand = new Command('filter')
5
- .argument('<tag>', 'Tag to filter by')
6
- .description('List positions by tag')
7
- .action((tag) => {
8
- const pos = getPositionsByTag(tag);
9
- output(pos, () => {
10
- if (pos.length === 0) {
11
- return `# Positions by Tag\n\nNo positions found with tag: ${tag}`;
12
- }
13
- let md = `# Positions with tag "${tag}"\n\n`;
14
- for (const p of pos) {
15
- md += `- **${p.tokenSymbol}** (${p.type}): $${p.entryValueUsd.toFixed(2)} - ${p.status}\n`;
16
- }
17
- return md;
18
- });
19
- });
20
- //# sourceMappingURL=filter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../src/commands/positions/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;KACrC,WAAW,CAAC,uBAAuB,CAAC;KACpC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;IACd,MAAM,GAAG,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE;QACf,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,sDAAsD,GAAG,EAAE,CAAC;QACrE,CAAC;QACD,IAAI,EAAE,GAAG,yBAAyB,GAAG,OAAO,CAAC;QAC7C,KAAK,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;YACpB,EAAE,IAAI,OAAO,CAAC,CAAC,WAAW,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,IAAI,CAAC;QAC7F,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const positionsCommand: Command;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/positions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,eAAO,MAAM,gBAAgB,SACY,CAAC"}
@@ -1,22 +0,0 @@
1
- import { Command } from 'commander';
2
- import { listCommand } from './list.js';
3
- import { openCommand } from './open.js';
4
- import { closeCommand } from './close.js';
5
- import { noteCommand } from './note.js';
6
- import { tagCommand } from './tag.js';
7
- import { showCommand } from './show.js';
8
- import { filterCommand } from './filter.js';
9
- import { statsCommand } from './stats.js';
10
- import { updateCommand } from './update.js';
11
- export const positionsCommand = new Command('positions')
12
- .description('Track trading positions');
13
- positionsCommand.addCommand(listCommand);
14
- positionsCommand.addCommand(openCommand);
15
- positionsCommand.addCommand(closeCommand);
16
- positionsCommand.addCommand(noteCommand);
17
- positionsCommand.addCommand(tagCommand);
18
- positionsCommand.addCommand(showCommand);
19
- positionsCommand.addCommand(filterCommand);
20
- positionsCommand.addCommand(statsCommand);
21
- positionsCommand.addCommand(updateCommand);
22
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/positions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;KACrD,WAAW,CAAC,yBAAyB,CAAC,CAAC;AAE1C,gBAAgB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AACzC,gBAAgB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AACzC,gBAAgB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAC1C,gBAAgB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AACzC,gBAAgB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AACxC,gBAAgB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AACzC,gBAAgB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAC3C,gBAAgB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAC1C,gBAAgB,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const listCommand: Command;
3
- //# sourceMappingURL=list.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/positions/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,WAAW,SAmCpB,CAAC"}
@@ -1,38 +0,0 @@
1
- import { Command } from 'commander';
2
- import { calculateTotalPnL, getAllPositions, getOpenPositions } from '../../utils/positions.js';
3
- import { output } from '../shared.js';
4
- export const listCommand = new Command('list')
5
- .description('List all open positions')
6
- .option('-a, --all', 'Show all positions including closed')
7
- .action((options) => {
8
- const pos = options.all ? getAllPositions() : getOpenPositions();
9
- output(pos, () => {
10
- if (pos.length === 0) {
11
- return '# Positions\n\nNo positions found.';
12
- }
13
- let md = '# Positions\n\n';
14
- for (const p of pos) {
15
- md += `## ${p.tokenSymbol} (${p.type.toUpperCase()})\n`;
16
- md += `- ID: ${p.id}\n`;
17
- md += `- Status: ${p.status}\n`;
18
- md += `- Entry: $${p.entryPrice} x ${p.entryAmount} = $${p.entryValueUsd.toFixed(2)}\n`;
19
- if (p.exitPrice) {
20
- md += `- Exit: $${p.exitPrice} x ${p.exitAmount} = $${p.exitValueUsd?.toFixed(2)}\n`;
21
- }
22
- if (p.pnl !== undefined) {
23
- md += `- PnL: $${p.pnl.toFixed(2)} (${p.pnlPercent?.toFixed(2)}%)\n`;
24
- }
25
- if (p.notes)
26
- md += `- Notes: ${p.notes}\n`;
27
- if (p.tags?.length)
28
- md += `- Tags: ${p.tags.join(', ')}\n`;
29
- md += '\n';
30
- }
31
- if (options.all) {
32
- const { realized, count } = calculateTotalPnL();
33
- md += `---\n\n**Total Realized PnL:** $${realized.toFixed(2)} from ${count} closed positions\n`;
34
- }
35
- return md;
36
- });
37
- });
38
- //# sourceMappingURL=list.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/positions/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC3C,WAAW,CAAC,yBAAyB,CAAC;KACtC,MAAM,CAAC,WAAW,EAAE,qCAAqC,CAAC;KAC1D,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;IAClB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAEjE,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE;QACf,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,oCAAoC,CAAC;QAC9C,CAAC;QAED,IAAI,EAAE,GAAG,iBAAiB,CAAC;QAC3B,KAAK,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;YACpB,EAAE,IAAI,MAAM,CAAC,CAAC,WAAW,KAAK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+0,0 @@
1
- import { Command } from 'commander';
2
- export declare const noteCommand: Command;
3
- //# sourceMappingURL=note.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"note.d.ts","sourceRoot":"","sources":["../../../src/commands/positions/note.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,WAAW,SAgBpB,CAAC"}
@@ -1,19 +0,0 @@
1
- import { Command } from 'commander';
2
- import { getPosition, updatePositionNotes } from '../../utils/positions.js';
3
- import { output } from '../shared.js';
4
- export const noteCommand = new Command('note')
5
- .argument('<position-id>', 'Position ID')
6
- .argument('<note>', 'Note text')
7
- .description('Add a note to a position')
8
- .option('-a, --append', 'Append to existing notes instead of replacing')
9
- .action((positionId, note, options) => {
10
- updatePositionNotes(positionId, note, options.append);
11
- const position = getPosition(positionId);
12
- if (position) {
13
- output({ positionId, notes: position.notes }, () => `# Note Updated\n\nPosition: ${positionId}\nNotes: ${position.notes}`);
14
- }
15
- else {
16
- output({ error: 'Position not found', positionId }, () => `Error: Position not found: ${positionId}`);
17
- }
18
- });
19
- //# sourceMappingURL=note.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"note.js","sourceRoot":"","sources":["../../../src/commands/positions/note.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC3C,QAAQ,CAAC,eAAe,EAAE,aAAa,CAAC;KACxC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;KAC/B,WAAW,CAAC,0BAA0B,CAAC;KACvC,MAAM,CAAC,cAAc,EAAE,+CAA+C,CAAC;KACvE,MAAM,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IACpC,mBAAmB,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;IACzC,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,CACJ,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,EACrC,GAAG,EAAE,CAAC,+BAA+B,UAAU,YAAY,QAAQ,CAAC,KAAK,EAAE,CAC5E,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,EAAE,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE,CAAC,8BAA8B,UAAU,EAAE,CAAC,CAAC;IACxG,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const openCommand: Command;
3
- //# sourceMappingURL=open.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../../src/commands/positions/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,WAAW,SAuCpB,CAAC"}
@@ -1,47 +0,0 @@
1
- import { Command } from 'commander';
2
- import { openPosition } from '../../utils/positions.js';
3
- import { resolveToken } from '../../utils/token-book.js';
4
- import { output } from '../shared.js';
5
- export const openCommand = new Command('open')
6
- .argument('<type>', 'Position type (long/short)')
7
- .argument('<token>', 'Token symbol or address')
8
- .argument('<amount>', 'Entry amount')
9
- .argument('<price>', 'Entry price')
10
- .description('Open a new position')
11
- .option('-t, --target <price>', 'Target price')
12
- .option('-s, --stop <price>', 'Stop loss price')
13
- .option('-n, --notes <notes>', 'Position notes')
14
- .option('--tags <tags>', 'Comma-separated tags')
15
- .option('--tx <signature>', 'Entry transaction signature')
16
- .action((type, tokenOrTicker, amount, price, options) => {
17
- const token = resolveToken(tokenOrTicker);
18
- const tags = options.tags ? options.tags.split(',').map((t) => t.trim()) : undefined;
19
- const position = openPosition({
20
- type: type.toLowerCase(),
21
- token,
22
- tokenSymbol: tokenOrTicker.toUpperCase(),
23
- entryPrice: parseFloat(price),
24
- entryAmount: parseFloat(amount),
25
- targetPrice: options.target ? parseFloat(options.target) : undefined,
26
- stopLoss: options.stop ? parseFloat(options.stop) : undefined,
27
- notes: options.notes,
28
- tags,
29
- entryTxSignature: options.tx,
30
- });
31
- output(position, () => {
32
- let md = `# Position Opened\n\n`;
33
- md += `**${position.tokenSymbol}** (${position.type.toUpperCase()})\n\n`;
34
- md += `- ID: ${position.id}\n`;
35
- md += `- Entry: $${position.entryPrice} x ${position.entryAmount} = $${position.entryValueUsd.toFixed(2)}\n`;
36
- if (position.targetPrice)
37
- md += `- Target: $${position.targetPrice}\n`;
38
- if (position.stopLoss)
39
- md += `- Stop: $${position.stopLoss}\n`;
40
- if (position.notes)
41
- md += `- Notes: ${position.notes}\n`;
42
- if (position.tags?.length)
43
- md += `- Tags: ${position.tags.join(', ')}\n`;
44
- return md;
45
- });
46
- });
47
- //# sourceMappingURL=open.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"open.js","sourceRoot":"","sources":["../../../src/commands/positions/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC3C,QAAQ,CAAC,QAAQ,EAAE,4BAA4B,CAAC;KAChD,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAC;KAC9C,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;KACpC,QAAQ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,CAAC,QAAQ,EAAE,GAAG,EAAE;QACpB,IAAI,EAAE,GAAG,uBAAuB,CAAC;QACjC,EAAE,IAAI,KAAK,QAAQ,CAAC,WAAW,OAAO,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;QACzE,EAAE,IAAI,SAAS,QAAQ,CAAC,EAAE,IAAI,CAAC;QAC/B,EAAE,IAAI,aAAa,QAAQ,CAAC,UAAU,MAAM,QAAQ,CAAC,WAAW,OAAO,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;QAC7G,IAAI,QAAQ,CAAC,WAAW;YAAE,EAAE,IAAI,cAAc,QAAQ,CAAC,WAAW,IAAI,CAAC;QACvE,IAAI,QAAQ,CAAC,QAAQ;YAAE,EAAE,IAAI,YAAY,QAAQ,CAAC,QAAQ,IAAI,CAAC;QAC/D,IAAI,QAAQ,CAAC,KAAK;YAAE,EAAE,IAAI,YAAY,QAAQ,CAAC,KAAK,IAAI,CAAC;QACzD,IAAI,QAAQ,CAAC,IAAI,EAAE,MAAM;YAAE,EAAE,IAAI,WAAW,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QACzE,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const showCommand: Command;
3
- //# sourceMappingURL=show.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../src/commands/positions/show.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,eAAO,MAAM,WAAW,SAkCpB,CAAC"}