@gbozee/ultimate 0.0.2-next.71 → 0.0.2-next.72
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 +26 -6
- package/dist/index.d.ts +9 -0
- package/dist/index.js +26 -6
- package/dist/mcp-server.cjs +26 -6
- package/dist/mcp-server.js +26 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -72036,14 +72036,13 @@ class BaseExchange {
|
|
|
72036
72036
|
}
|
|
72037
72037
|
}
|
|
72038
72038
|
async placeSpotLimitOrders(_payload) {}
|
|
72039
|
-
async
|
|
72039
|
+
async buildCumulative(payload) {
|
|
72040
72040
|
const {
|
|
72041
72041
|
orders,
|
|
72042
72042
|
kind,
|
|
72043
72043
|
decimal_places = "%.3f",
|
|
72044
|
-
price_places = "%.1f",
|
|
72045
72044
|
symbol,
|
|
72046
|
-
|
|
72045
|
+
is_stop = false
|
|
72047
72046
|
} = payload;
|
|
72048
72047
|
const totalQuantity = orders.reduce((sum, order) => sum + (order.quantity || 0), 0);
|
|
72049
72048
|
let runningTotal = to_f(totalQuantity, decimal_places);
|
|
@@ -72051,6 +72050,9 @@ class BaseExchange {
|
|
|
72051
72050
|
if (kind === "short") {
|
|
72052
72051
|
sortedOrders.reverse();
|
|
72053
72052
|
}
|
|
72053
|
+
if (is_stop) {
|
|
72054
|
+
sortedOrders.reverse();
|
|
72055
|
+
}
|
|
72054
72056
|
const withCumulative = [];
|
|
72055
72057
|
for (const order of sortedOrders) {
|
|
72056
72058
|
withCumulative.push({
|
|
@@ -72073,6 +72075,17 @@ class BaseExchange {
|
|
|
72073
72075
|
kind,
|
|
72074
72076
|
side: kind.toLowerCase() === "long" ? "buy" : "sell"
|
|
72075
72077
|
}));
|
|
72078
|
+
return filteredOrders;
|
|
72079
|
+
}
|
|
72080
|
+
async bulkPlaceLimitOrders(payload) {
|
|
72081
|
+
const {
|
|
72082
|
+
kind,
|
|
72083
|
+
decimal_places = "%.3f",
|
|
72084
|
+
price_places = "%.1f",
|
|
72085
|
+
symbol,
|
|
72086
|
+
place = false
|
|
72087
|
+
} = payload;
|
|
72088
|
+
const filteredOrders = await this.buildCumulative(payload);
|
|
72076
72089
|
if (filteredOrders.length > 0 && place) {
|
|
72077
72090
|
await this.cancelAllOrders(symbol, {
|
|
72078
72091
|
type: "limit",
|
|
@@ -72217,9 +72230,13 @@ class BaseExchange {
|
|
|
72217
72230
|
});
|
|
72218
72231
|
}
|
|
72219
72232
|
async entryStopLimitOrders(payload) {
|
|
72220
|
-
const { symbol, kind,
|
|
72233
|
+
const { symbol, kind, price_places, decimal_places, place } = payload;
|
|
72234
|
+
const cummulative = await this.buildCumulative({
|
|
72235
|
+
...payload,
|
|
72236
|
+
is_stop: true
|
|
72237
|
+
});
|
|
72221
72238
|
const price = await this.get_current_price(symbol);
|
|
72222
|
-
const orders_to_place =
|
|
72239
|
+
const orders_to_place = cummulative.map((order) => {
|
|
72223
72240
|
const { entry } = order;
|
|
72224
72241
|
let spread = 0.005;
|
|
72225
72242
|
if (price < 5000) {
|
|
@@ -72237,7 +72254,10 @@ class BaseExchange {
|
|
|
72237
72254
|
is_market: false
|
|
72238
72255
|
};
|
|
72239
72256
|
});
|
|
72240
|
-
if (place) {
|
|
72257
|
+
if (place && orders_to_place.length > 0) {
|
|
72258
|
+
await this.cancelAllOrders(symbol, {
|
|
72259
|
+
kind
|
|
72260
|
+
});
|
|
72241
72261
|
return this._createLimitPurchaseOrders({
|
|
72242
72262
|
symbol,
|
|
72243
72263
|
price_places,
|
package/dist/index.d.ts
CHANGED
|
@@ -373,6 +373,15 @@ declare abstract class BaseExchange {
|
|
|
373
373
|
cancel?: boolean;
|
|
374
374
|
}): Promise<any>;
|
|
375
375
|
placeSpotLimitOrders(_payload: any): Promise<void>;
|
|
376
|
+
buildCumulative(payload: {
|
|
377
|
+
orders: Order$1[];
|
|
378
|
+
kind: "long" | "short";
|
|
379
|
+
decimal_places?: string;
|
|
380
|
+
price_places?: string;
|
|
381
|
+
symbol: string;
|
|
382
|
+
place?: boolean;
|
|
383
|
+
is_stop?: boolean;
|
|
384
|
+
}): Promise<any[]>;
|
|
376
385
|
bulkPlaceLimitOrders(payload: {
|
|
377
386
|
orders: Order$1[];
|
|
378
387
|
kind: "long" | "short";
|
package/dist/index.js
CHANGED
|
@@ -71934,14 +71934,13 @@ class BaseExchange {
|
|
|
71934
71934
|
}
|
|
71935
71935
|
}
|
|
71936
71936
|
async placeSpotLimitOrders(_payload) {}
|
|
71937
|
-
async
|
|
71937
|
+
async buildCumulative(payload) {
|
|
71938
71938
|
const {
|
|
71939
71939
|
orders,
|
|
71940
71940
|
kind,
|
|
71941
71941
|
decimal_places = "%.3f",
|
|
71942
|
-
price_places = "%.1f",
|
|
71943
71942
|
symbol,
|
|
71944
|
-
|
|
71943
|
+
is_stop = false
|
|
71945
71944
|
} = payload;
|
|
71946
71945
|
const totalQuantity = orders.reduce((sum, order) => sum + (order.quantity || 0), 0);
|
|
71947
71946
|
let runningTotal = to_f(totalQuantity, decimal_places);
|
|
@@ -71949,6 +71948,9 @@ class BaseExchange {
|
|
|
71949
71948
|
if (kind === "short") {
|
|
71950
71949
|
sortedOrders.reverse();
|
|
71951
71950
|
}
|
|
71951
|
+
if (is_stop) {
|
|
71952
|
+
sortedOrders.reverse();
|
|
71953
|
+
}
|
|
71952
71954
|
const withCumulative = [];
|
|
71953
71955
|
for (const order of sortedOrders) {
|
|
71954
71956
|
withCumulative.push({
|
|
@@ -71971,6 +71973,17 @@ class BaseExchange {
|
|
|
71971
71973
|
kind,
|
|
71972
71974
|
side: kind.toLowerCase() === "long" ? "buy" : "sell"
|
|
71973
71975
|
}));
|
|
71976
|
+
return filteredOrders;
|
|
71977
|
+
}
|
|
71978
|
+
async bulkPlaceLimitOrders(payload) {
|
|
71979
|
+
const {
|
|
71980
|
+
kind,
|
|
71981
|
+
decimal_places = "%.3f",
|
|
71982
|
+
price_places = "%.1f",
|
|
71983
|
+
symbol,
|
|
71984
|
+
place = false
|
|
71985
|
+
} = payload;
|
|
71986
|
+
const filteredOrders = await this.buildCumulative(payload);
|
|
71974
71987
|
if (filteredOrders.length > 0 && place) {
|
|
71975
71988
|
await this.cancelAllOrders(symbol, {
|
|
71976
71989
|
type: "limit",
|
|
@@ -72115,9 +72128,13 @@ class BaseExchange {
|
|
|
72115
72128
|
});
|
|
72116
72129
|
}
|
|
72117
72130
|
async entryStopLimitOrders(payload) {
|
|
72118
|
-
const { symbol, kind,
|
|
72131
|
+
const { symbol, kind, price_places, decimal_places, place } = payload;
|
|
72132
|
+
const cummulative = await this.buildCumulative({
|
|
72133
|
+
...payload,
|
|
72134
|
+
is_stop: true
|
|
72135
|
+
});
|
|
72119
72136
|
const price = await this.get_current_price(symbol);
|
|
72120
|
-
const orders_to_place =
|
|
72137
|
+
const orders_to_place = cummulative.map((order) => {
|
|
72121
72138
|
const { entry } = order;
|
|
72122
72139
|
let spread = 0.005;
|
|
72123
72140
|
if (price < 5000) {
|
|
@@ -72135,7 +72152,10 @@ class BaseExchange {
|
|
|
72135
72152
|
is_market: false
|
|
72136
72153
|
};
|
|
72137
72154
|
});
|
|
72138
|
-
if (place) {
|
|
72155
|
+
if (place && orders_to_place.length > 0) {
|
|
72156
|
+
await this.cancelAllOrders(symbol, {
|
|
72157
|
+
kind
|
|
72158
|
+
});
|
|
72139
72159
|
return this._createLimitPurchaseOrders({
|
|
72140
72160
|
symbol,
|
|
72141
72161
|
price_places,
|
package/dist/mcp-server.cjs
CHANGED
|
@@ -75758,14 +75758,13 @@ class BaseExchange {
|
|
|
75758
75758
|
}
|
|
75759
75759
|
}
|
|
75760
75760
|
async placeSpotLimitOrders(_payload) {}
|
|
75761
|
-
async
|
|
75761
|
+
async buildCumulative(payload) {
|
|
75762
75762
|
const {
|
|
75763
75763
|
orders,
|
|
75764
75764
|
kind,
|
|
75765
75765
|
decimal_places = "%.3f",
|
|
75766
|
-
price_places = "%.1f",
|
|
75767
75766
|
symbol,
|
|
75768
|
-
|
|
75767
|
+
is_stop = false
|
|
75769
75768
|
} = payload;
|
|
75770
75769
|
const totalQuantity = orders.reduce((sum, order) => sum + (order.quantity || 0), 0);
|
|
75771
75770
|
let runningTotal = to_f(totalQuantity, decimal_places);
|
|
@@ -75773,6 +75772,9 @@ class BaseExchange {
|
|
|
75773
75772
|
if (kind === "short") {
|
|
75774
75773
|
sortedOrders.reverse();
|
|
75775
75774
|
}
|
|
75775
|
+
if (is_stop) {
|
|
75776
|
+
sortedOrders.reverse();
|
|
75777
|
+
}
|
|
75776
75778
|
const withCumulative = [];
|
|
75777
75779
|
for (const order of sortedOrders) {
|
|
75778
75780
|
withCumulative.push({
|
|
@@ -75795,6 +75797,17 @@ class BaseExchange {
|
|
|
75795
75797
|
kind,
|
|
75796
75798
|
side: kind.toLowerCase() === "long" ? "buy" : "sell"
|
|
75797
75799
|
}));
|
|
75800
|
+
return filteredOrders;
|
|
75801
|
+
}
|
|
75802
|
+
async bulkPlaceLimitOrders(payload) {
|
|
75803
|
+
const {
|
|
75804
|
+
kind,
|
|
75805
|
+
decimal_places = "%.3f",
|
|
75806
|
+
price_places = "%.1f",
|
|
75807
|
+
symbol,
|
|
75808
|
+
place = false
|
|
75809
|
+
} = payload;
|
|
75810
|
+
const filteredOrders = await this.buildCumulative(payload);
|
|
75798
75811
|
if (filteredOrders.length > 0 && place) {
|
|
75799
75812
|
await this.cancelAllOrders(symbol, {
|
|
75800
75813
|
type: "limit",
|
|
@@ -75939,9 +75952,13 @@ class BaseExchange {
|
|
|
75939
75952
|
});
|
|
75940
75953
|
}
|
|
75941
75954
|
async entryStopLimitOrders(payload) {
|
|
75942
|
-
const { symbol, kind,
|
|
75955
|
+
const { symbol, kind, price_places, decimal_places, place } = payload;
|
|
75956
|
+
const cummulative = await this.buildCumulative({
|
|
75957
|
+
...payload,
|
|
75958
|
+
is_stop: true
|
|
75959
|
+
});
|
|
75943
75960
|
const price = await this.get_current_price(symbol);
|
|
75944
|
-
const orders_to_place =
|
|
75961
|
+
const orders_to_place = cummulative.map((order) => {
|
|
75945
75962
|
const { entry } = order;
|
|
75946
75963
|
let spread = 0.005;
|
|
75947
75964
|
if (price < 5000) {
|
|
@@ -75959,7 +75976,10 @@ class BaseExchange {
|
|
|
75959
75976
|
is_market: false
|
|
75960
75977
|
};
|
|
75961
75978
|
});
|
|
75962
|
-
if (place) {
|
|
75979
|
+
if (place && orders_to_place.length > 0) {
|
|
75980
|
+
await this.cancelAllOrders(symbol, {
|
|
75981
|
+
kind
|
|
75982
|
+
});
|
|
75963
75983
|
return this._createLimitPurchaseOrders({
|
|
75964
75984
|
symbol,
|
|
75965
75985
|
price_places,
|
package/dist/mcp-server.js
CHANGED
|
@@ -75717,14 +75717,13 @@ class BaseExchange {
|
|
|
75717
75717
|
}
|
|
75718
75718
|
}
|
|
75719
75719
|
async placeSpotLimitOrders(_payload) {}
|
|
75720
|
-
async
|
|
75720
|
+
async buildCumulative(payload) {
|
|
75721
75721
|
const {
|
|
75722
75722
|
orders,
|
|
75723
75723
|
kind,
|
|
75724
75724
|
decimal_places = "%.3f",
|
|
75725
|
-
price_places = "%.1f",
|
|
75726
75725
|
symbol,
|
|
75727
|
-
|
|
75726
|
+
is_stop = false
|
|
75728
75727
|
} = payload;
|
|
75729
75728
|
const totalQuantity = orders.reduce((sum, order) => sum + (order.quantity || 0), 0);
|
|
75730
75729
|
let runningTotal = to_f(totalQuantity, decimal_places);
|
|
@@ -75732,6 +75731,9 @@ class BaseExchange {
|
|
|
75732
75731
|
if (kind === "short") {
|
|
75733
75732
|
sortedOrders.reverse();
|
|
75734
75733
|
}
|
|
75734
|
+
if (is_stop) {
|
|
75735
|
+
sortedOrders.reverse();
|
|
75736
|
+
}
|
|
75735
75737
|
const withCumulative = [];
|
|
75736
75738
|
for (const order of sortedOrders) {
|
|
75737
75739
|
withCumulative.push({
|
|
@@ -75754,6 +75756,17 @@ class BaseExchange {
|
|
|
75754
75756
|
kind,
|
|
75755
75757
|
side: kind.toLowerCase() === "long" ? "buy" : "sell"
|
|
75756
75758
|
}));
|
|
75759
|
+
return filteredOrders;
|
|
75760
|
+
}
|
|
75761
|
+
async bulkPlaceLimitOrders(payload) {
|
|
75762
|
+
const {
|
|
75763
|
+
kind,
|
|
75764
|
+
decimal_places = "%.3f",
|
|
75765
|
+
price_places = "%.1f",
|
|
75766
|
+
symbol,
|
|
75767
|
+
place = false
|
|
75768
|
+
} = payload;
|
|
75769
|
+
const filteredOrders = await this.buildCumulative(payload);
|
|
75757
75770
|
if (filteredOrders.length > 0 && place) {
|
|
75758
75771
|
await this.cancelAllOrders(symbol, {
|
|
75759
75772
|
type: "limit",
|
|
@@ -75898,9 +75911,13 @@ class BaseExchange {
|
|
|
75898
75911
|
});
|
|
75899
75912
|
}
|
|
75900
75913
|
async entryStopLimitOrders(payload) {
|
|
75901
|
-
const { symbol, kind,
|
|
75914
|
+
const { symbol, kind, price_places, decimal_places, place } = payload;
|
|
75915
|
+
const cummulative = await this.buildCumulative({
|
|
75916
|
+
...payload,
|
|
75917
|
+
is_stop: true
|
|
75918
|
+
});
|
|
75902
75919
|
const price = await this.get_current_price(symbol);
|
|
75903
|
-
const orders_to_place =
|
|
75920
|
+
const orders_to_place = cummulative.map((order) => {
|
|
75904
75921
|
const { entry } = order;
|
|
75905
75922
|
let spread = 0.005;
|
|
75906
75923
|
if (price < 5000) {
|
|
@@ -75918,7 +75935,10 @@ class BaseExchange {
|
|
|
75918
75935
|
is_market: false
|
|
75919
75936
|
};
|
|
75920
75937
|
});
|
|
75921
|
-
if (place) {
|
|
75938
|
+
if (place && orders_to_place.length > 0) {
|
|
75939
|
+
await this.cancelAllOrders(symbol, {
|
|
75940
|
+
kind
|
|
75941
|
+
});
|
|
75922
75942
|
return this._createLimitPurchaseOrders({
|
|
75923
75943
|
symbol,
|
|
75924
75944
|
price_places,
|