omnitrade-mcp 0.9.1 → 0.9.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.
- package/dist/cli.js +22 -31
- package/dist/index.js +16 -16
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import { homedir } from "os";
|
|
|
13
13
|
import { join } from "path";
|
|
14
14
|
import * as readline from "readline";
|
|
15
15
|
import { spawn } from "child_process";
|
|
16
|
-
var VERSION = "0.9.
|
|
16
|
+
var VERSION = "0.9.3";
|
|
17
17
|
var CONFIG_PATH = join(homedir(), ".omnitrade", "config.json");
|
|
18
18
|
var c = {
|
|
19
19
|
reset: "\x1B[0m",
|
|
@@ -29,30 +29,21 @@ var c = {
|
|
|
29
29
|
orange: "\x1B[38;5;208m",
|
|
30
30
|
red: "\x1B[38;5;196m"
|
|
31
31
|
};
|
|
32
|
-
var W = 58;
|
|
33
|
-
function center(text, width) {
|
|
34
|
-
const visibleLength = text.replace(/\x1b\[[0-9;]*m/g, "").length;
|
|
35
|
-
const totalPadding = width - visibleLength;
|
|
36
|
-
const leftPad = Math.floor(totalPadding / 2);
|
|
37
|
-
const rightPad = totalPadding - leftPad;
|
|
38
|
-
return " ".repeat(Math.max(0, leftPad)) + text + " ".repeat(Math.max(0, rightPad));
|
|
39
|
-
}
|
|
40
32
|
function printBanner() {
|
|
41
|
-
const line = "-".repeat(W);
|
|
42
33
|
console.log(`
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
${c.
|
|
46
|
-
${c.
|
|
47
|
-
${c.
|
|
48
|
-
${c.
|
|
49
|
-
${c.
|
|
50
|
-
${c.
|
|
51
|
-
|
|
52
|
-
${
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
34
|
+
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
35
|
+
\u2551 \u2551
|
|
36
|
+
\u2551 ${c.purple}\u2588\u2588\u2588\u2588\u2588\u2588\u2557 ${c.reset}\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
37
|
+
\u2551 ${c.purple}\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557${c.reset}\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2551
|
|
38
|
+
\u2551 ${c.purple}\u2588\u2588\u2551 \u2588\u2588\u2551${c.reset}\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
39
|
+
\u2551 ${c.purple}\u2588\u2588\u2551 \u2588\u2588\u2551${c.reset}\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2551
|
|
40
|
+
\u2551 ${c.purple}\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D${c.reset}\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
41
|
+
\u2551 ${c.purple}\u255A\u2550\u2550\u2550\u2550\u2550\u255D ${c.reset}\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u2551
|
|
42
|
+
\u2551 \u2551
|
|
43
|
+
\u2551 v${VERSION} \u2022 One AI. 107 Exchanges. Natural language trading. \u2551
|
|
44
|
+
\u2551 by Connectry Labs \u2022 https://connectry.io \u2551
|
|
45
|
+
\u2551 \u2551
|
|
46
|
+
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
56
47
|
`);
|
|
57
48
|
}
|
|
58
49
|
function printCompactLogo() {
|
|
@@ -869,7 +860,7 @@ async function watchPrices(symbols) {
|
|
|
869
860
|
exchange = new ExchangeClass({ enableRateLimit: true });
|
|
870
861
|
const prevPrices = /* @__PURE__ */ new Map();
|
|
871
862
|
const POLL_INTERVAL = 5e3;
|
|
872
|
-
const
|
|
863
|
+
const W = 56;
|
|
873
864
|
const pad = (s, n) => {
|
|
874
865
|
const visible = s.replace(/\x1b\[[0-9;]*m/g, "").length;
|
|
875
866
|
return s + " ".repeat(Math.max(0, n - visible));
|
|
@@ -882,21 +873,21 @@ async function watchPrices(symbols) {
|
|
|
882
873
|
};
|
|
883
874
|
const render = (prices) => {
|
|
884
875
|
const now = (/* @__PURE__ */ new Date()).toLocaleTimeString();
|
|
885
|
-
const line = "\u2500".repeat(
|
|
886
|
-
const hline = "\u2550".repeat(
|
|
876
|
+
const line = "\u2500".repeat(W);
|
|
877
|
+
const hline = "\u2550".repeat(W);
|
|
887
878
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
888
879
|
console.log(` ${c.cyan}\u2554${hline}\u2557${c.reset}`);
|
|
889
|
-
console.log(` ${c.cyan}\u2551${c.reset}${pad(` ${c.white}${c.bold}OmniTrade Watch${c.reset} ${c.dim}\u2022 ${exchangeName} \u2022 ${now}${c.reset}`,
|
|
880
|
+
console.log(` ${c.cyan}\u2551${c.reset}${pad(` ${c.white}${c.bold}OmniTrade Watch${c.reset} ${c.dim}\u2022 ${exchangeName} \u2022 ${now}${c.reset}`, W)}${c.cyan}\u2551${c.reset}`);
|
|
890
881
|
console.log(` ${c.cyan}\u2560${hline}\u2563${c.reset}`);
|
|
891
882
|
if (prices.size === 0) {
|
|
892
|
-
console.log(` ${c.cyan}\u2551${c.reset} ${c.yellow}Loading prices...${c.reset}${" ".repeat(
|
|
883
|
+
console.log(` ${c.cyan}\u2551${c.reset} ${c.yellow}Loading prices...${c.reset}${" ".repeat(W - 19)}${c.cyan}\u2551${c.reset}`);
|
|
893
884
|
} else {
|
|
894
885
|
for (const [symbol, data] of prices.entries()) {
|
|
895
886
|
if (data.error) {
|
|
896
887
|
const errLabel = "\u26A0 INVALID".padStart(12);
|
|
897
888
|
const errDetail = "symbol not found on exchange";
|
|
898
889
|
const rowVisible2 = ` ${symbol.padEnd(12)} ${errLabel} \xD7 ${errDetail} `;
|
|
899
|
-
const padding2 = " ".repeat(Math.max(0,
|
|
890
|
+
const padding2 = " ".repeat(Math.max(0, W - rowVisible2.length + 2));
|
|
900
891
|
console.log(
|
|
901
892
|
` ${c.cyan}\u2551${c.reset} ${c.red}${symbol.padEnd(12)}${c.reset} ${c.red}${errLabel}${c.reset} ${c.red}\xD7 ${errDetail}${c.reset}${padding2}${c.cyan}\u2551${c.reset}`
|
|
902
893
|
);
|
|
@@ -909,14 +900,14 @@ async function watchPrices(symbols) {
|
|
|
909
900
|
const priceFormatted = formatPrice(data.last).padStart(12);
|
|
910
901
|
const changeFormatted = data.change !== 0 ? `${isUp ? "+" : ""}${data.change.toFixed(data.last >= 100 ? 2 : 6)} (${isUp ? "+" : ""}${data.changePct.toFixed(2)}%)` : "no change";
|
|
911
902
|
const rowVisible = ` ${symbol.padEnd(12)} ${priceFormatted} _ ${changeFormatted} `;
|
|
912
|
-
const padding = " ".repeat(Math.max(0,
|
|
903
|
+
const padding = " ".repeat(Math.max(0, W - rowVisible.length + 2));
|
|
913
904
|
console.log(
|
|
914
905
|
` ${c.cyan}\u2551${c.reset} ${c.white}${symbol.padEnd(12)}${c.reset} ${priceColor}${priceFormatted}${c.reset} ${arrow} ${priceColor}${changeFormatted}${c.reset}${padding}${c.cyan}\u2551${c.reset}`
|
|
915
906
|
);
|
|
916
907
|
}
|
|
917
908
|
}
|
|
918
909
|
console.log(` ${c.cyan}\u2560${hline}\u2563${c.reset}`);
|
|
919
|
-
console.log(` ${c.cyan}\u2551${c.reset} ${c.dim}Ctrl+C to stop \u2022 Updates every ${POLL_INTERVAL / 1e3}s${c.reset}${" ".repeat(
|
|
910
|
+
console.log(` ${c.cyan}\u2551${c.reset} ${c.dim}Ctrl+C to stop \u2022 Updates every ${POLL_INTERVAL / 1e3}s${c.reset}${" ".repeat(W - 38)}${c.cyan}\u2551${c.reset}`);
|
|
920
911
|
console.log(` ${c.cyan}\u255A${hline}\u255D${c.reset}`);
|
|
921
912
|
};
|
|
922
913
|
render(/* @__PURE__ */ new Map());
|
package/dist/index.js
CHANGED
|
@@ -3015,24 +3015,24 @@ function registerConditionalOrderTools(server, exchangeManager, config) {
|
|
|
3015
3015
|
}
|
|
3016
3016
|
|
|
3017
3017
|
// src/index.ts
|
|
3018
|
-
var VERSION = "0.
|
|
3018
|
+
var VERSION = "0.9.3";
|
|
3019
3019
|
function showBanner() {
|
|
3020
|
+
const purple = "\x1B[35m";
|
|
3021
|
+
const reset = "\x1B[0m";
|
|
3020
3022
|
console.error(`
|
|
3021
|
-
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
3022
|
-
\u2551
|
|
3023
|
-
\u2551
|
|
3024
|
-
\u2551 \u2588\u2588\u2554\u2550\u2550\
|
|
3025
|
-
\u2551 \u2588\u2588\u2551
|
|
3026
|
-
\u2551 \u2588\u2588\u2551
|
|
3027
|
-
\u2551 \
|
|
3028
|
-
\u2551
|
|
3029
|
-
\u2551
|
|
3030
|
-
\u2551 MCP Server v${VERSION}
|
|
3031
|
-
\u2551
|
|
3032
|
-
\u2551
|
|
3033
|
-
\
|
|
3034
|
-
\u2551 \u2551
|
|
3035
|
-
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
3023
|
+
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
3024
|
+
\u2551 \u2551
|
|
3025
|
+
\u2551 ${purple}\u2588\u2588\u2588\u2588\u2588\u2588\u2557 ${reset}\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
3026
|
+
\u2551 ${purple}\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557${reset}\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2551
|
|
3027
|
+
\u2551 ${purple}\u2588\u2588\u2551 \u2588\u2588\u2551${reset}\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
3028
|
+
\u2551 ${purple}\u2588\u2588\u2551 \u2588\u2588\u2551${reset}\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2551
|
|
3029
|
+
\u2551 ${purple}\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D${reset}\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
3030
|
+
\u2551 ${purple}\u255A\u2550\u2550\u2550\u2550\u2550\u255D ${reset}\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u2551
|
|
3031
|
+
\u2551 \u2551
|
|
3032
|
+
\u2551 MCP Server v${VERSION} \u2022 One AI. 107 Exchanges. Natural language trading. \u2551
|
|
3033
|
+
\u2551 by Connectry Labs \u2022 https://connectry.io \u2551
|
|
3034
|
+
\u2551 \u2551
|
|
3035
|
+
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
3036
3036
|
`);
|
|
3037
3037
|
}
|
|
3038
3038
|
async function main() {
|