@gbozee/ultimate 0.0.2-20 → 0.0.2-22
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/index.d.ts +112 -32
- package/dist/index.js +774 -71
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -128,6 +128,7 @@ export interface BaseExchange {
|
|
|
128
128
|
}): Promise<any>;
|
|
129
129
|
generateConfig(payload: {
|
|
130
130
|
symbol: string;
|
|
131
|
+
interval?: any;
|
|
131
132
|
limit?: number;
|
|
132
133
|
}): Promise<any>;
|
|
133
134
|
checkDelistedMovers(payload: {
|
|
@@ -139,6 +140,15 @@ export interface BaseExchange {
|
|
|
139
140
|
price_places?: string;
|
|
140
141
|
decimal_places?: string;
|
|
141
142
|
}): Promise<any>;
|
|
143
|
+
getAllOpenSymbols(): Promise<string[]>;
|
|
144
|
+
createLimitPurchaseOrders(payload: {
|
|
145
|
+
orders: any[];
|
|
146
|
+
kind: "long" | "short";
|
|
147
|
+
decimal_places?: string;
|
|
148
|
+
price_places?: string;
|
|
149
|
+
symbol: string;
|
|
150
|
+
}): Promise<any>;
|
|
151
|
+
getDelistedSpotSymbols(): Promise<any>;
|
|
142
152
|
}
|
|
143
153
|
export interface BaseSystemFields {
|
|
144
154
|
id: string;
|
|
@@ -158,6 +168,10 @@ export interface ExchangeAccount extends BaseSystemFields {
|
|
|
158
168
|
movePercent?: number;
|
|
159
169
|
totalRisk?: number;
|
|
160
170
|
max_non_essential?: number;
|
|
171
|
+
profit_percent?: number;
|
|
172
|
+
exclude_coins?: {
|
|
173
|
+
bullish?: string[];
|
|
174
|
+
};
|
|
161
175
|
}
|
|
162
176
|
export interface SymbolConfig extends BaseSystemFields {
|
|
163
177
|
symbol: string;
|
|
@@ -170,6 +184,7 @@ export interface SymbolConfig extends BaseSystemFields {
|
|
|
170
184
|
weight?: number;
|
|
171
185
|
leverage?: number;
|
|
172
186
|
candle_count?: number;
|
|
187
|
+
interval?: any;
|
|
173
188
|
}
|
|
174
189
|
export interface ScheduledTrade extends BaseSystemFields {
|
|
175
190
|
symbol: string;
|
|
@@ -250,6 +265,14 @@ export type ExchangeType = {
|
|
|
250
265
|
export declare class AppDatabase {
|
|
251
266
|
private pb;
|
|
252
267
|
constructor(pb: PocketBase);
|
|
268
|
+
getCredentials(password: string): any;
|
|
269
|
+
saveCredentials(password: string, credentials: any): Promise<void>;
|
|
270
|
+
addNewCredential(password: string, payload: {
|
|
271
|
+
name: string;
|
|
272
|
+
exchange: string;
|
|
273
|
+
api_key: string;
|
|
274
|
+
api_secret: string;
|
|
275
|
+
}): Promise<void>;
|
|
253
276
|
getAllSymbolsFromPositions(options?: {
|
|
254
277
|
no_position?: boolean;
|
|
255
278
|
kind?: "long" | "short";
|
|
@@ -349,12 +372,16 @@ export declare class AppDatabase {
|
|
|
349
372
|
message?: undefined;
|
|
350
373
|
exchange_result?: undefined;
|
|
351
374
|
}>;
|
|
375
|
+
getMoverExchangeInstances(): Promise<ExchangeAccount[]>;
|
|
376
|
+
updateScheduledTrade(id: string, payload: any): Promise<import("pocketbase").RecordModel>;
|
|
352
377
|
createOrUpdatePositionConfig(db_position: any, payload: {
|
|
353
378
|
entry: number;
|
|
354
379
|
stop: number;
|
|
355
380
|
risk_reward: number;
|
|
356
381
|
risk: number;
|
|
357
382
|
profit_percent?: number;
|
|
383
|
+
place_tp?: boolean;
|
|
384
|
+
profit?: number;
|
|
358
385
|
}): Promise<ScheduledTrade | import("pocketbase").RecordModel>;
|
|
359
386
|
getPositionConfig(payload: {
|
|
360
387
|
symbol: string;
|
|
@@ -395,6 +422,7 @@ export declare class AppDatabase {
|
|
|
395
422
|
} | SymbolConfig[]>;
|
|
396
423
|
unwindSymbolFromDB(symbol: string): Promise<boolean>;
|
|
397
424
|
hasExistingPosition(symbol: string): Promise<import("pocketbase").RecordModel[]>;
|
|
425
|
+
hasExistingOrders(symbol: string): Promise<import("pocketbase").RecordModel[]>;
|
|
398
426
|
removeSymbolFromUnwindingMarkets(symbol: string): Promise<boolean>;
|
|
399
427
|
removePosition(position: any): Promise<void>;
|
|
400
428
|
removePositionConfig(position: any): Promise<void>;
|
|
@@ -424,20 +452,25 @@ export type AppConfig = {
|
|
|
424
452
|
gap?: number;
|
|
425
453
|
rr?: number;
|
|
426
454
|
max_size?: number;
|
|
455
|
+
last_value?: any;
|
|
456
|
+
entries?: any[];
|
|
427
457
|
};
|
|
428
458
|
declare class ExchangeAccount$1 {
|
|
429
459
|
private instance;
|
|
430
460
|
exchange: BaseExchange;
|
|
461
|
+
main_exchange?: BaseExchange;
|
|
431
462
|
private app_db;
|
|
432
463
|
constructor(payload: ExchangeType, options: {
|
|
433
464
|
exchange: BaseExchange;
|
|
434
465
|
app_db: AppDatabase;
|
|
466
|
+
main_exchange?: BaseExchange;
|
|
435
467
|
});
|
|
436
468
|
/**
|
|
437
469
|
*In order to avoid rate limiting issues, we cache the live exchange
|
|
438
470
|
details for each symbol for an account in the database with an option
|
|
439
471
|
to refresh.
|
|
440
472
|
*/
|
|
473
|
+
getDBInstance(): AppDatabase;
|
|
441
474
|
getLiveExchangeInstance(payload: {
|
|
442
475
|
symbol: string;
|
|
443
476
|
refresh?: boolean;
|
|
@@ -547,6 +580,14 @@ declare class ExchangeAccount$1 {
|
|
|
547
580
|
};
|
|
548
581
|
trades: any[];
|
|
549
582
|
}>;
|
|
583
|
+
determineAmountToBuy(payload: {
|
|
584
|
+
orders: any[];
|
|
585
|
+
kind: "long" | "short";
|
|
586
|
+
decimal_places?: string;
|
|
587
|
+
price_places?: string;
|
|
588
|
+
symbol: string;
|
|
589
|
+
place?: boolean;
|
|
590
|
+
}): Promise<any[]>;
|
|
550
591
|
placeSharedOrder(action: "place_limit_orders" | "place_stop_orders" | "place_tp_orders", payload: {
|
|
551
592
|
symbol: string;
|
|
552
593
|
entry: number;
|
|
@@ -555,16 +596,19 @@ declare class ExchangeAccount$1 {
|
|
|
555
596
|
risk: number;
|
|
556
597
|
place?: boolean;
|
|
557
598
|
update_db?: boolean;
|
|
599
|
+
raw?: boolean;
|
|
558
600
|
}): Promise<any>;
|
|
559
601
|
getPositionConfig(payload: {
|
|
560
602
|
symbol: string;
|
|
561
603
|
kind: "long" | "short";
|
|
562
604
|
params?: {
|
|
563
|
-
entry
|
|
564
|
-
stop
|
|
565
|
-
risk_reward
|
|
566
|
-
risk
|
|
605
|
+
entry?: number;
|
|
606
|
+
stop?: number;
|
|
607
|
+
risk_reward?: number;
|
|
608
|
+
risk?: number;
|
|
567
609
|
profit_percent?: number;
|
|
610
|
+
place_tp?: boolean;
|
|
611
|
+
profit?: number;
|
|
568
612
|
};
|
|
569
613
|
}): Promise<ScheduledTrade | import("pocketbase").RecordModel>;
|
|
570
614
|
getCurrentPrice(symbol: string): Promise<any>;
|
|
@@ -651,37 +695,24 @@ declare class ExchangeAccount$1 {
|
|
|
651
695
|
risk_reward: number;
|
|
652
696
|
risk: number;
|
|
653
697
|
symbol: string;
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
avg_entry: any;
|
|
661
|
-
risk_reward: number;
|
|
662
|
-
neg_pnl: any;
|
|
663
|
-
risk: number;
|
|
664
|
-
}>;
|
|
698
|
+
with_trades?: boolean;
|
|
699
|
+
}): Promise<any>;
|
|
700
|
+
build_short_order(payload: {
|
|
701
|
+
symbol: string;
|
|
702
|
+
kind: "long" | "short";
|
|
703
|
+
}): Promise<any>;
|
|
665
704
|
extrapolateShortConfig(payload: {
|
|
666
705
|
kind: "long" | "short";
|
|
667
706
|
symbol: string;
|
|
668
707
|
risk_reward?: number;
|
|
669
708
|
risk?: number;
|
|
670
|
-
}): Promise<
|
|
671
|
-
place_stop: boolean;
|
|
672
|
-
profit_percent: number;
|
|
673
|
-
entry: number;
|
|
674
|
-
stop: number;
|
|
675
|
-
avg_size: any;
|
|
676
|
-
avg_entry: any;
|
|
677
|
-
risk_reward: number;
|
|
678
|
-
neg_pnl: any;
|
|
679
|
-
risk: number;
|
|
680
|
-
}>;
|
|
709
|
+
}): Promise<any>;
|
|
681
710
|
triggerTradeFromConfig(payload: {
|
|
682
711
|
symbol: string;
|
|
683
712
|
kind: "long" | "short";
|
|
684
713
|
place?: boolean;
|
|
714
|
+
raw?: boolean;
|
|
715
|
+
tp?: boolean;
|
|
685
716
|
}): Promise<any>;
|
|
686
717
|
verifyStopLoss(payload: {
|
|
687
718
|
symbol: string;
|
|
@@ -701,16 +732,46 @@ declare class ExchangeAccount$1 {
|
|
|
701
732
|
symbol: string;
|
|
702
733
|
refresh?: boolean;
|
|
703
734
|
}): Promise<SymbolConfig>;
|
|
735
|
+
/**
|
|
736
|
+
* This function builds a config for a symbol
|
|
737
|
+
* @param payload
|
|
738
|
+
* @returns
|
|
739
|
+
*/
|
|
740
|
+
buildConfigForSymbol(payload: {
|
|
741
|
+
symbol: string;
|
|
742
|
+
risk: number;
|
|
743
|
+
kind?: "long" | "short";
|
|
744
|
+
risk_reward?: number;
|
|
745
|
+
as_config?: boolean;
|
|
746
|
+
with_trades?: boolean;
|
|
747
|
+
}): Promise<any>;
|
|
704
748
|
triggerBullishMarket(payload: {
|
|
705
749
|
symbol: string;
|
|
706
750
|
profit_percent?: number;
|
|
707
751
|
risk_reward?: number;
|
|
708
752
|
}): Promise<any>;
|
|
709
|
-
updateAllActiveSymbols(
|
|
753
|
+
updateAllActiveSymbols(payload: {
|
|
754
|
+
interval?: number;
|
|
755
|
+
}): Promise<void>;
|
|
710
756
|
updateAllPositionsWithNoConfig(payload: {
|
|
711
757
|
kind: "long" | "short";
|
|
712
758
|
}): Promise<void>;
|
|
759
|
+
getSymbolsForPositions(): Promise<any[]>;
|
|
713
760
|
getNonEssentialSymbols(): Promise<any[]>;
|
|
761
|
+
_terminatePositions(payload: {
|
|
762
|
+
symbol: string;
|
|
763
|
+
}): Promise<void>;
|
|
764
|
+
getOrders(payload: {
|
|
765
|
+
symbol: string;
|
|
766
|
+
kind: "long" | "short";
|
|
767
|
+
type: "limit" | "stop" | "tp";
|
|
768
|
+
refresh?: boolean;
|
|
769
|
+
}): Promise<import("pocketbase").RecordModel[]>;
|
|
770
|
+
syncPositionConfigs(payload: {
|
|
771
|
+
symbol: string;
|
|
772
|
+
kind: "long" | "short";
|
|
773
|
+
refresh?: boolean;
|
|
774
|
+
}): Promise<void>;
|
|
714
775
|
terminatePositions(payload: {
|
|
715
776
|
symbol: string;
|
|
716
777
|
}): Promise<void>;
|
|
@@ -722,14 +783,20 @@ declare class ExchangeAccount$1 {
|
|
|
722
783
|
symbol: string;
|
|
723
784
|
kind: "long" | "short";
|
|
724
785
|
}): Promise<number>;
|
|
786
|
+
placeTrade(payload: {
|
|
787
|
+
symbol: string;
|
|
788
|
+
kind: "long" | "short";
|
|
789
|
+
place?: boolean;
|
|
790
|
+
tp?: boolean;
|
|
791
|
+
}): Promise<any>;
|
|
725
792
|
}
|
|
726
793
|
declare class App {
|
|
727
794
|
private app_db;
|
|
728
795
|
private getCredentials;
|
|
729
|
-
constructor(app_db: AppDatabase, getCredentials: (account: string, exchange: string) =>
|
|
796
|
+
constructor(app_db: AppDatabase, getCredentials: (account: string, exchange: string) => {
|
|
730
797
|
api_key: string;
|
|
731
798
|
api_secret: string;
|
|
732
|
-
}
|
|
799
|
+
});
|
|
733
800
|
getExchangeAccount(account: ExchangeType): Promise<ExchangeAccount$1>;
|
|
734
801
|
syncAccount(payload: {
|
|
735
802
|
account: ExchangeType;
|
|
@@ -812,6 +879,18 @@ declare class App {
|
|
|
812
879
|
refreshAllPositionsWithSymbol(payload: {
|
|
813
880
|
symbol: string;
|
|
814
881
|
}): Promise<void>;
|
|
882
|
+
getMoverExchangeInstances(): Promise<ExchangeAccount[]>;
|
|
883
|
+
updateTpOnAllMarkets(): Promise<void>;
|
|
884
|
+
triggerMoverTask(payload: {
|
|
885
|
+
callback: (params: {
|
|
886
|
+
symbol: string;
|
|
887
|
+
account: ExchangeType;
|
|
888
|
+
}) => Promise<any>;
|
|
889
|
+
removeCallback?: (params: {
|
|
890
|
+
symbol: string;
|
|
891
|
+
account: ExchangeType;
|
|
892
|
+
}) => Promise<any>;
|
|
893
|
+
}): Promise<void>;
|
|
815
894
|
}
|
|
816
895
|
export declare function initApp(payload: {
|
|
817
896
|
db: {
|
|
@@ -819,12 +898,13 @@ export declare function initApp(payload: {
|
|
|
819
898
|
email: string;
|
|
820
899
|
password: string;
|
|
821
900
|
};
|
|
822
|
-
|
|
901
|
+
password?: string;
|
|
902
|
+
getCredentials: (account: string, exchange: string) => {
|
|
823
903
|
api_key: string;
|
|
824
904
|
api_secret: string;
|
|
825
|
-
}
|
|
905
|
+
};
|
|
826
906
|
}): Promise<App>;
|
|
827
|
-
export declare function initialize(): Promise<App>;
|
|
907
|
+
export declare function initialize(password?: string): Promise<App>;
|
|
828
908
|
|
|
829
909
|
export {
|
|
830
910
|
ExchangeAccount$1 as ExchangeAccount,
|