@gbozee/ultimate 0.0.2-75 → 0.0.2-76
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/frontend-index.d.ts +1 -0
- package/dist/index.cjs +45 -3
- package/dist/index.d.ts +38 -0
- package/dist/index.js +45 -3
- package/dist/mcp-server.cjs +45 -3
- package/dist/mcp-server.js +45 -3
- package/package.json +1 -1
package/dist/frontend-index.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -58001,10 +58001,50 @@ class ExchangeAccount {
|
|
|
58001
58001
|
}
|
|
58002
58002
|
return 0;
|
|
58003
58003
|
}
|
|
58004
|
+
async buildOppositeTrades(payload) {
|
|
58005
|
+
const { symbol, kind, place } = payload;
|
|
58006
|
+
const strategy = await this.runSimulation({
|
|
58007
|
+
symbol,
|
|
58008
|
+
kind,
|
|
58009
|
+
raw: true
|
|
58010
|
+
});
|
|
58011
|
+
const result = strategy.generateOppositeTrades({
|
|
58012
|
+
kind,
|
|
58013
|
+
avg_entry: strategy.position[kind].avg_price
|
|
58014
|
+
});
|
|
58015
|
+
if (place && result?.kind) {
|
|
58016
|
+
const config2 = await this.getPositionConfig({
|
|
58017
|
+
symbol,
|
|
58018
|
+
kind: result.kind
|
|
58019
|
+
});
|
|
58020
|
+
await this.app_db.updateScheduledTrade(config2.id, {
|
|
58021
|
+
entry: result.entry,
|
|
58022
|
+
stop: result.stop,
|
|
58023
|
+
risk: result.risk_per_trade,
|
|
58024
|
+
profit_percent: result.profit_percent,
|
|
58025
|
+
risk_reward: result.risk_reward
|
|
58026
|
+
});
|
|
58027
|
+
await this.placeTrade({
|
|
58028
|
+
symbol,
|
|
58029
|
+
kind: result.kind,
|
|
58030
|
+
place: true,
|
|
58031
|
+
ignore_config: true
|
|
58032
|
+
});
|
|
58033
|
+
await this.placeTrade({
|
|
58034
|
+
symbol,
|
|
58035
|
+
kind: result.kind,
|
|
58036
|
+
place: true,
|
|
58037
|
+
stop: true,
|
|
58038
|
+
ignore_config: true
|
|
58039
|
+
});
|
|
58040
|
+
}
|
|
58041
|
+
return result;
|
|
58042
|
+
}
|
|
58004
58043
|
async runSimulation(payload) {
|
|
58005
58044
|
const { symbol, kind, iterations = 2, raw = false } = payload;
|
|
58006
58045
|
const positions = await this.syncAccount({
|
|
58007
|
-
symbol
|
|
58046
|
+
symbol,
|
|
58047
|
+
as_view: true
|
|
58008
58048
|
});
|
|
58009
58049
|
const symbol_config = await this.recomputeSymbolConfig({
|
|
58010
58050
|
symbol
|
|
@@ -58038,11 +58078,13 @@ class ExchangeAccount {
|
|
|
58038
58078
|
const strategy = new Strategy({
|
|
58039
58079
|
long: {
|
|
58040
58080
|
entry: long_position.entry,
|
|
58041
|
-
quantity: long_position.quantity
|
|
58081
|
+
quantity: long_position.quantity,
|
|
58082
|
+
avg_price: long_position.avg_price
|
|
58042
58083
|
},
|
|
58043
58084
|
short: {
|
|
58044
58085
|
entry: short_position.entry,
|
|
58045
|
-
quantity: short_position.quantity
|
|
58086
|
+
quantity: short_position.quantity,
|
|
58087
|
+
avg_price: short_position.avg_price
|
|
58046
58088
|
},
|
|
58047
58089
|
config: strategy_config
|
|
58048
58090
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -527,6 +527,7 @@ export declare class AppDatabase {
|
|
|
527
527
|
export type StrategyPosition = {
|
|
528
528
|
entry: number;
|
|
529
529
|
quantity: number;
|
|
530
|
+
avg_price?: number;
|
|
530
531
|
};
|
|
531
532
|
export type GapCloserResult = {
|
|
532
533
|
avg_entry: number;
|
|
@@ -1493,6 +1494,43 @@ declare class ExchangeAccount$1 {
|
|
|
1493
1494
|
symbol: string;
|
|
1494
1495
|
kind: "long" | "short";
|
|
1495
1496
|
}): Promise<number>;
|
|
1497
|
+
buildOppositeTrades(payload: {
|
|
1498
|
+
symbol: string;
|
|
1499
|
+
kind: "long" | "short";
|
|
1500
|
+
place?: boolean;
|
|
1501
|
+
}): Promise<{
|
|
1502
|
+
avg: {
|
|
1503
|
+
entry: number;
|
|
1504
|
+
price: number;
|
|
1505
|
+
quantity: number;
|
|
1506
|
+
};
|
|
1507
|
+
loss: number;
|
|
1508
|
+
profit_percent: number;
|
|
1509
|
+
fee: number;
|
|
1510
|
+
risk_per_trade: number;
|
|
1511
|
+
risk_reward: number;
|
|
1512
|
+
symbol?: string;
|
|
1513
|
+
focus: number;
|
|
1514
|
+
budget: number;
|
|
1515
|
+
support: number;
|
|
1516
|
+
resistance: number;
|
|
1517
|
+
percent_change: number;
|
|
1518
|
+
tradeSplit?: number;
|
|
1519
|
+
take_profit?: number;
|
|
1520
|
+
kind: "long" | "short";
|
|
1521
|
+
entry: number;
|
|
1522
|
+
stop: number;
|
|
1523
|
+
min_size: number;
|
|
1524
|
+
price_places?: string;
|
|
1525
|
+
strategy?: "quantity" | "entry";
|
|
1526
|
+
as_array?: boolean;
|
|
1527
|
+
decimal_places?: string;
|
|
1528
|
+
min_profit?: number;
|
|
1529
|
+
raw?: boolean;
|
|
1530
|
+
gap?: number;
|
|
1531
|
+
rr?: number;
|
|
1532
|
+
max_size?: number;
|
|
1533
|
+
}>;
|
|
1496
1534
|
runSimulation(payload: {
|
|
1497
1535
|
symbol: string;
|
|
1498
1536
|
kind: "long" | "short";
|
package/dist/index.js
CHANGED
|
@@ -57956,10 +57956,50 @@ class ExchangeAccount {
|
|
|
57956
57956
|
}
|
|
57957
57957
|
return 0;
|
|
57958
57958
|
}
|
|
57959
|
+
async buildOppositeTrades(payload) {
|
|
57960
|
+
const { symbol, kind, place } = payload;
|
|
57961
|
+
const strategy = await this.runSimulation({
|
|
57962
|
+
symbol,
|
|
57963
|
+
kind,
|
|
57964
|
+
raw: true
|
|
57965
|
+
});
|
|
57966
|
+
const result = strategy.generateOppositeTrades({
|
|
57967
|
+
kind,
|
|
57968
|
+
avg_entry: strategy.position[kind].avg_price
|
|
57969
|
+
});
|
|
57970
|
+
if (place && result?.kind) {
|
|
57971
|
+
const config2 = await this.getPositionConfig({
|
|
57972
|
+
symbol,
|
|
57973
|
+
kind: result.kind
|
|
57974
|
+
});
|
|
57975
|
+
await this.app_db.updateScheduledTrade(config2.id, {
|
|
57976
|
+
entry: result.entry,
|
|
57977
|
+
stop: result.stop,
|
|
57978
|
+
risk: result.risk_per_trade,
|
|
57979
|
+
profit_percent: result.profit_percent,
|
|
57980
|
+
risk_reward: result.risk_reward
|
|
57981
|
+
});
|
|
57982
|
+
await this.placeTrade({
|
|
57983
|
+
symbol,
|
|
57984
|
+
kind: result.kind,
|
|
57985
|
+
place: true,
|
|
57986
|
+
ignore_config: true
|
|
57987
|
+
});
|
|
57988
|
+
await this.placeTrade({
|
|
57989
|
+
symbol,
|
|
57990
|
+
kind: result.kind,
|
|
57991
|
+
place: true,
|
|
57992
|
+
stop: true,
|
|
57993
|
+
ignore_config: true
|
|
57994
|
+
});
|
|
57995
|
+
}
|
|
57996
|
+
return result;
|
|
57997
|
+
}
|
|
57959
57998
|
async runSimulation(payload) {
|
|
57960
57999
|
const { symbol, kind, iterations = 2, raw = false } = payload;
|
|
57961
58000
|
const positions = await this.syncAccount({
|
|
57962
|
-
symbol
|
|
58001
|
+
symbol,
|
|
58002
|
+
as_view: true
|
|
57963
58003
|
});
|
|
57964
58004
|
const symbol_config = await this.recomputeSymbolConfig({
|
|
57965
58005
|
symbol
|
|
@@ -57993,11 +58033,13 @@ class ExchangeAccount {
|
|
|
57993
58033
|
const strategy = new Strategy({
|
|
57994
58034
|
long: {
|
|
57995
58035
|
entry: long_position.entry,
|
|
57996
|
-
quantity: long_position.quantity
|
|
58036
|
+
quantity: long_position.quantity,
|
|
58037
|
+
avg_price: long_position.avg_price
|
|
57997
58038
|
},
|
|
57998
58039
|
short: {
|
|
57999
58040
|
entry: short_position.entry,
|
|
58000
|
-
quantity: short_position.quantity
|
|
58041
|
+
quantity: short_position.quantity,
|
|
58042
|
+
avg_price: short_position.avg_price
|
|
58001
58043
|
},
|
|
58002
58044
|
config: strategy_config
|
|
58003
58045
|
});
|
package/dist/mcp-server.cjs
CHANGED
|
@@ -64692,10 +64692,50 @@ class ExchangeAccount {
|
|
|
64692
64692
|
}
|
|
64693
64693
|
return 0;
|
|
64694
64694
|
}
|
|
64695
|
+
async buildOppositeTrades(payload) {
|
|
64696
|
+
const { symbol, kind, place } = payload;
|
|
64697
|
+
const strategy = await this.runSimulation({
|
|
64698
|
+
symbol,
|
|
64699
|
+
kind,
|
|
64700
|
+
raw: true
|
|
64701
|
+
});
|
|
64702
|
+
const result = strategy.generateOppositeTrades({
|
|
64703
|
+
kind,
|
|
64704
|
+
avg_entry: strategy.position[kind].avg_price
|
|
64705
|
+
});
|
|
64706
|
+
if (place && result?.kind) {
|
|
64707
|
+
const config2 = await this.getPositionConfig({
|
|
64708
|
+
symbol,
|
|
64709
|
+
kind: result.kind
|
|
64710
|
+
});
|
|
64711
|
+
await this.app_db.updateScheduledTrade(config2.id, {
|
|
64712
|
+
entry: result.entry,
|
|
64713
|
+
stop: result.stop,
|
|
64714
|
+
risk: result.risk_per_trade,
|
|
64715
|
+
profit_percent: result.profit_percent,
|
|
64716
|
+
risk_reward: result.risk_reward
|
|
64717
|
+
});
|
|
64718
|
+
await this.placeTrade({
|
|
64719
|
+
symbol,
|
|
64720
|
+
kind: result.kind,
|
|
64721
|
+
place: true,
|
|
64722
|
+
ignore_config: true
|
|
64723
|
+
});
|
|
64724
|
+
await this.placeTrade({
|
|
64725
|
+
symbol,
|
|
64726
|
+
kind: result.kind,
|
|
64727
|
+
place: true,
|
|
64728
|
+
stop: true,
|
|
64729
|
+
ignore_config: true
|
|
64730
|
+
});
|
|
64731
|
+
}
|
|
64732
|
+
return result;
|
|
64733
|
+
}
|
|
64695
64734
|
async runSimulation(payload) {
|
|
64696
64735
|
const { symbol, kind, iterations = 2, raw = false } = payload;
|
|
64697
64736
|
const positions = await this.syncAccount({
|
|
64698
|
-
symbol
|
|
64737
|
+
symbol,
|
|
64738
|
+
as_view: true
|
|
64699
64739
|
});
|
|
64700
64740
|
const symbol_config = await this.recomputeSymbolConfig({
|
|
64701
64741
|
symbol
|
|
@@ -64729,11 +64769,13 @@ class ExchangeAccount {
|
|
|
64729
64769
|
const strategy = new Strategy({
|
|
64730
64770
|
long: {
|
|
64731
64771
|
entry: long_position.entry,
|
|
64732
|
-
quantity: long_position.quantity
|
|
64772
|
+
quantity: long_position.quantity,
|
|
64773
|
+
avg_price: long_position.avg_price
|
|
64733
64774
|
},
|
|
64734
64775
|
short: {
|
|
64735
64776
|
entry: short_position.entry,
|
|
64736
|
-
quantity: short_position.quantity
|
|
64777
|
+
quantity: short_position.quantity,
|
|
64778
|
+
avg_price: short_position.avg_price
|
|
64737
64779
|
},
|
|
64738
64780
|
config: strategy_config
|
|
64739
64781
|
});
|
package/dist/mcp-server.js
CHANGED
|
@@ -64669,10 +64669,50 @@ class ExchangeAccount {
|
|
|
64669
64669
|
}
|
|
64670
64670
|
return 0;
|
|
64671
64671
|
}
|
|
64672
|
+
async buildOppositeTrades(payload) {
|
|
64673
|
+
const { symbol, kind, place } = payload;
|
|
64674
|
+
const strategy = await this.runSimulation({
|
|
64675
|
+
symbol,
|
|
64676
|
+
kind,
|
|
64677
|
+
raw: true
|
|
64678
|
+
});
|
|
64679
|
+
const result = strategy.generateOppositeTrades({
|
|
64680
|
+
kind,
|
|
64681
|
+
avg_entry: strategy.position[kind].avg_price
|
|
64682
|
+
});
|
|
64683
|
+
if (place && result?.kind) {
|
|
64684
|
+
const config2 = await this.getPositionConfig({
|
|
64685
|
+
symbol,
|
|
64686
|
+
kind: result.kind
|
|
64687
|
+
});
|
|
64688
|
+
await this.app_db.updateScheduledTrade(config2.id, {
|
|
64689
|
+
entry: result.entry,
|
|
64690
|
+
stop: result.stop,
|
|
64691
|
+
risk: result.risk_per_trade,
|
|
64692
|
+
profit_percent: result.profit_percent,
|
|
64693
|
+
risk_reward: result.risk_reward
|
|
64694
|
+
});
|
|
64695
|
+
await this.placeTrade({
|
|
64696
|
+
symbol,
|
|
64697
|
+
kind: result.kind,
|
|
64698
|
+
place: true,
|
|
64699
|
+
ignore_config: true
|
|
64700
|
+
});
|
|
64701
|
+
await this.placeTrade({
|
|
64702
|
+
symbol,
|
|
64703
|
+
kind: result.kind,
|
|
64704
|
+
place: true,
|
|
64705
|
+
stop: true,
|
|
64706
|
+
ignore_config: true
|
|
64707
|
+
});
|
|
64708
|
+
}
|
|
64709
|
+
return result;
|
|
64710
|
+
}
|
|
64672
64711
|
async runSimulation(payload) {
|
|
64673
64712
|
const { symbol, kind, iterations = 2, raw = false } = payload;
|
|
64674
64713
|
const positions = await this.syncAccount({
|
|
64675
|
-
symbol
|
|
64714
|
+
symbol,
|
|
64715
|
+
as_view: true
|
|
64676
64716
|
});
|
|
64677
64717
|
const symbol_config = await this.recomputeSymbolConfig({
|
|
64678
64718
|
symbol
|
|
@@ -64706,11 +64746,13 @@ class ExchangeAccount {
|
|
|
64706
64746
|
const strategy = new Strategy({
|
|
64707
64747
|
long: {
|
|
64708
64748
|
entry: long_position.entry,
|
|
64709
|
-
quantity: long_position.quantity
|
|
64749
|
+
quantity: long_position.quantity,
|
|
64750
|
+
avg_price: long_position.avg_price
|
|
64710
64751
|
},
|
|
64711
64752
|
short: {
|
|
64712
64753
|
entry: short_position.entry,
|
|
64713
|
-
quantity: short_position.quantity
|
|
64754
|
+
quantity: short_position.quantity,
|
|
64755
|
+
avg_price: short_position.avg_price
|
|
64714
64756
|
},
|
|
64715
64757
|
config: strategy_config
|
|
64716
64758
|
});
|