@invizi/cli 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/trades.js +43 -7
- package/dist/invizi.js +16 -12
- package/package.json +1 -1
package/dist/commands/trades.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
1
2
|
import { loadConfig } from '../config.js';
|
|
2
3
|
const HLP_API = 'https://api.hyperliquid.xyz/info';
|
|
3
4
|
const MAX_FILLS_PER_REQUEST = 2000;
|
|
@@ -194,20 +195,55 @@ function formatCoinDetail(fills, coin) {
|
|
|
194
195
|
}
|
|
195
196
|
return lines.join('\n');
|
|
196
197
|
}
|
|
198
|
+
function showHelp() {
|
|
199
|
+
console.log(`
|
|
200
|
+
invizi trades — Analyze past trades from Hyperliquid
|
|
201
|
+
|
|
202
|
+
Usage:
|
|
203
|
+
invizi trades [address] [options]
|
|
204
|
+
|
|
205
|
+
Options:
|
|
206
|
+
--days <n> Only show trades from the last N days
|
|
207
|
+
--coin <COIN> Show per-fill detail for a specific coin
|
|
208
|
+
--json Output as JSON (for piping to AI tools)
|
|
209
|
+
--help Show this help
|
|
210
|
+
|
|
211
|
+
Examples:
|
|
212
|
+
invizi trades P&L by coin (connected address)
|
|
213
|
+
invizi trades --days 30 Last 30 days only
|
|
214
|
+
invizi trades --coin SOL SOL fill-by-fill detail
|
|
215
|
+
invizi trades 0xABC...123 Analyze any public address
|
|
216
|
+
invizi trades --days 7 --json JSON output for AI tools
|
|
217
|
+
|
|
218
|
+
Data is read from the public Hyperliquid blockchain. No auth required.
|
|
219
|
+
`);
|
|
220
|
+
}
|
|
197
221
|
export async function trades(args) {
|
|
222
|
+
const { values, positionals } = parseArgs({
|
|
223
|
+
args,
|
|
224
|
+
options: {
|
|
225
|
+
days: { type: 'string', short: 'd' },
|
|
226
|
+
coin: { type: 'string', short: 'c' },
|
|
227
|
+
json: { type: 'boolean', default: false },
|
|
228
|
+
help: { type: 'boolean', short: 'h', default: false },
|
|
229
|
+
},
|
|
230
|
+
allowPositionals: true,
|
|
231
|
+
strict: false,
|
|
232
|
+
});
|
|
233
|
+
if (values.help) {
|
|
234
|
+
showHelp();
|
|
235
|
+
return 0;
|
|
236
|
+
}
|
|
198
237
|
const config = loadConfig();
|
|
199
|
-
const address =
|
|
238
|
+
const address = positionals.find(a => /^0x[0-9a-fA-F]{40}$/.test(a)) || config.address;
|
|
200
239
|
if (!address) {
|
|
201
240
|
console.error('No address found. Run: invizi connect <address>');
|
|
202
241
|
console.error('Or pass directly: invizi trades 0x...');
|
|
203
242
|
return 1;
|
|
204
243
|
}
|
|
205
|
-
|
|
206
|
-
const
|
|
207
|
-
const
|
|
208
|
-
const coinIdx = args.indexOf('--coin');
|
|
209
|
-
const coinFilter = coinIdx !== -1 ? args[coinIdx + 1]?.toUpperCase() : null;
|
|
210
|
-
const jsonMode = args.includes('--json');
|
|
244
|
+
const days = typeof values.days === 'string' ? parseInt(values.days, 10) : null;
|
|
245
|
+
const coinFilter = typeof values.coin === 'string' ? values.coin.toUpperCase() : null;
|
|
246
|
+
const jsonMode = values.json === true;
|
|
211
247
|
// Calculate start time
|
|
212
248
|
const now = Date.now();
|
|
213
249
|
const startTime = days ? now - days * 24 * 60 * 60 * 1000 : 0;
|
package/dist/invizi.js
CHANGED
|
@@ -8,17 +8,22 @@ function showLocalHelp() {
|
|
|
8
8
|
console.log(`
|
|
9
9
|
Invizi CLI
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
invizi
|
|
13
|
-
invizi
|
|
14
|
-
invizi
|
|
15
|
-
invizi
|
|
16
|
-
invizi trades Analyze past trades
|
|
17
|
-
|
|
11
|
+
Data:
|
|
12
|
+
invizi context Market regime, macro, yields, options, HLP
|
|
13
|
+
invizi context -c SOL + coin data, flow, positions, trade history
|
|
14
|
+
invizi scout <COIN> Quick coin scan (price, funding, RSI, OBI)
|
|
15
|
+
invizi market BTC/ETH/SOL prices, fear/greed, funding extremes
|
|
16
|
+
invizi trades Analyze past trades — P&L by coin (local)
|
|
17
|
+
|
|
18
|
+
Account:
|
|
19
|
+
invizi auth login Login
|
|
20
|
+
invizi auth status Show current identity
|
|
21
|
+
invizi connect <address> Connect a wallet address
|
|
22
|
+
|
|
23
|
+
Setup:
|
|
24
|
+
invizi setup Configure API + install AI skills
|
|
18
25
|
invizi config Show current config
|
|
19
26
|
invizi version Show CLI version
|
|
20
|
-
|
|
21
|
-
Run invizi --help after login for the remote command list.
|
|
22
27
|
`);
|
|
23
28
|
}
|
|
24
29
|
async function executeProtocol(args, authHeader) {
|
|
@@ -76,13 +81,12 @@ async function showRemoteHelp(authHeader) {
|
|
|
76
81
|
console.log('No commands available for this user.');
|
|
77
82
|
return;
|
|
78
83
|
}
|
|
79
|
-
console.log('Invizi Remote Commands\n');
|
|
80
84
|
for (const cmd of commands) {
|
|
81
85
|
const name = Array.isArray(cmd.tokens) ? cmd.tokens.join(' ') : cmd.id || '(unknown)';
|
|
82
86
|
const desc = cmd.description || '';
|
|
83
|
-
console.log(` ${name.padEnd(
|
|
87
|
+
console.log(` invizi ${name.padEnd(22)} ${desc}`);
|
|
84
88
|
}
|
|
85
|
-
console.log('
|
|
89
|
+
console.log('');
|
|
86
90
|
}
|
|
87
91
|
async function executeRemote(args, options = {}) {
|
|
88
92
|
const authHeader = await getAuthorizationHeader();
|