@gbozee/ultimate 0.0.2-57 → 0.0.2-60
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 +42 -1
- package/dist/frontend-index.js +75 -7
- package/dist/index.cjs +1662 -1492
- package/dist/index.d.ts +137 -69
- package/dist/index.js +1662 -1492
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import { HttpsProxyAgent } from 'https-proxy-agent';
|
|
4
4
|
import PocketBase from 'pocketbase';
|
|
5
|
-
import { RecordModel } from 'pocketbase';
|
|
5
|
+
import { RecordModel as PocketBaseRecordModel } from 'pocketbase';
|
|
6
6
|
import { SocksProxyAgent } from 'socks-proxy-agent';
|
|
7
7
|
|
|
8
|
+
export type RecordModel = PocketBaseRecordModel;
|
|
8
9
|
export interface BaseSystemFields {
|
|
9
10
|
id: string;
|
|
10
11
|
created: string;
|
|
@@ -30,6 +31,16 @@ export interface ExchangeAccount extends BaseSystemFields {
|
|
|
30
31
|
};
|
|
31
32
|
include_delisted?: boolean;
|
|
32
33
|
}
|
|
34
|
+
export interface Order extends BaseSystemFields {
|
|
35
|
+
symbol: string;
|
|
36
|
+
account: string;
|
|
37
|
+
kind: "long" | "short";
|
|
38
|
+
price: number;
|
|
39
|
+
quantity: number;
|
|
40
|
+
side: "sell" | "buy";
|
|
41
|
+
stop: number;
|
|
42
|
+
order_id: string;
|
|
43
|
+
}
|
|
33
44
|
export interface SymbolConfig extends BaseSystemFields {
|
|
34
45
|
symbol: string;
|
|
35
46
|
support?: number;
|
|
@@ -64,6 +75,7 @@ export interface AccountStrategy extends BaseSystemFields {
|
|
|
64
75
|
fee_percent: number;
|
|
65
76
|
budget: number;
|
|
66
77
|
risk_reward: number;
|
|
78
|
+
reduce_ratio: number;
|
|
67
79
|
}
|
|
68
80
|
interface Proxy$1 extends BaseSystemFields {
|
|
69
81
|
ip_address?: string;
|
|
@@ -227,6 +239,7 @@ export interface BaseExchange {
|
|
|
227
239
|
take_profit: number;
|
|
228
240
|
kind: "long" | "short";
|
|
229
241
|
cancel?: boolean;
|
|
242
|
+
quantity?: number;
|
|
230
243
|
price_places?: string;
|
|
231
244
|
decimal_places?: string;
|
|
232
245
|
}): Promise<any>;
|
|
@@ -374,7 +387,7 @@ export declare class AppDatabase {
|
|
|
374
387
|
getOrders(account: ExchangeType, options: {
|
|
375
388
|
symbol: string;
|
|
376
389
|
kind: "long" | "short";
|
|
377
|
-
}): Promise<
|
|
390
|
+
}): Promise<Order[]>;
|
|
378
391
|
deleteAndRecreateOrders(account: ExchangeType, options: {
|
|
379
392
|
symbol: string;
|
|
380
393
|
kind: "long" | "short";
|
|
@@ -387,7 +400,7 @@ export declare class AppDatabase {
|
|
|
387
400
|
stop: number;
|
|
388
401
|
order_id: string;
|
|
389
402
|
triggerPrice?: number;
|
|
390
|
-
}>): Promise<
|
|
403
|
+
}>): Promise<Order[]>;
|
|
391
404
|
deleteAndBulCreateAllOrders(payload: {
|
|
392
405
|
account: ExchangeType & {
|
|
393
406
|
id: string;
|
|
@@ -455,7 +468,7 @@ export declare class AppDatabase {
|
|
|
455
468
|
profit_percent?: number;
|
|
456
469
|
place_tp?: boolean;
|
|
457
470
|
profit?: number;
|
|
458
|
-
}): Promise<
|
|
471
|
+
}): Promise<import("pocketbase").RecordModel | ScheduledTrade>;
|
|
459
472
|
getPositionConfig(payload: {
|
|
460
473
|
symbol: string;
|
|
461
474
|
kind: "long" | "short";
|
|
@@ -500,6 +513,100 @@ export declare class AppDatabase {
|
|
|
500
513
|
removePosition(position: any): Promise<void>;
|
|
501
514
|
removePositionConfig(position: any): Promise<void>;
|
|
502
515
|
}
|
|
516
|
+
export type StrategyPosition = {
|
|
517
|
+
entry: number;
|
|
518
|
+
quantity: number;
|
|
519
|
+
};
|
|
520
|
+
export type Config = {
|
|
521
|
+
tp_percent: number;
|
|
522
|
+
short_tp_factor: number;
|
|
523
|
+
fee_percent?: number;
|
|
524
|
+
budget: number;
|
|
525
|
+
risk_reward: number;
|
|
526
|
+
reduce_ratio: number;
|
|
527
|
+
global_config: GlobalConfig;
|
|
528
|
+
};
|
|
529
|
+
export declare class Strategy {
|
|
530
|
+
position: {
|
|
531
|
+
long: StrategyPosition;
|
|
532
|
+
short: StrategyPosition;
|
|
533
|
+
};
|
|
534
|
+
config: Config;
|
|
535
|
+
constructor(payload: {
|
|
536
|
+
long: StrategyPosition;
|
|
537
|
+
short: StrategyPosition;
|
|
538
|
+
config: Config;
|
|
539
|
+
});
|
|
540
|
+
get price_places(): string;
|
|
541
|
+
get decimal_places(): string;
|
|
542
|
+
to_f(price: number): number;
|
|
543
|
+
to_df(quantity: number): number;
|
|
544
|
+
pnl(kind: "long" | "short", _position?: StrategyPosition): number;
|
|
545
|
+
tp(kind: "long" | "short"): number;
|
|
546
|
+
calculate_fee(position: {
|
|
547
|
+
price: number;
|
|
548
|
+
quantity: number;
|
|
549
|
+
}): number;
|
|
550
|
+
get long_tp(): number;
|
|
551
|
+
get short_tp(): number;
|
|
552
|
+
generateGapClosingAlgorithm(payload: {
|
|
553
|
+
kind: "long" | "short";
|
|
554
|
+
}): {
|
|
555
|
+
[x: string]: any;
|
|
556
|
+
risk: number;
|
|
557
|
+
risk_reward: number;
|
|
558
|
+
last_entry: any;
|
|
559
|
+
first_entry: any;
|
|
560
|
+
threshold: any;
|
|
561
|
+
};
|
|
562
|
+
runIterations(payload: {
|
|
563
|
+
kind: "long" | "short";
|
|
564
|
+
iterations: number;
|
|
565
|
+
risk_reward?: number;
|
|
566
|
+
}): {
|
|
567
|
+
[x: string]: any;
|
|
568
|
+
risk: number;
|
|
569
|
+
risk_reward: number;
|
|
570
|
+
last_entry: any;
|
|
571
|
+
first_entry: any;
|
|
572
|
+
threshold: any;
|
|
573
|
+
}[];
|
|
574
|
+
getPositionAfterTp(payload: {
|
|
575
|
+
kind: "long" | "short";
|
|
576
|
+
include_fees?: boolean;
|
|
577
|
+
}): {
|
|
578
|
+
[x: string]: number | {
|
|
579
|
+
entry: number;
|
|
580
|
+
quantity: number;
|
|
581
|
+
} | {
|
|
582
|
+
[x: string]: number;
|
|
583
|
+
entry?: undefined;
|
|
584
|
+
quantity?: undefined;
|
|
585
|
+
};
|
|
586
|
+
pnl: {
|
|
587
|
+
[x: string]: number;
|
|
588
|
+
};
|
|
589
|
+
spread: number;
|
|
590
|
+
};
|
|
591
|
+
getPositionAfterIteration(payload: {
|
|
592
|
+
kind: "long" | "short";
|
|
593
|
+
iterations: number;
|
|
594
|
+
with_fees?: boolean;
|
|
595
|
+
}): {
|
|
596
|
+
[x: string]: number | {
|
|
597
|
+
entry: number;
|
|
598
|
+
quantity: number;
|
|
599
|
+
} | {
|
|
600
|
+
[x: string]: number;
|
|
601
|
+
entry?: undefined;
|
|
602
|
+
quantity?: undefined;
|
|
603
|
+
};
|
|
604
|
+
pnl: {
|
|
605
|
+
[x: string]: number;
|
|
606
|
+
};
|
|
607
|
+
spread: number;
|
|
608
|
+
}[];
|
|
609
|
+
}
|
|
503
610
|
export type SignalConfigType = {
|
|
504
611
|
focus: number;
|
|
505
612
|
budget: number;
|
|
@@ -821,7 +928,7 @@ declare class ExchangePosition {
|
|
|
821
928
|
place_tp?: boolean;
|
|
822
929
|
profit?: number;
|
|
823
930
|
};
|
|
824
|
-
}): Promise<
|
|
931
|
+
}): Promise<import("pocketbase").RecordModel | ScheduledTrade>;
|
|
825
932
|
updateTargetPnl(): Promise<number>;
|
|
826
933
|
updateConfigPnl(): Promise<void>;
|
|
827
934
|
triggerTradeFromConfig(payload: {
|
|
@@ -893,7 +1000,7 @@ declare class ExchangePosition {
|
|
|
893
1000
|
}): Promise<any[]>;
|
|
894
1001
|
refresh(live_refresh?: boolean): Promise<{
|
|
895
1002
|
instance: PositionsView;
|
|
896
|
-
existingOrders: void |
|
|
1003
|
+
existingOrders: void | Order[];
|
|
897
1004
|
}>;
|
|
898
1005
|
placeTrade(payload: {
|
|
899
1006
|
place?: boolean;
|
|
@@ -973,7 +1080,7 @@ declare class ExchangeAccount$1 {
|
|
|
973
1080
|
symbol: string;
|
|
974
1081
|
kind?: "long" | "short";
|
|
975
1082
|
update?: boolean;
|
|
976
|
-
}): Promise<void |
|
|
1083
|
+
}): Promise<void | Order[]>;
|
|
977
1084
|
toggleStopBuying(payload: {
|
|
978
1085
|
symbol: string;
|
|
979
1086
|
kind: "long" | "short";
|
|
@@ -1022,6 +1129,10 @@ declare class ExchangeAccount$1 {
|
|
|
1022
1129
|
update_db?: boolean;
|
|
1023
1130
|
profit_percent?: number;
|
|
1024
1131
|
}): Promise<AppConfig>;
|
|
1132
|
+
tradeConfig(payload: {
|
|
1133
|
+
symbol: string;
|
|
1134
|
+
kind: "long" | "short";
|
|
1135
|
+
}): Promise<AppConfig>;
|
|
1025
1136
|
buildTrades(payload: {
|
|
1026
1137
|
symbol: string;
|
|
1027
1138
|
kind: "long" | "short";
|
|
@@ -1090,7 +1201,7 @@ declare class ExchangeAccount$1 {
|
|
|
1090
1201
|
kind: "long" | "short";
|
|
1091
1202
|
risk?: number;
|
|
1092
1203
|
risk_reward?: number;
|
|
1093
|
-
}): Promise<
|
|
1204
|
+
}): Promise<import("pocketbase").RecordModel | ScheduledTrade>;
|
|
1094
1205
|
getPositionConfig(payload: {
|
|
1095
1206
|
symbol: string;
|
|
1096
1207
|
kind: "long" | "short";
|
|
@@ -1103,7 +1214,7 @@ declare class ExchangeAccount$1 {
|
|
|
1103
1214
|
place_tp?: boolean;
|
|
1104
1215
|
profit?: number;
|
|
1105
1216
|
};
|
|
1106
|
-
}): Promise<
|
|
1217
|
+
}): Promise<import("pocketbase").RecordModel | ScheduledTrade>;
|
|
1107
1218
|
getCurrentPrice(symbol: string): Promise<any>;
|
|
1108
1219
|
getPositionStrategy(): Promise<AccountStrategy>;
|
|
1109
1220
|
buildReduceConfig(payload: {
|
|
@@ -1139,6 +1250,7 @@ declare class ExchangeAccount$1 {
|
|
|
1139
1250
|
not_reduce: boolean;
|
|
1140
1251
|
ratio: any;
|
|
1141
1252
|
use_full: boolean;
|
|
1253
|
+
sell_ratio: any;
|
|
1142
1254
|
};
|
|
1143
1255
|
short: {
|
|
1144
1256
|
minimum_pnl: number;
|
|
@@ -1148,6 +1260,7 @@ declare class ExchangeAccount$1 {
|
|
|
1148
1260
|
not_reduce: boolean;
|
|
1149
1261
|
ratio: any;
|
|
1150
1262
|
use_full: boolean;
|
|
1263
|
+
sell_ratio: any;
|
|
1151
1264
|
};
|
|
1152
1265
|
trigger: {
|
|
1153
1266
|
long: boolean;
|
|
@@ -1220,7 +1333,7 @@ declare class ExchangeAccount$1 {
|
|
|
1220
1333
|
symbol: string;
|
|
1221
1334
|
kind: "long" | "short";
|
|
1222
1335
|
revert?: boolean;
|
|
1223
|
-
}): Promise<void |
|
|
1336
|
+
}): Promise<void | Order[]>;
|
|
1224
1337
|
windDownSymbol(payload: {
|
|
1225
1338
|
symbol: string;
|
|
1226
1339
|
risk_reward?: number;
|
|
@@ -1230,6 +1343,19 @@ declare class ExchangeAccount$1 {
|
|
|
1230
1343
|
symbol: string;
|
|
1231
1344
|
kind: "long" | "short";
|
|
1232
1345
|
}): Promise<number>;
|
|
1346
|
+
runSimulation(payload: {
|
|
1347
|
+
symbol: string;
|
|
1348
|
+
kind: "long" | "short";
|
|
1349
|
+
iterations?: number;
|
|
1350
|
+
raw?: boolean;
|
|
1351
|
+
}): Promise<Strategy | {
|
|
1352
|
+
[x: string]: any;
|
|
1353
|
+
risk: number;
|
|
1354
|
+
risk_reward: number;
|
|
1355
|
+
last_entry: any;
|
|
1356
|
+
first_entry: any;
|
|
1357
|
+
threshold: any;
|
|
1358
|
+
}[]>;
|
|
1233
1359
|
getCurrentRun(payload: {
|
|
1234
1360
|
symbol: string;
|
|
1235
1361
|
kind?: "long" | "short";
|
|
@@ -1272,7 +1398,7 @@ declare class ExchangeAccount$1 {
|
|
|
1272
1398
|
symbol: string;
|
|
1273
1399
|
kind: "long" | "short";
|
|
1274
1400
|
type: "limit" | "stop" | "tp";
|
|
1275
|
-
}): Promise<
|
|
1401
|
+
}): Promise<Order[]>;
|
|
1276
1402
|
syncPositionConfigs(payload: {
|
|
1277
1403
|
symbol: string;
|
|
1278
1404
|
kind: "long" | "short";
|
|
@@ -1461,64 +1587,6 @@ export declare function initialize(payload: {
|
|
|
1461
1587
|
ignore_proxy?: boolean;
|
|
1462
1588
|
canWithdraw?: boolean;
|
|
1463
1589
|
}): Promise<App>;
|
|
1464
|
-
export type StrategyPosition = {
|
|
1465
|
-
entry: number;
|
|
1466
|
-
quantity: number;
|
|
1467
|
-
};
|
|
1468
|
-
export type Config = {
|
|
1469
|
-
tp_percent: number;
|
|
1470
|
-
short_tp_factor: number;
|
|
1471
|
-
fee_percent?: number;
|
|
1472
|
-
budget: number;
|
|
1473
|
-
risk_reward: number;
|
|
1474
|
-
global_config: GlobalConfig;
|
|
1475
|
-
};
|
|
1476
|
-
export declare class Strategy {
|
|
1477
|
-
position: {
|
|
1478
|
-
long: StrategyPosition;
|
|
1479
|
-
short: StrategyPosition;
|
|
1480
|
-
};
|
|
1481
|
-
config: Config;
|
|
1482
|
-
constructor(payload: {
|
|
1483
|
-
long: StrategyPosition;
|
|
1484
|
-
short: StrategyPosition;
|
|
1485
|
-
config: Config;
|
|
1486
|
-
});
|
|
1487
|
-
get price_places(): string;
|
|
1488
|
-
get decimal_places(): string;
|
|
1489
|
-
to_f(price: number): number;
|
|
1490
|
-
to_df(quantity: number): number;
|
|
1491
|
-
pnl(kind: "long" | "short"): number;
|
|
1492
|
-
tp(kind: "long" | "short"): number;
|
|
1493
|
-
calculate_fee(position: {
|
|
1494
|
-
price: number;
|
|
1495
|
-
quantity: number;
|
|
1496
|
-
}): number;
|
|
1497
|
-
get long_tp(): number;
|
|
1498
|
-
get short_tp(): number;
|
|
1499
|
-
generateGapClosingAlgorithm(payload: {
|
|
1500
|
-
kind: "long" | "short";
|
|
1501
|
-
}): {
|
|
1502
|
-
[x: string]: any;
|
|
1503
|
-
risk: number;
|
|
1504
|
-
risk_reward: number;
|
|
1505
|
-
last_entry: any;
|
|
1506
|
-
first_entry: any;
|
|
1507
|
-
threshold: any;
|
|
1508
|
-
};
|
|
1509
|
-
runIterations(payload: {
|
|
1510
|
-
kind: "long" | "short";
|
|
1511
|
-
iterations: number;
|
|
1512
|
-
risk_reward?: number;
|
|
1513
|
-
}): {
|
|
1514
|
-
[x: string]: any;
|
|
1515
|
-
risk: number;
|
|
1516
|
-
risk_reward: number;
|
|
1517
|
-
last_entry: any;
|
|
1518
|
-
first_entry: any;
|
|
1519
|
-
threshold: any;
|
|
1520
|
-
}[];
|
|
1521
|
-
}
|
|
1522
1590
|
|
|
1523
1591
|
declare namespace database {
|
|
1524
1592
|
export { AppDatabase, ExchangeType, initPocketBaseClient };
|