omnitrade-mcp 0.7.3 → 0.7.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 +1 -1
- package/dist/index.js +32 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import { existsSync, mkdirSync, writeFileSync, readFileSync } from "fs";
|
|
|
5
5
|
import { homedir } from "os";
|
|
6
6
|
import { join } from "path";
|
|
7
7
|
import * as readline from "readline";
|
|
8
|
-
var VERSION = "0.7.
|
|
8
|
+
var VERSION = "0.7.4";
|
|
9
9
|
var CONFIG_PATH = join(homedir(), ".omnitrade", "config.json");
|
|
10
10
|
var c = {
|
|
11
11
|
reset: "\x1B[0m",
|
package/dist/index.js
CHANGED
|
@@ -317,28 +317,48 @@ function registerBalanceTools(server, exchangeManager) {
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
const priceCache = {};
|
|
320
|
-
const stablecoins = ["USDT", "USDC", "BUSD", "DAI", "USD", "TUSD", "USDP"];
|
|
320
|
+
const stablecoins = ["USDT", "USDC", "BUSD", "DAI", "USD", "TUSD", "USDP", "FDUSD"];
|
|
321
|
+
const majorCoins = [
|
|
322
|
+
"BTC",
|
|
323
|
+
"ETH",
|
|
324
|
+
"BNB",
|
|
325
|
+
"SOL",
|
|
326
|
+
"XRP",
|
|
327
|
+
"ADA",
|
|
328
|
+
"DOGE",
|
|
329
|
+
"DOT",
|
|
330
|
+
"MATIC",
|
|
331
|
+
"LINK",
|
|
332
|
+
"AVAX",
|
|
333
|
+
"ATOM",
|
|
334
|
+
"UNI",
|
|
335
|
+
"LTC",
|
|
336
|
+
"NEAR",
|
|
337
|
+
"APT",
|
|
338
|
+
"ARB",
|
|
339
|
+
"OP",
|
|
340
|
+
"FIL",
|
|
341
|
+
"INJ"
|
|
342
|
+
];
|
|
321
343
|
const priceExchange = exchangeManager.getAll().values().next().value;
|
|
344
|
+
const assetList = Object.keys(assetTotals);
|
|
345
|
+
const assetsToPrice = assetList.length > 50 ? assetList.filter((s) => majorCoins.includes(s.toUpperCase()) || stablecoins.includes(s.toUpperCase())) : assetList;
|
|
322
346
|
if (priceExchange) {
|
|
323
|
-
for (const symbol of
|
|
347
|
+
for (const symbol of assetsToPrice) {
|
|
324
348
|
if (stablecoins.includes(symbol.toUpperCase())) {
|
|
325
349
|
priceCache[symbol] = 1;
|
|
326
350
|
continue;
|
|
327
351
|
}
|
|
328
352
|
try {
|
|
329
|
-
const ticker = await
|
|
353
|
+
const ticker = await Promise.race([
|
|
354
|
+
priceExchange.fetchTicker(`${symbol}/USDT`),
|
|
355
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), 5e3))
|
|
356
|
+
]);
|
|
330
357
|
if (ticker.last) {
|
|
331
358
|
priceCache[symbol] = ticker.last;
|
|
332
359
|
}
|
|
333
360
|
} catch {
|
|
334
|
-
|
|
335
|
-
const ticker = await priceExchange.fetchTicker(`${symbol}/USD`);
|
|
336
|
-
if (ticker.last) {
|
|
337
|
-
priceCache[symbol] = ticker.last;
|
|
338
|
-
}
|
|
339
|
-
} catch {
|
|
340
|
-
priceCache[symbol] = 0;
|
|
341
|
-
}
|
|
361
|
+
priceCache[symbol] = 0;
|
|
342
362
|
}
|
|
343
363
|
}
|
|
344
364
|
}
|
|
@@ -956,7 +976,7 @@ function registerArbitrageTools(server, exchangeManager) {
|
|
|
956
976
|
}
|
|
957
977
|
|
|
958
978
|
// src/index.ts
|
|
959
|
-
var VERSION = "0.7.
|
|
979
|
+
var VERSION = "0.7.4";
|
|
960
980
|
function showBanner() {
|
|
961
981
|
console.error(`
|
|
962
982
|
\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
|