@gbozee/ultimate 0.0.2-176 → 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 +106 -4
- package/dist/frontend-index.js +211 -25
- package/dist/index.cjs +256 -58
- package/dist/index.d.ts +132 -9
- package/dist/index.js +256 -58
- package/dist/mcp-server.cjs +256 -58
- package/dist/mcp-server.js +256 -58
- 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;
|
|
@@ -169,6 +188,9 @@ export interface CompoundInstance extends BaseSystemFields {
|
|
|
169
188
|
position?: string;
|
|
170
189
|
risk?: number;
|
|
171
190
|
hedged?: boolean;
|
|
191
|
+
expand?: {
|
|
192
|
+
ref?: Compounder;
|
|
193
|
+
};
|
|
172
194
|
}
|
|
173
195
|
export interface SupportTable extends BaseSystemFields {
|
|
174
196
|
symbol?: string;
|
|
@@ -1207,6 +1229,10 @@ export type SignalConfigType = {
|
|
|
1207
1229
|
kelly_confidence_factor?: number;
|
|
1208
1230
|
kelly_minimum_risk?: number;
|
|
1209
1231
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1232
|
+
full_distribution?: {
|
|
1233
|
+
long: GetEntriesParams["distribution"];
|
|
1234
|
+
short: GetEntriesParams["distribution"];
|
|
1235
|
+
};
|
|
1210
1236
|
};
|
|
1211
1237
|
declare class Signal {
|
|
1212
1238
|
focus: number;
|
|
@@ -1235,8 +1261,12 @@ declare class Signal {
|
|
|
1235
1261
|
kelly_minimum_risk: number;
|
|
1236
1262
|
kelly_func: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1237
1263
|
symbol?: string;
|
|
1238
|
-
|
|
1239
|
-
|
|
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, }: {
|
|
1240
1270
|
take_profit?: number;
|
|
1241
1271
|
no_of_trades?: number;
|
|
1242
1272
|
current_price: number;
|
|
@@ -1245,6 +1275,7 @@ declare class Signal {
|
|
|
1245
1275
|
risk: number;
|
|
1246
1276
|
stop_percent?: number;
|
|
1247
1277
|
pnl?: number;
|
|
1278
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1248
1279
|
}): any;
|
|
1249
1280
|
get risk(): number;
|
|
1250
1281
|
get min_trades(): number;
|
|
@@ -1278,6 +1309,11 @@ declare class Signal {
|
|
|
1278
1309
|
kind?: "long" | "short";
|
|
1279
1310
|
limit?: boolean;
|
|
1280
1311
|
}): any;
|
|
1312
|
+
get_future_zones_simple({ current_price, kind, raw, }: {
|
|
1313
|
+
raw?: boolean;
|
|
1314
|
+
current_price: number;
|
|
1315
|
+
kind?: "long" | "short";
|
|
1316
|
+
}): number[];
|
|
1281
1317
|
get_future_zones({ current_price, kind, raw, }: {
|
|
1282
1318
|
raw?: boolean;
|
|
1283
1319
|
current_price: number;
|
|
@@ -1372,13 +1408,15 @@ export type ExtendConfigType = {
|
|
|
1372
1408
|
kind?: "long" | "short";
|
|
1373
1409
|
gap?: number;
|
|
1374
1410
|
rr?: number;
|
|
1411
|
+
min_avg_size?: number;
|
|
1375
1412
|
use_kelly?: boolean;
|
|
1376
1413
|
kelly_confidence_factor?: number;
|
|
1377
1414
|
kelly_minimum_risk?: number;
|
|
1378
1415
|
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
1379
1416
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1417
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1380
1418
|
};
|
|
1381
|
-
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;
|
|
1382
1420
|
export declare function buildAvg({ _trades, kind, }: {
|
|
1383
1421
|
_trades: any[];
|
|
1384
1422
|
kind: "long" | "short";
|
|
@@ -1393,6 +1431,7 @@ export declare function get_app_config_and_max_size(config: GlobalConfig, payloa
|
|
|
1393
1431
|
kelly_minimum_risk?: number;
|
|
1394
1432
|
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
1395
1433
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1434
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1396
1435
|
}): {
|
|
1397
1436
|
app_config: AppConfig;
|
|
1398
1437
|
max_size: any;
|
|
@@ -1417,11 +1456,13 @@ export declare function buildAppConfig(config: GlobalConfig, payload: {
|
|
|
1417
1456
|
kelly_minimum_risk?: number;
|
|
1418
1457
|
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
1419
1458
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1459
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1420
1460
|
}): AppConfig;
|
|
1421
1461
|
export declare function getOptimumStopAndRisk(app_config: AppConfig, params: {
|
|
1422
1462
|
max_size: number;
|
|
1423
1463
|
target_stop: number;
|
|
1424
1464
|
highest_risk?: number;
|
|
1465
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1425
1466
|
}): {
|
|
1426
1467
|
optimal_stop: number;
|
|
1427
1468
|
optimal_risk: number;
|
|
@@ -1478,6 +1519,7 @@ export declare function generateOptimumAppConfig(config: GlobalConfig, payload:
|
|
|
1478
1519
|
risk_reward: number;
|
|
1479
1520
|
start_risk: number;
|
|
1480
1521
|
max_risk?: number;
|
|
1522
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1481
1523
|
}, position: {
|
|
1482
1524
|
entry: number;
|
|
1483
1525
|
quantity: number;
|
|
@@ -1489,6 +1531,7 @@ export declare function determineOptimumReward(payload: {
|
|
|
1489
1531
|
low_range?: number;
|
|
1490
1532
|
high_range?: number;
|
|
1491
1533
|
target_loss?: number;
|
|
1534
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1492
1535
|
}): number | {
|
|
1493
1536
|
result: any[];
|
|
1494
1537
|
value: number;
|
|
@@ -1505,6 +1548,7 @@ export declare function determineOptimumRisk(config: GlobalConfig, payload: {
|
|
|
1505
1548
|
risk_reward: number;
|
|
1506
1549
|
risk: number;
|
|
1507
1550
|
symbol: string;
|
|
1551
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1508
1552
|
}, params: {
|
|
1509
1553
|
highest_risk: number;
|
|
1510
1554
|
tolerance?: number;
|
|
@@ -1526,6 +1570,7 @@ export declare function computeRiskReward(payload: {
|
|
|
1526
1570
|
stop: number;
|
|
1527
1571
|
risk_per_trade: number;
|
|
1528
1572
|
target_loss?: number;
|
|
1573
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1529
1574
|
}): number | {
|
|
1530
1575
|
result: any[];
|
|
1531
1576
|
value: number;
|
|
@@ -1543,6 +1588,7 @@ export declare function getRiskReward(payload: {
|
|
|
1543
1588
|
global_config: GlobalConfig;
|
|
1544
1589
|
force_exact_risk?: boolean;
|
|
1545
1590
|
target_loss?: number;
|
|
1591
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1546
1592
|
}): any;
|
|
1547
1593
|
export declare function computeProfitDetail(payload: {
|
|
1548
1594
|
focus_position: {
|
|
@@ -1770,7 +1816,41 @@ export declare function constructAppConfig(payload: {
|
|
|
1770
1816
|
kelly_minimum_risk: number;
|
|
1771
1817
|
kelly_prediction_model: string;
|
|
1772
1818
|
};
|
|
1773
|
-
}):
|
|
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
|
+
};
|
|
1774
1854
|
export declare function generateDangerousConfig(payload: {
|
|
1775
1855
|
account: PositionsView;
|
|
1776
1856
|
global_config: GlobalConfig;
|
|
@@ -1833,6 +1913,10 @@ export declare class ExchangePosition {
|
|
|
1833
1913
|
get symbol(): any;
|
|
1834
1914
|
get kind(): any;
|
|
1835
1915
|
get account(): ExchangeAccount;
|
|
1916
|
+
get compound(): CompoundInstance & {
|
|
1917
|
+
amount_to_risk?: number;
|
|
1918
|
+
profit_percent?: number;
|
|
1919
|
+
};
|
|
1836
1920
|
getProxyForAccount(): Promise<HttpsProxyAgent<`http://${string}`> | SocksProxyAgent>;
|
|
1837
1921
|
cancelOrders(payload: {
|
|
1838
1922
|
limit?: boolean;
|
|
@@ -1887,6 +1971,7 @@ export declare class ExchangePosition {
|
|
|
1887
1971
|
raw?: boolean;
|
|
1888
1972
|
use_current?: boolean;
|
|
1889
1973
|
stop_percent?: number;
|
|
1974
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1890
1975
|
}): Promise<any>;
|
|
1891
1976
|
buildAppConfig(payload: {
|
|
1892
1977
|
entry: number;
|
|
@@ -1917,6 +2002,7 @@ export declare class ExchangePosition {
|
|
|
1917
2002
|
kelly_minimum_risk?: number;
|
|
1918
2003
|
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
1919
2004
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
2005
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1920
2006
|
}, place?: boolean, skip_stop?: boolean): Promise<{
|
|
1921
2007
|
entry_orders: {
|
|
1922
2008
|
orders: {
|
|
@@ -2132,7 +2218,41 @@ export declare class ExchangePosition {
|
|
|
2132
2218
|
neg_pnl: any;
|
|
2133
2219
|
entry: any;
|
|
2134
2220
|
}>;
|
|
2135
|
-
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
|
+
};
|
|
2136
2256
|
updateProfitPercentWithRisk(payload: {
|
|
2137
2257
|
focus_position: ExchangePosition;
|
|
2138
2258
|
}): Promise<{
|
|
@@ -2180,17 +2300,20 @@ export declare class ExchangePosition {
|
|
|
2180
2300
|
fee_percent?: number;
|
|
2181
2301
|
place?: boolean;
|
|
2182
2302
|
}): Promise<any>;
|
|
2183
|
-
|
|
2184
|
-
|
|
2303
|
+
get support(): SupportTable;
|
|
2304
|
+
get linkedConfig(): ScheduledTrade;
|
|
2305
|
+
get isActiveTrade(): {
|
|
2306
|
+
config: ScheduledTrade;
|
|
2185
2307
|
condition: boolean;
|
|
2186
|
-
|
|
2187
|
-
}>;
|
|
2308
|
+
};
|
|
2188
2309
|
updateCompound(payload?: {
|
|
2189
2310
|
place?: boolean;
|
|
2190
2311
|
}): Promise<{
|
|
2191
2312
|
support: number;
|
|
2192
2313
|
counter: number;
|
|
2193
2314
|
new_risk: number;
|
|
2315
|
+
condition: boolean;
|
|
2316
|
+
stop: number;
|
|
2194
2317
|
}>;
|
|
2195
2318
|
cleanOnActiveCompoundInstance(): Promise<void>;
|
|
2196
2319
|
}
|