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