@gbozee/ultimate 0.0.2-next.51 → 0.0.2-next.52
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/index.cjs +48 -0
- package/dist/index.js +48 -0
- package/dist/mcp-server.cjs +48 -0
- package/dist/mcp-server.js +48 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -65760,6 +65760,51 @@ async function getCurrentPrice(client, symbol) {
|
|
|
65760
65760
|
});
|
|
65761
65761
|
return response.price;
|
|
65762
65762
|
}
|
|
65763
|
+
async function getLastUserTrade(client, symbol) {
|
|
65764
|
+
try {
|
|
65765
|
+
const response = await client.getAccountTrades({
|
|
65766
|
+
symbol
|
|
65767
|
+
});
|
|
65768
|
+
if (!response || response.length === 0) {
|
|
65769
|
+
return { long: null, short: null };
|
|
65770
|
+
}
|
|
65771
|
+
const longTrades = response.filter((trade) => {
|
|
65772
|
+
const positionSide = trade.positionSide?.toUpperCase();
|
|
65773
|
+
const side = trade.side?.toUpperCase();
|
|
65774
|
+
return positionSide === "LONG" && side === "SELL";
|
|
65775
|
+
});
|
|
65776
|
+
const shortTrades = response.filter((trade) => {
|
|
65777
|
+
const positionSide = trade.positionSide?.toUpperCase();
|
|
65778
|
+
const side = trade.side?.toUpperCase();
|
|
65779
|
+
return positionSide === "SHORT" && side === "BUY";
|
|
65780
|
+
});
|
|
65781
|
+
const formatTrade = (trade) => ({
|
|
65782
|
+
id: trade.id,
|
|
65783
|
+
orderId: trade.orderId,
|
|
65784
|
+
symbol: trade.symbol,
|
|
65785
|
+
price: parseFloat(trade.price),
|
|
65786
|
+
quantity: parseFloat(trade.qty),
|
|
65787
|
+
quoteQty: parseFloat(trade.quoteQty),
|
|
65788
|
+
commission: parseFloat(trade.commission),
|
|
65789
|
+
commissionAsset: trade.commissionAsset,
|
|
65790
|
+
realizedPnl: parseFloat(trade.realizedPnl || "0"),
|
|
65791
|
+
side: trade.side,
|
|
65792
|
+
positionSide: trade.positionSide,
|
|
65793
|
+
time: trade.time,
|
|
65794
|
+
buyer: trade.buyer,
|
|
65795
|
+
maker: trade.maker
|
|
65796
|
+
});
|
|
65797
|
+
const lastLongTrade = longTrades.length > 0 ? longTrades.sort((a, b) => b.time - a.time)[0] : null;
|
|
65798
|
+
const lastShortTrade = shortTrades.length > 0 ? shortTrades.sort((a, b) => b.time - a.time)[0] : null;
|
|
65799
|
+
return {
|
|
65800
|
+
long: lastLongTrade ? formatTrade(lastLongTrade) : null,
|
|
65801
|
+
short: lastShortTrade ? formatTrade(lastShortTrade) : null
|
|
65802
|
+
};
|
|
65803
|
+
} catch (error) {
|
|
65804
|
+
console.error(`Error fetching last user trades for ${symbol}:`, error);
|
|
65805
|
+
return { long: null, short: null };
|
|
65806
|
+
}
|
|
65807
|
+
}
|
|
65763
65808
|
async function analyzeCharts(params) {
|
|
65764
65809
|
const {
|
|
65765
65810
|
client,
|
|
@@ -66316,6 +66361,9 @@ class BinanceExchange extends BaseExchange {
|
|
|
66316
66361
|
}
|
|
66317
66362
|
return await getMarginOpenOrders(this.main_client, symbol, isIsolated);
|
|
66318
66363
|
}
|
|
66364
|
+
async getLastUserTrade(payload) {
|
|
66365
|
+
return await getLastUserTrade(this.client, payload.symbol);
|
|
66366
|
+
}
|
|
66319
66367
|
}
|
|
66320
66368
|
function getPricePlaces(target) {
|
|
66321
66369
|
const numStr = target.toString();
|
package/dist/index.js
CHANGED
|
@@ -65672,6 +65672,51 @@ async function getCurrentPrice(client, symbol) {
|
|
|
65672
65672
|
});
|
|
65673
65673
|
return response.price;
|
|
65674
65674
|
}
|
|
65675
|
+
async function getLastUserTrade(client, symbol) {
|
|
65676
|
+
try {
|
|
65677
|
+
const response = await client.getAccountTrades({
|
|
65678
|
+
symbol
|
|
65679
|
+
});
|
|
65680
|
+
if (!response || response.length === 0) {
|
|
65681
|
+
return { long: null, short: null };
|
|
65682
|
+
}
|
|
65683
|
+
const longTrades = response.filter((trade) => {
|
|
65684
|
+
const positionSide = trade.positionSide?.toUpperCase();
|
|
65685
|
+
const side = trade.side?.toUpperCase();
|
|
65686
|
+
return positionSide === "LONG" && side === "SELL";
|
|
65687
|
+
});
|
|
65688
|
+
const shortTrades = response.filter((trade) => {
|
|
65689
|
+
const positionSide = trade.positionSide?.toUpperCase();
|
|
65690
|
+
const side = trade.side?.toUpperCase();
|
|
65691
|
+
return positionSide === "SHORT" && side === "BUY";
|
|
65692
|
+
});
|
|
65693
|
+
const formatTrade = (trade) => ({
|
|
65694
|
+
id: trade.id,
|
|
65695
|
+
orderId: trade.orderId,
|
|
65696
|
+
symbol: trade.symbol,
|
|
65697
|
+
price: parseFloat(trade.price),
|
|
65698
|
+
quantity: parseFloat(trade.qty),
|
|
65699
|
+
quoteQty: parseFloat(trade.quoteQty),
|
|
65700
|
+
commission: parseFloat(trade.commission),
|
|
65701
|
+
commissionAsset: trade.commissionAsset,
|
|
65702
|
+
realizedPnl: parseFloat(trade.realizedPnl || "0"),
|
|
65703
|
+
side: trade.side,
|
|
65704
|
+
positionSide: trade.positionSide,
|
|
65705
|
+
time: trade.time,
|
|
65706
|
+
buyer: trade.buyer,
|
|
65707
|
+
maker: trade.maker
|
|
65708
|
+
});
|
|
65709
|
+
const lastLongTrade = longTrades.length > 0 ? longTrades.sort((a, b) => b.time - a.time)[0] : null;
|
|
65710
|
+
const lastShortTrade = shortTrades.length > 0 ? shortTrades.sort((a, b) => b.time - a.time)[0] : null;
|
|
65711
|
+
return {
|
|
65712
|
+
long: lastLongTrade ? formatTrade(lastLongTrade) : null,
|
|
65713
|
+
short: lastShortTrade ? formatTrade(lastShortTrade) : null
|
|
65714
|
+
};
|
|
65715
|
+
} catch (error) {
|
|
65716
|
+
console.error(`Error fetching last user trades for ${symbol}:`, error);
|
|
65717
|
+
return { long: null, short: null };
|
|
65718
|
+
}
|
|
65719
|
+
}
|
|
65675
65720
|
async function analyzeCharts(params) {
|
|
65676
65721
|
const {
|
|
65677
65722
|
client,
|
|
@@ -66228,6 +66273,9 @@ class BinanceExchange extends BaseExchange {
|
|
|
66228
66273
|
}
|
|
66229
66274
|
return await getMarginOpenOrders(this.main_client, symbol, isIsolated);
|
|
66230
66275
|
}
|
|
66276
|
+
async getLastUserTrade(payload) {
|
|
66277
|
+
return await getLastUserTrade(this.client, payload.symbol);
|
|
66278
|
+
}
|
|
66231
66279
|
}
|
|
66232
66280
|
function getPricePlaces(target) {
|
|
66233
66281
|
const numStr = target.toString();
|
package/dist/mcp-server.cjs
CHANGED
|
@@ -69482,6 +69482,51 @@ async function getCurrentPrice(client, symbol) {
|
|
|
69482
69482
|
});
|
|
69483
69483
|
return response.price;
|
|
69484
69484
|
}
|
|
69485
|
+
async function getLastUserTrade(client, symbol) {
|
|
69486
|
+
try {
|
|
69487
|
+
const response = await client.getAccountTrades({
|
|
69488
|
+
symbol
|
|
69489
|
+
});
|
|
69490
|
+
if (!response || response.length === 0) {
|
|
69491
|
+
return { long: null, short: null };
|
|
69492
|
+
}
|
|
69493
|
+
const longTrades = response.filter((trade) => {
|
|
69494
|
+
const positionSide = trade.positionSide?.toUpperCase();
|
|
69495
|
+
const side = trade.side?.toUpperCase();
|
|
69496
|
+
return positionSide === "LONG" && side === "SELL";
|
|
69497
|
+
});
|
|
69498
|
+
const shortTrades = response.filter((trade) => {
|
|
69499
|
+
const positionSide = trade.positionSide?.toUpperCase();
|
|
69500
|
+
const side = trade.side?.toUpperCase();
|
|
69501
|
+
return positionSide === "SHORT" && side === "BUY";
|
|
69502
|
+
});
|
|
69503
|
+
const formatTrade = (trade) => ({
|
|
69504
|
+
id: trade.id,
|
|
69505
|
+
orderId: trade.orderId,
|
|
69506
|
+
symbol: trade.symbol,
|
|
69507
|
+
price: parseFloat(trade.price),
|
|
69508
|
+
quantity: parseFloat(trade.qty),
|
|
69509
|
+
quoteQty: parseFloat(trade.quoteQty),
|
|
69510
|
+
commission: parseFloat(trade.commission),
|
|
69511
|
+
commissionAsset: trade.commissionAsset,
|
|
69512
|
+
realizedPnl: parseFloat(trade.realizedPnl || "0"),
|
|
69513
|
+
side: trade.side,
|
|
69514
|
+
positionSide: trade.positionSide,
|
|
69515
|
+
time: trade.time,
|
|
69516
|
+
buyer: trade.buyer,
|
|
69517
|
+
maker: trade.maker
|
|
69518
|
+
});
|
|
69519
|
+
const lastLongTrade = longTrades.length > 0 ? longTrades.sort((a, b) => b.time - a.time)[0] : null;
|
|
69520
|
+
const lastShortTrade = shortTrades.length > 0 ? shortTrades.sort((a, b) => b.time - a.time)[0] : null;
|
|
69521
|
+
return {
|
|
69522
|
+
long: lastLongTrade ? formatTrade(lastLongTrade) : null,
|
|
69523
|
+
short: lastShortTrade ? formatTrade(lastShortTrade) : null
|
|
69524
|
+
};
|
|
69525
|
+
} catch (error) {
|
|
69526
|
+
console.error(`Error fetching last user trades for ${symbol}:`, error);
|
|
69527
|
+
return { long: null, short: null };
|
|
69528
|
+
}
|
|
69529
|
+
}
|
|
69485
69530
|
async function analyzeCharts(params) {
|
|
69486
69531
|
const {
|
|
69487
69532
|
client,
|
|
@@ -70038,6 +70083,9 @@ class BinanceExchange extends BaseExchange {
|
|
|
70038
70083
|
}
|
|
70039
70084
|
return await getMarginOpenOrders(this.main_client, symbol, isIsolated);
|
|
70040
70085
|
}
|
|
70086
|
+
async getLastUserTrade(payload) {
|
|
70087
|
+
return await getLastUserTrade(this.client, payload.symbol);
|
|
70088
|
+
}
|
|
70041
70089
|
}
|
|
70042
70090
|
function getPricePlaces(target) {
|
|
70043
70091
|
const numStr = target.toString();
|
package/dist/mcp-server.js
CHANGED
|
@@ -69455,6 +69455,51 @@ async function getCurrentPrice(client, symbol) {
|
|
|
69455
69455
|
});
|
|
69456
69456
|
return response.price;
|
|
69457
69457
|
}
|
|
69458
|
+
async function getLastUserTrade(client, symbol) {
|
|
69459
|
+
try {
|
|
69460
|
+
const response = await client.getAccountTrades({
|
|
69461
|
+
symbol
|
|
69462
|
+
});
|
|
69463
|
+
if (!response || response.length === 0) {
|
|
69464
|
+
return { long: null, short: null };
|
|
69465
|
+
}
|
|
69466
|
+
const longTrades = response.filter((trade) => {
|
|
69467
|
+
const positionSide = trade.positionSide?.toUpperCase();
|
|
69468
|
+
const side = trade.side?.toUpperCase();
|
|
69469
|
+
return positionSide === "LONG" && side === "SELL";
|
|
69470
|
+
});
|
|
69471
|
+
const shortTrades = response.filter((trade) => {
|
|
69472
|
+
const positionSide = trade.positionSide?.toUpperCase();
|
|
69473
|
+
const side = trade.side?.toUpperCase();
|
|
69474
|
+
return positionSide === "SHORT" && side === "BUY";
|
|
69475
|
+
});
|
|
69476
|
+
const formatTrade = (trade) => ({
|
|
69477
|
+
id: trade.id,
|
|
69478
|
+
orderId: trade.orderId,
|
|
69479
|
+
symbol: trade.symbol,
|
|
69480
|
+
price: parseFloat(trade.price),
|
|
69481
|
+
quantity: parseFloat(trade.qty),
|
|
69482
|
+
quoteQty: parseFloat(trade.quoteQty),
|
|
69483
|
+
commission: parseFloat(trade.commission),
|
|
69484
|
+
commissionAsset: trade.commissionAsset,
|
|
69485
|
+
realizedPnl: parseFloat(trade.realizedPnl || "0"),
|
|
69486
|
+
side: trade.side,
|
|
69487
|
+
positionSide: trade.positionSide,
|
|
69488
|
+
time: trade.time,
|
|
69489
|
+
buyer: trade.buyer,
|
|
69490
|
+
maker: trade.maker
|
|
69491
|
+
});
|
|
69492
|
+
const lastLongTrade = longTrades.length > 0 ? longTrades.sort((a, b) => b.time - a.time)[0] : null;
|
|
69493
|
+
const lastShortTrade = shortTrades.length > 0 ? shortTrades.sort((a, b) => b.time - a.time)[0] : null;
|
|
69494
|
+
return {
|
|
69495
|
+
long: lastLongTrade ? formatTrade(lastLongTrade) : null,
|
|
69496
|
+
short: lastShortTrade ? formatTrade(lastShortTrade) : null
|
|
69497
|
+
};
|
|
69498
|
+
} catch (error) {
|
|
69499
|
+
console.error(`Error fetching last user trades for ${symbol}:`, error);
|
|
69500
|
+
return { long: null, short: null };
|
|
69501
|
+
}
|
|
69502
|
+
}
|
|
69458
69503
|
async function analyzeCharts(params) {
|
|
69459
69504
|
const {
|
|
69460
69505
|
client,
|
|
@@ -70011,6 +70056,9 @@ class BinanceExchange extends BaseExchange {
|
|
|
70011
70056
|
}
|
|
70012
70057
|
return await getMarginOpenOrders(this.main_client, symbol, isIsolated);
|
|
70013
70058
|
}
|
|
70059
|
+
async getLastUserTrade(payload) {
|
|
70060
|
+
return await getLastUserTrade(this.client, payload.symbol);
|
|
70061
|
+
}
|
|
70014
70062
|
}
|
|
70015
70063
|
function getPricePlaces(target) {
|
|
70016
70064
|
const numStr = target.toString();
|