@gbozee/ultimate 0.0.2-174 → 0.0.2-177
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 +134 -4
- package/dist/frontend-index.js +305 -25
- package/dist/index.cjs +397 -32
- package/dist/index.d.ts +206 -5
- package/dist/index.js +397 -32
- package/dist/mcp-server.cjs +303 -32
- package/dist/mcp-server.js +303 -32
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,21 @@ import PocketBase from 'pocketbase';
|
|
|
5
5
|
import { RecordModel as PocketBaseRecordModel } from 'pocketbase';
|
|
6
6
|
import { SocksProxyAgent } from 'socks-proxy-agent';
|
|
7
7
|
|
|
8
|
+
export interface GetEntriesParams {
|
|
9
|
+
kind: "long" | "short";
|
|
10
|
+
distribution: "arithmetic" | "geometric" | "normal" | "exponential" | "inverse-exponential";
|
|
11
|
+
margin_range: [
|
|
12
|
+
number,
|
|
13
|
+
number
|
|
14
|
+
];
|
|
15
|
+
risk_reward: number;
|
|
16
|
+
price_places?: string;
|
|
17
|
+
distribution_params?: {
|
|
18
|
+
curveFactor?: number;
|
|
19
|
+
stdDevFactor?: number;
|
|
20
|
+
lambda?: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
8
23
|
export type RecordModel = PocketBaseRecordModel;
|
|
9
24
|
export interface BaseSystemFields {
|
|
10
25
|
id: string;
|
|
@@ -78,6 +93,7 @@ export interface ScheduledTrade extends BaseSystemFields {
|
|
|
78
93
|
kelly_minimum_risk?: number;
|
|
79
94
|
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
80
95
|
};
|
|
96
|
+
distribution?: GetEntriesParams["distribution"];
|
|
81
97
|
}
|
|
82
98
|
export interface AccountStrategy extends BaseSystemFields {
|
|
83
99
|
account: string;
|
|
@@ -142,8 +158,11 @@ export interface PositionsView {
|
|
|
142
158
|
b_config?: ScheduledTrade;
|
|
143
159
|
proxy?: Proxy$1;
|
|
144
160
|
account_strategy?: AccountStrategy;
|
|
161
|
+
compound_instance?: CompoundInstance;
|
|
162
|
+
support?: SupportTable;
|
|
145
163
|
};
|
|
146
164
|
pnl?: number;
|
|
165
|
+
support_price?: number;
|
|
147
166
|
}
|
|
148
167
|
export interface BullishMarket extends RecordModel {
|
|
149
168
|
id: string;
|
|
@@ -155,6 +174,31 @@ export interface WindingDownMarket extends RecordModel {
|
|
|
155
174
|
symbol: string;
|
|
156
175
|
risk_reward: number;
|
|
157
176
|
}
|
|
177
|
+
export interface Compounder extends BaseSystemFields {
|
|
178
|
+
risk?: number;
|
|
179
|
+
profit_percent?: number;
|
|
180
|
+
owner?: string;
|
|
181
|
+
completed?: boolean;
|
|
182
|
+
start_balance?: number;
|
|
183
|
+
starting_risk?: number;
|
|
184
|
+
fee_rate?: number;
|
|
185
|
+
}
|
|
186
|
+
export interface CompoundInstance extends BaseSystemFields {
|
|
187
|
+
ref?: string;
|
|
188
|
+
position?: string;
|
|
189
|
+
risk?: number;
|
|
190
|
+
hedged?: boolean;
|
|
191
|
+
expand?: {
|
|
192
|
+
ref?: Compounder;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
export interface SupportTable extends BaseSystemFields {
|
|
196
|
+
symbol?: string;
|
|
197
|
+
price?: number;
|
|
198
|
+
counter?: number;
|
|
199
|
+
last_updated?: string;
|
|
200
|
+
kind?: "long" | "short";
|
|
201
|
+
}
|
|
158
202
|
export interface BotInstance extends BaseSystemFields {
|
|
159
203
|
asset: string;
|
|
160
204
|
main_account?: string;
|
|
@@ -848,6 +892,21 @@ export declare class AppDatabase {
|
|
|
848
892
|
profit_percent: number;
|
|
849
893
|
};
|
|
850
894
|
}): Promise<void>;
|
|
895
|
+
getCompoundInstance(payload: {
|
|
896
|
+
position: Position$1;
|
|
897
|
+
}): Promise<CompoundInstance & {
|
|
898
|
+
expand: {
|
|
899
|
+
ref: Compounder;
|
|
900
|
+
};
|
|
901
|
+
}>;
|
|
902
|
+
getSupportTable(payload: {
|
|
903
|
+
symbol: string;
|
|
904
|
+
kind: "long" | "short";
|
|
905
|
+
}): Promise<SupportTable>;
|
|
906
|
+
updateCompoundInstance(payload: {
|
|
907
|
+
id: string;
|
|
908
|
+
params: any;
|
|
909
|
+
}): Promise<import("pocketbase").RecordModel>;
|
|
851
910
|
}
|
|
852
911
|
export type StrategyPosition = {
|
|
853
912
|
entry: number;
|
|
@@ -1170,6 +1229,10 @@ export type SignalConfigType = {
|
|
|
1170
1229
|
kelly_confidence_factor?: number;
|
|
1171
1230
|
kelly_minimum_risk?: number;
|
|
1172
1231
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1232
|
+
full_distribution?: {
|
|
1233
|
+
long: GetEntriesParams["distribution"];
|
|
1234
|
+
short: GetEntriesParams["distribution"];
|
|
1235
|
+
};
|
|
1173
1236
|
};
|
|
1174
1237
|
declare class Signal {
|
|
1175
1238
|
focus: number;
|
|
@@ -1198,8 +1261,12 @@ declare class Signal {
|
|
|
1198
1261
|
kelly_minimum_risk: number;
|
|
1199
1262
|
kelly_func: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1200
1263
|
symbol?: string;
|
|
1201
|
-
|
|
1202
|
-
|
|
1264
|
+
distribution: {
|
|
1265
|
+
long: GetEntriesParams["distribution"];
|
|
1266
|
+
short: GetEntriesParams["distribution"];
|
|
1267
|
+
};
|
|
1268
|
+
constructor({ focus, symbol, budget, percent_change, price_places, decimal_places, zone_risk, fee, support, risk_reward, resistance, risk_per_trade, increase_size, additional_increase, minimum_pnl, take_profit, increase_position, minimum_size, first_order_size, gap, max_size, use_kelly, kelly_prediction_model, kelly_confidence_factor, kelly_minimum_risk, kelly_func, full_distribution, }: SignalConfigType);
|
|
1269
|
+
build_entry({ current_price, stop_loss, pnl, stop_percent, kind, risk, no_of_trades, take_profit, distribution, }: {
|
|
1203
1270
|
take_profit?: number;
|
|
1204
1271
|
no_of_trades?: number;
|
|
1205
1272
|
current_price: number;
|
|
@@ -1208,6 +1275,7 @@ declare class Signal {
|
|
|
1208
1275
|
risk: number;
|
|
1209
1276
|
stop_percent?: number;
|
|
1210
1277
|
pnl?: number;
|
|
1278
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1211
1279
|
}): any;
|
|
1212
1280
|
get risk(): number;
|
|
1213
1281
|
get min_trades(): number;
|
|
@@ -1241,6 +1309,11 @@ declare class Signal {
|
|
|
1241
1309
|
kind?: "long" | "short";
|
|
1242
1310
|
limit?: boolean;
|
|
1243
1311
|
}): any;
|
|
1312
|
+
get_future_zones_simple({ current_price, kind, raw, }: {
|
|
1313
|
+
raw?: boolean;
|
|
1314
|
+
current_price: number;
|
|
1315
|
+
kind?: "long" | "short";
|
|
1316
|
+
}): number[];
|
|
1244
1317
|
get_future_zones({ current_price, kind, raw, }: {
|
|
1245
1318
|
raw?: boolean;
|
|
1246
1319
|
current_price: number;
|
|
@@ -1335,13 +1408,15 @@ export type ExtendConfigType = {
|
|
|
1335
1408
|
kind?: "long" | "short";
|
|
1336
1409
|
gap?: number;
|
|
1337
1410
|
rr?: number;
|
|
1411
|
+
min_avg_size?: number;
|
|
1338
1412
|
use_kelly?: boolean;
|
|
1339
1413
|
kelly_confidence_factor?: number;
|
|
1340
1414
|
kelly_minimum_risk?: number;
|
|
1341
1415
|
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
1342
1416
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1417
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1343
1418
|
};
|
|
1344
|
-
export declare function buildConfig(app_config: AppConfig, { take_profit, entry, stop, raw_instance, risk, no_of_trades, min_profit, risk_reward, kind, increase, gap, rr, price_places, decimal_places, use_kelly, kelly_confidence_factor, kelly_minimum_risk, kelly_prediction_model, kelly_func, }: ExtendConfigType): any[] | Signal;
|
|
1419
|
+
export declare function buildConfig(app_config: AppConfig, { take_profit, entry, stop, raw_instance, risk, no_of_trades, min_profit, risk_reward, kind, increase, gap, rr, price_places, decimal_places, use_kelly, kelly_confidence_factor, kelly_minimum_risk, kelly_prediction_model, kelly_func, min_avg_size, distribution, }: ExtendConfigType): any[] | Signal;
|
|
1345
1420
|
export declare function buildAvg({ _trades, kind, }: {
|
|
1346
1421
|
_trades: any[];
|
|
1347
1422
|
kind: "long" | "short";
|
|
@@ -1356,6 +1431,7 @@ export declare function get_app_config_and_max_size(config: GlobalConfig, payloa
|
|
|
1356
1431
|
kelly_minimum_risk?: number;
|
|
1357
1432
|
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
1358
1433
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1434
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1359
1435
|
}): {
|
|
1360
1436
|
app_config: AppConfig;
|
|
1361
1437
|
max_size: any;
|
|
@@ -1380,11 +1456,13 @@ export declare function buildAppConfig(config: GlobalConfig, payload: {
|
|
|
1380
1456
|
kelly_minimum_risk?: number;
|
|
1381
1457
|
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
1382
1458
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1459
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1383
1460
|
}): AppConfig;
|
|
1384
1461
|
export declare function getOptimumStopAndRisk(app_config: AppConfig, params: {
|
|
1385
1462
|
max_size: number;
|
|
1386
1463
|
target_stop: number;
|
|
1387
1464
|
highest_risk?: number;
|
|
1465
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1388
1466
|
}): {
|
|
1389
1467
|
optimal_stop: number;
|
|
1390
1468
|
optimal_risk: number;
|
|
@@ -1441,6 +1519,7 @@ export declare function generateOptimumAppConfig(config: GlobalConfig, payload:
|
|
|
1441
1519
|
risk_reward: number;
|
|
1442
1520
|
start_risk: number;
|
|
1443
1521
|
max_risk?: number;
|
|
1522
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1444
1523
|
}, position: {
|
|
1445
1524
|
entry: number;
|
|
1446
1525
|
quantity: number;
|
|
@@ -1452,6 +1531,7 @@ export declare function determineOptimumReward(payload: {
|
|
|
1452
1531
|
low_range?: number;
|
|
1453
1532
|
high_range?: number;
|
|
1454
1533
|
target_loss?: number;
|
|
1534
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1455
1535
|
}): number | {
|
|
1456
1536
|
result: any[];
|
|
1457
1537
|
value: number;
|
|
@@ -1468,6 +1548,7 @@ export declare function determineOptimumRisk(config: GlobalConfig, payload: {
|
|
|
1468
1548
|
risk_reward: number;
|
|
1469
1549
|
risk: number;
|
|
1470
1550
|
symbol: string;
|
|
1551
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1471
1552
|
}, params: {
|
|
1472
1553
|
highest_risk: number;
|
|
1473
1554
|
tolerance?: number;
|
|
@@ -1489,6 +1570,7 @@ export declare function computeRiskReward(payload: {
|
|
|
1489
1570
|
stop: number;
|
|
1490
1571
|
risk_per_trade: number;
|
|
1491
1572
|
target_loss?: number;
|
|
1573
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1492
1574
|
}): number | {
|
|
1493
1575
|
result: any[];
|
|
1494
1576
|
value: number;
|
|
@@ -1506,6 +1588,7 @@ export declare function getRiskReward(payload: {
|
|
|
1506
1588
|
global_config: GlobalConfig;
|
|
1507
1589
|
force_exact_risk?: boolean;
|
|
1508
1590
|
target_loss?: number;
|
|
1591
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1509
1592
|
}): any;
|
|
1510
1593
|
export declare function computeProfitDetail(payload: {
|
|
1511
1594
|
focus_position: {
|
|
@@ -1596,6 +1679,34 @@ export declare function generateGapTp(payload: {
|
|
|
1596
1679
|
gap: number;
|
|
1597
1680
|
gap_loss: number;
|
|
1598
1681
|
};
|
|
1682
|
+
export declare function calculateFactorFromTakeProfit(payload: {
|
|
1683
|
+
long: {
|
|
1684
|
+
entry: number;
|
|
1685
|
+
quantity: number;
|
|
1686
|
+
};
|
|
1687
|
+
short: {
|
|
1688
|
+
entry: number;
|
|
1689
|
+
quantity: number;
|
|
1690
|
+
};
|
|
1691
|
+
knownTp: number;
|
|
1692
|
+
tpType: "long" | "short";
|
|
1693
|
+
price_places?: string;
|
|
1694
|
+
}): number;
|
|
1695
|
+
export declare function calculateFactorFromSellQuantity(payload: {
|
|
1696
|
+
long: {
|
|
1697
|
+
entry: number;
|
|
1698
|
+
quantity: number;
|
|
1699
|
+
};
|
|
1700
|
+
short: {
|
|
1701
|
+
entry: number;
|
|
1702
|
+
quantity: number;
|
|
1703
|
+
};
|
|
1704
|
+
knownSellQuantity: number;
|
|
1705
|
+
sellType: "long" | "short";
|
|
1706
|
+
sell_factor?: number;
|
|
1707
|
+
price_places?: string;
|
|
1708
|
+
decimal_places?: string;
|
|
1709
|
+
}): number;
|
|
1599
1710
|
export declare function determineRewardFactor(payload: {
|
|
1600
1711
|
quantity: number;
|
|
1601
1712
|
avg_qty: number;
|
|
@@ -1705,7 +1816,41 @@ export declare function constructAppConfig(payload: {
|
|
|
1705
1816
|
kelly_minimum_risk: number;
|
|
1706
1817
|
kelly_prediction_model: string;
|
|
1707
1818
|
};
|
|
1708
|
-
}):
|
|
1819
|
+
}): {
|
|
1820
|
+
fee: number;
|
|
1821
|
+
risk_per_trade: number;
|
|
1822
|
+
risk_reward: number;
|
|
1823
|
+
symbol?: string;
|
|
1824
|
+
focus: number;
|
|
1825
|
+
budget: number;
|
|
1826
|
+
support: number;
|
|
1827
|
+
resistance: number;
|
|
1828
|
+
percent_change: number;
|
|
1829
|
+
tradeSplit?: number;
|
|
1830
|
+
take_profit?: number;
|
|
1831
|
+
kind: "long" | "short";
|
|
1832
|
+
entry: number;
|
|
1833
|
+
stop: number;
|
|
1834
|
+
min_size: number;
|
|
1835
|
+
price_places?: string;
|
|
1836
|
+
strategy?: "quantity" | "entry";
|
|
1837
|
+
as_array?: boolean;
|
|
1838
|
+
decimal_places?: string;
|
|
1839
|
+
min_profit?: number;
|
|
1840
|
+
raw?: boolean;
|
|
1841
|
+
gap?: number;
|
|
1842
|
+
rr?: number;
|
|
1843
|
+
max_size?: number;
|
|
1844
|
+
last_value?: any;
|
|
1845
|
+
max_quantity?: number;
|
|
1846
|
+
kelly?: {
|
|
1847
|
+
use_kelly?: boolean;
|
|
1848
|
+
kelly_confidence_factor?: number;
|
|
1849
|
+
kelly_minimum_risk?: number;
|
|
1850
|
+
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
1851
|
+
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1852
|
+
};
|
|
1853
|
+
};
|
|
1709
1854
|
export declare function generateDangerousConfig(payload: {
|
|
1710
1855
|
account: PositionsView;
|
|
1711
1856
|
global_config: GlobalConfig;
|
|
@@ -1768,6 +1913,10 @@ export declare class ExchangePosition {
|
|
|
1768
1913
|
get symbol(): any;
|
|
1769
1914
|
get kind(): any;
|
|
1770
1915
|
get account(): ExchangeAccount;
|
|
1916
|
+
get compound(): CompoundInstance & {
|
|
1917
|
+
amount_to_risk?: number;
|
|
1918
|
+
profit_percent?: number;
|
|
1919
|
+
};
|
|
1771
1920
|
getProxyForAccount(): Promise<HttpsProxyAgent<`http://${string}`> | SocksProxyAgent>;
|
|
1772
1921
|
cancelOrders(payload: {
|
|
1773
1922
|
limit?: boolean;
|
|
@@ -1822,6 +1971,7 @@ export declare class ExchangePosition {
|
|
|
1822
1971
|
raw?: boolean;
|
|
1823
1972
|
use_current?: boolean;
|
|
1824
1973
|
stop_percent?: number;
|
|
1974
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1825
1975
|
}): Promise<any>;
|
|
1826
1976
|
buildAppConfig(payload: {
|
|
1827
1977
|
entry: number;
|
|
@@ -1852,6 +2002,7 @@ export declare class ExchangePosition {
|
|
|
1852
2002
|
kelly_minimum_risk?: number;
|
|
1853
2003
|
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
1854
2004
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
2005
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1855
2006
|
}, place?: boolean, skip_stop?: boolean): Promise<{
|
|
1856
2007
|
entry_orders: {
|
|
1857
2008
|
orders: {
|
|
@@ -2067,7 +2218,41 @@ export declare class ExchangePosition {
|
|
|
2067
2218
|
neg_pnl: any;
|
|
2068
2219
|
entry: any;
|
|
2069
2220
|
}>;
|
|
2070
|
-
get appConfig():
|
|
2221
|
+
get appConfig(): {
|
|
2222
|
+
fee: number;
|
|
2223
|
+
risk_per_trade: number;
|
|
2224
|
+
risk_reward: number;
|
|
2225
|
+
symbol?: string;
|
|
2226
|
+
focus: number;
|
|
2227
|
+
budget: number;
|
|
2228
|
+
support: number;
|
|
2229
|
+
resistance: number;
|
|
2230
|
+
percent_change: number;
|
|
2231
|
+
tradeSplit?: number;
|
|
2232
|
+
take_profit?: number;
|
|
2233
|
+
kind: "long" | "short";
|
|
2234
|
+
entry: number;
|
|
2235
|
+
stop: number;
|
|
2236
|
+
min_size: number;
|
|
2237
|
+
price_places?: string;
|
|
2238
|
+
strategy?: "quantity" | "entry";
|
|
2239
|
+
as_array?: boolean;
|
|
2240
|
+
decimal_places?: string;
|
|
2241
|
+
min_profit?: number;
|
|
2242
|
+
raw?: boolean;
|
|
2243
|
+
gap?: number;
|
|
2244
|
+
rr?: number;
|
|
2245
|
+
max_size?: number;
|
|
2246
|
+
last_value?: any;
|
|
2247
|
+
max_quantity?: number;
|
|
2248
|
+
kelly?: {
|
|
2249
|
+
use_kelly?: boolean;
|
|
2250
|
+
kelly_confidence_factor?: number;
|
|
2251
|
+
kelly_minimum_risk?: number;
|
|
2252
|
+
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
2253
|
+
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
2254
|
+
};
|
|
2255
|
+
};
|
|
2071
2256
|
updateProfitPercentWithRisk(payload: {
|
|
2072
2257
|
focus_position: ExchangePosition;
|
|
2073
2258
|
}): Promise<{
|
|
@@ -2115,6 +2300,22 @@ export declare class ExchangePosition {
|
|
|
2115
2300
|
fee_percent?: number;
|
|
2116
2301
|
place?: boolean;
|
|
2117
2302
|
}): Promise<any>;
|
|
2303
|
+
get support(): SupportTable;
|
|
2304
|
+
get linkedConfig(): ScheduledTrade;
|
|
2305
|
+
get isActiveTrade(): {
|
|
2306
|
+
config: ScheduledTrade;
|
|
2307
|
+
condition: boolean;
|
|
2308
|
+
};
|
|
2309
|
+
updateCompound(payload?: {
|
|
2310
|
+
place?: boolean;
|
|
2311
|
+
}): Promise<{
|
|
2312
|
+
support: number;
|
|
2313
|
+
counter: number;
|
|
2314
|
+
new_risk: number;
|
|
2315
|
+
condition: boolean;
|
|
2316
|
+
stop: number;
|
|
2317
|
+
}>;
|
|
2318
|
+
cleanOnActiveCompoundInstance(): Promise<void>;
|
|
2118
2319
|
}
|
|
2119
2320
|
declare class ExchangeAccount$1 {
|
|
2120
2321
|
instance: {
|