@gbozee/ultimate 0.0.2-176 → 0.0.2-178
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 +272 -58
- package/dist/index.d.ts +137 -9
- package/dist/index.js +272 -58
- package/dist/mcp-server.cjs +272 -58
- package/dist/mcp-server.js +272 -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;
|
|
@@ -642,6 +664,11 @@ export declare class AppDatabase {
|
|
|
642
664
|
proxy: Proxy$1;
|
|
643
665
|
};
|
|
644
666
|
}>;
|
|
667
|
+
get positionExpand(): string;
|
|
668
|
+
fetchCentralPositions(payload: {
|
|
669
|
+
asset?: string;
|
|
670
|
+
symbol?: string;
|
|
671
|
+
}): Promise<import("pocketbase").RecordModel[]>;
|
|
645
672
|
getPositions(options: {
|
|
646
673
|
account?: ExchangeType;
|
|
647
674
|
symbol?: string;
|
|
@@ -1207,6 +1234,10 @@ export type SignalConfigType = {
|
|
|
1207
1234
|
kelly_confidence_factor?: number;
|
|
1208
1235
|
kelly_minimum_risk?: number;
|
|
1209
1236
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1237
|
+
full_distribution?: {
|
|
1238
|
+
long: GetEntriesParams["distribution"];
|
|
1239
|
+
short: GetEntriesParams["distribution"];
|
|
1240
|
+
};
|
|
1210
1241
|
};
|
|
1211
1242
|
declare class Signal {
|
|
1212
1243
|
focus: number;
|
|
@@ -1235,8 +1266,12 @@ declare class Signal {
|
|
|
1235
1266
|
kelly_minimum_risk: number;
|
|
1236
1267
|
kelly_func: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1237
1268
|
symbol?: string;
|
|
1238
|
-
|
|
1239
|
-
|
|
1269
|
+
distribution: {
|
|
1270
|
+
long: GetEntriesParams["distribution"];
|
|
1271
|
+
short: GetEntriesParams["distribution"];
|
|
1272
|
+
};
|
|
1273
|
+
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);
|
|
1274
|
+
build_entry({ current_price, stop_loss, pnl, stop_percent, kind, risk, no_of_trades, take_profit, distribution, }: {
|
|
1240
1275
|
take_profit?: number;
|
|
1241
1276
|
no_of_trades?: number;
|
|
1242
1277
|
current_price: number;
|
|
@@ -1245,6 +1280,7 @@ declare class Signal {
|
|
|
1245
1280
|
risk: number;
|
|
1246
1281
|
stop_percent?: number;
|
|
1247
1282
|
pnl?: number;
|
|
1283
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1248
1284
|
}): any;
|
|
1249
1285
|
get risk(): number;
|
|
1250
1286
|
get min_trades(): number;
|
|
@@ -1278,6 +1314,11 @@ declare class Signal {
|
|
|
1278
1314
|
kind?: "long" | "short";
|
|
1279
1315
|
limit?: boolean;
|
|
1280
1316
|
}): any;
|
|
1317
|
+
get_future_zones_simple({ current_price, kind, raw, }: {
|
|
1318
|
+
raw?: boolean;
|
|
1319
|
+
current_price: number;
|
|
1320
|
+
kind?: "long" | "short";
|
|
1321
|
+
}): number[];
|
|
1281
1322
|
get_future_zones({ current_price, kind, raw, }: {
|
|
1282
1323
|
raw?: boolean;
|
|
1283
1324
|
current_price: number;
|
|
@@ -1372,13 +1413,15 @@ export type ExtendConfigType = {
|
|
|
1372
1413
|
kind?: "long" | "short";
|
|
1373
1414
|
gap?: number;
|
|
1374
1415
|
rr?: number;
|
|
1416
|
+
min_avg_size?: number;
|
|
1375
1417
|
use_kelly?: boolean;
|
|
1376
1418
|
kelly_confidence_factor?: number;
|
|
1377
1419
|
kelly_minimum_risk?: number;
|
|
1378
1420
|
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
1379
1421
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1422
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1380
1423
|
};
|
|
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;
|
|
1424
|
+
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
1425
|
export declare function buildAvg({ _trades, kind, }: {
|
|
1383
1426
|
_trades: any[];
|
|
1384
1427
|
kind: "long" | "short";
|
|
@@ -1393,6 +1436,7 @@ export declare function get_app_config_and_max_size(config: GlobalConfig, payloa
|
|
|
1393
1436
|
kelly_minimum_risk?: number;
|
|
1394
1437
|
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
1395
1438
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1439
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1396
1440
|
}): {
|
|
1397
1441
|
app_config: AppConfig;
|
|
1398
1442
|
max_size: any;
|
|
@@ -1417,11 +1461,13 @@ export declare function buildAppConfig(config: GlobalConfig, payload: {
|
|
|
1417
1461
|
kelly_minimum_risk?: number;
|
|
1418
1462
|
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
1419
1463
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1464
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1420
1465
|
}): AppConfig;
|
|
1421
1466
|
export declare function getOptimumStopAndRisk(app_config: AppConfig, params: {
|
|
1422
1467
|
max_size: number;
|
|
1423
1468
|
target_stop: number;
|
|
1424
1469
|
highest_risk?: number;
|
|
1470
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1425
1471
|
}): {
|
|
1426
1472
|
optimal_stop: number;
|
|
1427
1473
|
optimal_risk: number;
|
|
@@ -1478,6 +1524,7 @@ export declare function generateOptimumAppConfig(config: GlobalConfig, payload:
|
|
|
1478
1524
|
risk_reward: number;
|
|
1479
1525
|
start_risk: number;
|
|
1480
1526
|
max_risk?: number;
|
|
1527
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1481
1528
|
}, position: {
|
|
1482
1529
|
entry: number;
|
|
1483
1530
|
quantity: number;
|
|
@@ -1489,6 +1536,7 @@ export declare function determineOptimumReward(payload: {
|
|
|
1489
1536
|
low_range?: number;
|
|
1490
1537
|
high_range?: number;
|
|
1491
1538
|
target_loss?: number;
|
|
1539
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1492
1540
|
}): number | {
|
|
1493
1541
|
result: any[];
|
|
1494
1542
|
value: number;
|
|
@@ -1505,6 +1553,7 @@ export declare function determineOptimumRisk(config: GlobalConfig, payload: {
|
|
|
1505
1553
|
risk_reward: number;
|
|
1506
1554
|
risk: number;
|
|
1507
1555
|
symbol: string;
|
|
1556
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1508
1557
|
}, params: {
|
|
1509
1558
|
highest_risk: number;
|
|
1510
1559
|
tolerance?: number;
|
|
@@ -1526,6 +1575,7 @@ export declare function computeRiskReward(payload: {
|
|
|
1526
1575
|
stop: number;
|
|
1527
1576
|
risk_per_trade: number;
|
|
1528
1577
|
target_loss?: number;
|
|
1578
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1529
1579
|
}): number | {
|
|
1530
1580
|
result: any[];
|
|
1531
1581
|
value: number;
|
|
@@ -1543,6 +1593,7 @@ export declare function getRiskReward(payload: {
|
|
|
1543
1593
|
global_config: GlobalConfig;
|
|
1544
1594
|
force_exact_risk?: boolean;
|
|
1545
1595
|
target_loss?: number;
|
|
1596
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1546
1597
|
}): any;
|
|
1547
1598
|
export declare function computeProfitDetail(payload: {
|
|
1548
1599
|
focus_position: {
|
|
@@ -1770,7 +1821,41 @@ export declare function constructAppConfig(payload: {
|
|
|
1770
1821
|
kelly_minimum_risk: number;
|
|
1771
1822
|
kelly_prediction_model: string;
|
|
1772
1823
|
};
|
|
1773
|
-
}):
|
|
1824
|
+
}): {
|
|
1825
|
+
fee: number;
|
|
1826
|
+
risk_per_trade: number;
|
|
1827
|
+
risk_reward: number;
|
|
1828
|
+
symbol?: string;
|
|
1829
|
+
focus: number;
|
|
1830
|
+
budget: number;
|
|
1831
|
+
support: number;
|
|
1832
|
+
resistance: number;
|
|
1833
|
+
percent_change: number;
|
|
1834
|
+
tradeSplit?: number;
|
|
1835
|
+
take_profit?: number;
|
|
1836
|
+
kind: "long" | "short";
|
|
1837
|
+
entry: number;
|
|
1838
|
+
stop: number;
|
|
1839
|
+
min_size: number;
|
|
1840
|
+
price_places?: string;
|
|
1841
|
+
strategy?: "quantity" | "entry";
|
|
1842
|
+
as_array?: boolean;
|
|
1843
|
+
decimal_places?: string;
|
|
1844
|
+
min_profit?: number;
|
|
1845
|
+
raw?: boolean;
|
|
1846
|
+
gap?: number;
|
|
1847
|
+
rr?: number;
|
|
1848
|
+
max_size?: number;
|
|
1849
|
+
last_value?: any;
|
|
1850
|
+
max_quantity?: number;
|
|
1851
|
+
kelly?: {
|
|
1852
|
+
use_kelly?: boolean;
|
|
1853
|
+
kelly_confidence_factor?: number;
|
|
1854
|
+
kelly_minimum_risk?: number;
|
|
1855
|
+
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
1856
|
+
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
1857
|
+
};
|
|
1858
|
+
};
|
|
1774
1859
|
export declare function generateDangerousConfig(payload: {
|
|
1775
1860
|
account: PositionsView;
|
|
1776
1861
|
global_config: GlobalConfig;
|
|
@@ -1833,6 +1918,10 @@ export declare class ExchangePosition {
|
|
|
1833
1918
|
get symbol(): any;
|
|
1834
1919
|
get kind(): any;
|
|
1835
1920
|
get account(): ExchangeAccount;
|
|
1921
|
+
get compound(): CompoundInstance & {
|
|
1922
|
+
amount_to_risk?: number;
|
|
1923
|
+
profit_percent?: number;
|
|
1924
|
+
};
|
|
1836
1925
|
getProxyForAccount(): Promise<HttpsProxyAgent<`http://${string}`> | SocksProxyAgent>;
|
|
1837
1926
|
cancelOrders(payload: {
|
|
1838
1927
|
limit?: boolean;
|
|
@@ -1887,6 +1976,7 @@ export declare class ExchangePosition {
|
|
|
1887
1976
|
raw?: boolean;
|
|
1888
1977
|
use_current?: boolean;
|
|
1889
1978
|
stop_percent?: number;
|
|
1979
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1890
1980
|
}): Promise<any>;
|
|
1891
1981
|
buildAppConfig(payload: {
|
|
1892
1982
|
entry: number;
|
|
@@ -1917,6 +2007,7 @@ export declare class ExchangePosition {
|
|
|
1917
2007
|
kelly_minimum_risk?: number;
|
|
1918
2008
|
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
1919
2009
|
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
2010
|
+
distribution?: GetEntriesParams["distribution"];
|
|
1920
2011
|
}, place?: boolean, skip_stop?: boolean): Promise<{
|
|
1921
2012
|
entry_orders: {
|
|
1922
2013
|
orders: {
|
|
@@ -2132,7 +2223,41 @@ export declare class ExchangePosition {
|
|
|
2132
2223
|
neg_pnl: any;
|
|
2133
2224
|
entry: any;
|
|
2134
2225
|
}>;
|
|
2135
|
-
get appConfig():
|
|
2226
|
+
get appConfig(): {
|
|
2227
|
+
fee: number;
|
|
2228
|
+
risk_per_trade: number;
|
|
2229
|
+
risk_reward: number;
|
|
2230
|
+
symbol?: string;
|
|
2231
|
+
focus: number;
|
|
2232
|
+
budget: number;
|
|
2233
|
+
support: number;
|
|
2234
|
+
resistance: number;
|
|
2235
|
+
percent_change: number;
|
|
2236
|
+
tradeSplit?: number;
|
|
2237
|
+
take_profit?: number;
|
|
2238
|
+
kind: "long" | "short";
|
|
2239
|
+
entry: number;
|
|
2240
|
+
stop: number;
|
|
2241
|
+
min_size: number;
|
|
2242
|
+
price_places?: string;
|
|
2243
|
+
strategy?: "quantity" | "entry";
|
|
2244
|
+
as_array?: boolean;
|
|
2245
|
+
decimal_places?: string;
|
|
2246
|
+
min_profit?: number;
|
|
2247
|
+
raw?: boolean;
|
|
2248
|
+
gap?: number;
|
|
2249
|
+
rr?: number;
|
|
2250
|
+
max_size?: number;
|
|
2251
|
+
last_value?: any;
|
|
2252
|
+
max_quantity?: number;
|
|
2253
|
+
kelly?: {
|
|
2254
|
+
use_kelly?: boolean;
|
|
2255
|
+
kelly_confidence_factor?: number;
|
|
2256
|
+
kelly_minimum_risk?: number;
|
|
2257
|
+
kelly_prediction_model?: "exponential" | "normal" | "uniform";
|
|
2258
|
+
kelly_func?: "theoretical" | "position_based" | "theoretical_fixed";
|
|
2259
|
+
};
|
|
2260
|
+
};
|
|
2136
2261
|
updateProfitPercentWithRisk(payload: {
|
|
2137
2262
|
focus_position: ExchangePosition;
|
|
2138
2263
|
}): Promise<{
|
|
@@ -2180,17 +2305,20 @@ export declare class ExchangePosition {
|
|
|
2180
2305
|
fee_percent?: number;
|
|
2181
2306
|
place?: boolean;
|
|
2182
2307
|
}): Promise<any>;
|
|
2183
|
-
|
|
2184
|
-
|
|
2308
|
+
get support(): SupportTable;
|
|
2309
|
+
get linkedConfig(): ScheduledTrade;
|
|
2310
|
+
get isActiveTrade(): {
|
|
2311
|
+
config: ScheduledTrade;
|
|
2185
2312
|
condition: boolean;
|
|
2186
|
-
|
|
2187
|
-
}>;
|
|
2313
|
+
};
|
|
2188
2314
|
updateCompound(payload?: {
|
|
2189
2315
|
place?: boolean;
|
|
2190
2316
|
}): Promise<{
|
|
2191
2317
|
support: number;
|
|
2192
2318
|
counter: number;
|
|
2193
2319
|
new_risk: number;
|
|
2320
|
+
condition: boolean;
|
|
2321
|
+
stop: number;
|
|
2194
2322
|
}>;
|
|
2195
2323
|
cleanOnActiveCompoundInstance(): Promise<void>;
|
|
2196
2324
|
}
|