kwery-cli 0.2.0
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/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +87 -0
- package/dist/client.d.ts +6 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +41 -0
- package/dist/client.js.map +1 -0
- package/dist/commands/account.d.ts +3 -0
- package/dist/commands/account.d.ts.map +1 -0
- package/dist/commands/account.js +34 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/binance.d.ts +3 -0
- package/dist/commands/binance.d.ts.map +1 -0
- package/dist/commands/binance.js +166 -0
- package/dist/commands/binance.js.map +1 -0
- package/dist/commands/candles.d.ts +3 -0
- package/dist/commands/candles.d.ts.map +1 -0
- package/dist/commands/candles.js +35 -0
- package/dist/commands/candles.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +35 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/hyperliquid.d.ts +3 -0
- package/dist/commands/hyperliquid.d.ts.map +1 -0
- package/dist/commands/hyperliquid.js +161 -0
- package/dist/commands/hyperliquid.js.map +1 -0
- package/dist/commands/kalshi.d.ts +3 -0
- package/dist/commands/kalshi.d.ts.map +1 -0
- package/dist/commands/kalshi.js +121 -0
- package/dist/commands/kalshi.js.map +1 -0
- package/dist/commands/limits.d.ts +3 -0
- package/dist/commands/limits.d.ts.map +1 -0
- package/dist/commands/limits.js +51 -0
- package/dist/commands/limits.js.map +1 -0
- package/dist/commands/markets.d.ts +3 -0
- package/dist/commands/markets.d.ts.map +1 -0
- package/dist/commands/markets.js +53 -0
- package/dist/commands/markets.js.map +1 -0
- package/dist/commands/polymarket.d.ts +3 -0
- package/dist/commands/polymarket.d.ts.map +1 -0
- package/dist/commands/polymarket.js +145 -0
- package/dist/commands/polymarket.js.map +1 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +15 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/output.d.ts +10 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +55 -0
- package/dist/output.js.map +1 -0
- package/package.json +72 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { candlesCommand } from "./commands/candles.js";
|
|
4
|
+
import { marketsCommand } from "./commands/markets.js";
|
|
5
|
+
import { limitsCommand } from "./commands/limits.js";
|
|
6
|
+
import { polymarketCommand } from "./commands/polymarket.js";
|
|
7
|
+
import { kalshiCommand } from "./commands/kalshi.js";
|
|
8
|
+
import { hyperliquidCommand } from "./commands/hyperliquid.js";
|
|
9
|
+
import { binanceCommand } from "./commands/binance.js";
|
|
10
|
+
import { accountCommands } from "./commands/account.js";
|
|
11
|
+
import { configCommand } from "./commands/config.js";
|
|
12
|
+
const program = new Command();
|
|
13
|
+
program
|
|
14
|
+
.name("kwery")
|
|
15
|
+
.description("Query crypto and prediction market data from your terminal")
|
|
16
|
+
.version("0.1.0")
|
|
17
|
+
.addHelpText("after", "\nEnvironment Variables:\n" +
|
|
18
|
+
" KWERY_API_KEY Your Kwery API key (required)\n" +
|
|
19
|
+
" KWERY_BASE_URL Override API base URL (default: https://kwery-api.com)\n" +
|
|
20
|
+
"\nGet an API key at https://kwery.xyz");
|
|
21
|
+
// Platform namespaces
|
|
22
|
+
polymarketCommand(program);
|
|
23
|
+
kalshiCommand(program);
|
|
24
|
+
hyperliquidCommand(program);
|
|
25
|
+
binanceCommand(program);
|
|
26
|
+
// Account & discovery
|
|
27
|
+
accountCommands(program);
|
|
28
|
+
limitsCommand(program);
|
|
29
|
+
configCommand(program);
|
|
30
|
+
// Legacy flat commands (kept for backwards compatibility)
|
|
31
|
+
candlesCommand(program);
|
|
32
|
+
marketsCommand(program);
|
|
33
|
+
program.parse(process.argv);
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,4DAA4D,CAAC;KACzE,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CACV,OAAO,EACP,4BAA4B;IAC5B,oDAAoD;IACpD,6EAA6E;IAC7E,uCAAuC,CACxC,CAAC;AAEJ,sBAAsB;AACtB,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAC3B,aAAa,CAAC,OAAO,CAAC,CAAC;AACvB,kBAAkB,CAAC,OAAO,CAAC,CAAC;AAC5B,cAAc,CAAC,OAAO,CAAC,CAAC;AAExB,sBAAsB;AACtB,eAAe,CAAC,OAAO,CAAC,CAAC;AACzB,aAAa,CAAC,OAAO,CAAC,CAAC;AACvB,aAAa,CAAC,OAAO,CAAC,CAAC;AAEvB,0DAA0D;AAC1D,cAAc,CAAC,OAAO,CAAC,CAAC;AACxB,cAAc,CAAC,OAAO,CAAC,CAAC;AAExB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/output.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output formatters for CLI commands.
|
|
3
|
+
*/
|
|
4
|
+
export type OutputFormat = "json" | "table" | "csv";
|
|
5
|
+
export declare function formatJson(data: unknown): string;
|
|
6
|
+
export declare function formatCsv(rows: Record<string, unknown>[]): string;
|
|
7
|
+
export declare function formatTable(rows: Record<string, unknown>[]): string;
|
|
8
|
+
export declare function printOutput(data: unknown, format?: OutputFormat): void;
|
|
9
|
+
export declare function printError(message: string): void;
|
|
10
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpD,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAEhD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,MAAM,CAkBjE;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,MAAM,CAiBnE;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,OAAO,EACb,MAAM,GAAE,YAAqB,GAC5B,IAAI,CAeN;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhD"}
|
package/dist/output.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output formatters for CLI commands.
|
|
3
|
+
*/
|
|
4
|
+
export function formatJson(data) {
|
|
5
|
+
return JSON.stringify(data, null, 2);
|
|
6
|
+
}
|
|
7
|
+
export function formatCsv(rows) {
|
|
8
|
+
if (rows.length === 0)
|
|
9
|
+
return "";
|
|
10
|
+
const headers = Object.keys(rows[0]);
|
|
11
|
+
const lines = [
|
|
12
|
+
headers.join(","),
|
|
13
|
+
...rows.map((row) => headers
|
|
14
|
+
.map((h) => {
|
|
15
|
+
const val = row[h];
|
|
16
|
+
const str = val === null || val === undefined ? "" : String(val);
|
|
17
|
+
return str.includes(",") || str.includes('"') || str.includes("\n")
|
|
18
|
+
? `"${str.replace(/"/g, '""')}"`
|
|
19
|
+
: str;
|
|
20
|
+
})
|
|
21
|
+
.join(",")),
|
|
22
|
+
];
|
|
23
|
+
return lines.join("\n");
|
|
24
|
+
}
|
|
25
|
+
export function formatTable(rows) {
|
|
26
|
+
if (rows.length === 0)
|
|
27
|
+
return "(no data)";
|
|
28
|
+
const headers = Object.keys(rows[0]);
|
|
29
|
+
const colWidths = headers.map((h) => Math.max(h.length, ...rows.map((r) => String(r[h] ?? "").length)));
|
|
30
|
+
const divider = colWidths.map((w) => "-".repeat(w)).join(" ");
|
|
31
|
+
const header = headers.map((h, i) => h.padEnd(colWidths[i])).join(" ");
|
|
32
|
+
const body = rows
|
|
33
|
+
.map((row) => headers.map((h, i) => String(row[h] ?? "").padEnd(colWidths[i])).join(" "))
|
|
34
|
+
.join("\n");
|
|
35
|
+
return [header, divider, body].join("\n");
|
|
36
|
+
}
|
|
37
|
+
export function printOutput(data, format = "json") {
|
|
38
|
+
if (format === "json") {
|
|
39
|
+
console.log(formatJson(data));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const rows = Array.isArray(data)
|
|
43
|
+
? data
|
|
44
|
+
: data?.data ?? [data];
|
|
45
|
+
if (format === "csv") {
|
|
46
|
+
console.log(formatCsv(rows));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
console.log(formatTable(rows));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export function printError(message) {
|
|
53
|
+
console.error(`Error: ${message}`);
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,UAAU,UAAU,CAAC,IAAa;IACtC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAA+B;IACvD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG;QACZ,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;QACjB,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAClB,OAAO;aACJ,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACT,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;YACnB,MAAM,GAAG,GAAG,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;gBACjE,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,I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AAC,IAAI,CAAC,IAAI,CAAC,CAC5E;SACA,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,IAAa,EACb,SAAuB,MAAM;IAE7B,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9B,OAAO;IACT,CAAC;IAED,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;QAC9B,CAAC,CAAE,IAAkC;QACrC,CAAC,CAAE,IAAY,EAAE,IAAI,IAAI,CAAC,IAA+B,CAAC,CAAC;IAE7D,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;IACjC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,OAAO,CAAC,KAAK,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;AACrC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kwery-cli",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "CLI for Kwery — unified crypto and prediction market data across Polymarket, Kalshi, Hyperliquid, Binance, and Chainlink.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"kwery": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/",
|
|
11
|
+
"README.md",
|
|
12
|
+
"CHANGELOG.md"
|
|
13
|
+
],
|
|
14
|
+
"keywords": [
|
|
15
|
+
"cli",
|
|
16
|
+
"crypto",
|
|
17
|
+
"prediction-markets",
|
|
18
|
+
"polymarket",
|
|
19
|
+
"kalshi",
|
|
20
|
+
"hyperliquid",
|
|
21
|
+
"binance",
|
|
22
|
+
"chainlink",
|
|
23
|
+
"trading",
|
|
24
|
+
"quant",
|
|
25
|
+
"data",
|
|
26
|
+
"api"
|
|
27
|
+
],
|
|
28
|
+
"author": {
|
|
29
|
+
"name": "Kwery",
|
|
30
|
+
"url": "https://kwery.xyz"
|
|
31
|
+
},
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"homepage": "https://kwery.xyz/docs/cli",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/KweryAPI/kwery-agents.git",
|
|
37
|
+
"directory": "kwery-cli"
|
|
38
|
+
},
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/KweryAPI/kwery-agents/issues"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=20"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"commander": "^12.0.0",
|
|
47
|
+
"chalk": "^5.3.0",
|
|
48
|
+
"ora": "^8.0.0",
|
|
49
|
+
"cli-table3": "^0.6.3",
|
|
50
|
+
"conf": "^12.0.0",
|
|
51
|
+
"papaparse": "^5.4.0",
|
|
52
|
+
"zod": "^3.22.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"typescript": "^5.4.0",
|
|
56
|
+
"@types/node": "^20.0.0",
|
|
57
|
+
"@types/papaparse": "^5.3.0",
|
|
58
|
+
"vitest": "^1.6.0",
|
|
59
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
60
|
+
"msw": "^2.3.0",
|
|
61
|
+
"dotenv": "^16.0.0"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "tsc && chmod +x dist/index.js",
|
|
65
|
+
"dev": "tsc --watch",
|
|
66
|
+
"typecheck": "tsc --noEmit",
|
|
67
|
+
"clean": "rm -rf dist",
|
|
68
|
+
"test": "vitest run",
|
|
69
|
+
"test:watch": "vitest",
|
|
70
|
+
"test:coverage": "vitest run --coverage"
|
|
71
|
+
}
|
|
72
|
+
}
|