@gbozee/ultimate 0.0.2-3 → 0.0.2-30
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/frontend-index.js +1318 -0
- package/dist/frontend-index.js +1318 -0
- package/dist/index.d.ts +421 -108
- package/dist/index.js +3657 -977
- package/package.json +7 -2
package/dist/index.d.ts
CHANGED
|
@@ -85,10 +85,15 @@ export interface BaseExchange {
|
|
|
85
85
|
count: number;
|
|
86
86
|
raw?: boolean;
|
|
87
87
|
}): Promise<any>;
|
|
88
|
-
getExchangeAccountInfo(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
getExchangeAccountInfo(options: {
|
|
89
|
+
price_places?: string;
|
|
90
|
+
decimal_places?: string;
|
|
91
|
+
account: {
|
|
92
|
+
owner: string;
|
|
93
|
+
exchange: string;
|
|
94
|
+
};
|
|
95
|
+
symbol: string;
|
|
96
|
+
}): Promise<any>;
|
|
92
97
|
cancelOrders(payload: {
|
|
93
98
|
symbol: string;
|
|
94
99
|
orders: number[];
|
|
@@ -117,6 +122,47 @@ export interface BaseExchange {
|
|
|
117
122
|
price_places?: string;
|
|
118
123
|
decimal_places?: string;
|
|
119
124
|
}): Promise<any>;
|
|
125
|
+
setLeverage(payload: {
|
|
126
|
+
symbol: string;
|
|
127
|
+
leverage: number;
|
|
128
|
+
}): Promise<any>;
|
|
129
|
+
generateConfig(payload: {
|
|
130
|
+
symbol: string;
|
|
131
|
+
interval?: any;
|
|
132
|
+
limit?: number;
|
|
133
|
+
}): Promise<any>;
|
|
134
|
+
checkDelistedMovers(payload: {
|
|
135
|
+
movePercent: number;
|
|
136
|
+
include_delisted?: boolean;
|
|
137
|
+
}): Promise<any>;
|
|
138
|
+
closePosition(payload: {
|
|
139
|
+
symbol: string;
|
|
140
|
+
kind: "long" | "short";
|
|
141
|
+
price_places?: string;
|
|
142
|
+
decimal_places?: string;
|
|
143
|
+
}): Promise<any>;
|
|
144
|
+
getAllOpenSymbols(): Promise<string[]>;
|
|
145
|
+
createLimitPurchaseOrders(payload: {
|
|
146
|
+
orders: any[];
|
|
147
|
+
kind: "long" | "short";
|
|
148
|
+
decimal_places?: string;
|
|
149
|
+
price_places?: string;
|
|
150
|
+
symbol: string;
|
|
151
|
+
}): Promise<any>;
|
|
152
|
+
getDelistedSpotSymbols(): Promise<any>;
|
|
153
|
+
getOpenPositions(): Promise<any>;
|
|
154
|
+
crossAccountTransfer(payload: {
|
|
155
|
+
from: {
|
|
156
|
+
owner: string;
|
|
157
|
+
wallet: string;
|
|
158
|
+
};
|
|
159
|
+
to: {
|
|
160
|
+
owner: string;
|
|
161
|
+
wallet: string;
|
|
162
|
+
};
|
|
163
|
+
asset: string;
|
|
164
|
+
amount: number;
|
|
165
|
+
}): Promise<any>;
|
|
120
166
|
}
|
|
121
167
|
export interface BaseSystemFields {
|
|
122
168
|
id: string;
|
|
@@ -131,6 +177,17 @@ export interface ExchangeAccount extends BaseSystemFields {
|
|
|
131
177
|
usdt?: number;
|
|
132
178
|
usdc?: number;
|
|
133
179
|
proxy?: string;
|
|
180
|
+
bullish?: boolean;
|
|
181
|
+
bearish?: boolean;
|
|
182
|
+
movePercent?: number;
|
|
183
|
+
totalRisk?: number;
|
|
184
|
+
max_non_essential?: number;
|
|
185
|
+
profit_percent?: number;
|
|
186
|
+
risk_reward?: number;
|
|
187
|
+
exclude_coins?: {
|
|
188
|
+
bullish?: string[];
|
|
189
|
+
};
|
|
190
|
+
include_delisted?: boolean;
|
|
134
191
|
}
|
|
135
192
|
export interface SymbolConfig extends BaseSystemFields {
|
|
136
193
|
symbol: string;
|
|
@@ -142,6 +199,8 @@ export interface SymbolConfig extends BaseSystemFields {
|
|
|
142
199
|
min_size?: number;
|
|
143
200
|
weight?: number;
|
|
144
201
|
leverage?: number;
|
|
202
|
+
candle_count?: number;
|
|
203
|
+
interval?: any;
|
|
145
204
|
}
|
|
146
205
|
export interface ScheduledTrade extends BaseSystemFields {
|
|
147
206
|
symbol: string;
|
|
@@ -213,26 +272,58 @@ export interface BullishMarket extends RecordModel {
|
|
|
213
272
|
export interface WindingDownMarket extends RecordModel {
|
|
214
273
|
id: string;
|
|
215
274
|
symbol: string;
|
|
275
|
+
risk_reward: number;
|
|
216
276
|
}
|
|
217
277
|
export type ExchangeType = {
|
|
218
278
|
owner: string;
|
|
219
279
|
exchange: string;
|
|
220
280
|
};
|
|
221
281
|
export declare class AppDatabase {
|
|
222
|
-
|
|
282
|
+
pb: PocketBase;
|
|
223
283
|
constructor(pb: PocketBase);
|
|
284
|
+
getCredentials(password: string): any;
|
|
285
|
+
saveCredentials(password: string, credentials: any): Promise<void>;
|
|
286
|
+
addNewCredential(password: string, payload: {
|
|
287
|
+
name: string;
|
|
288
|
+
exchange: string;
|
|
289
|
+
api_key: string;
|
|
290
|
+
api_secret: string;
|
|
291
|
+
}): Promise<void>;
|
|
292
|
+
getAllSymbolsFromPositions(options?: {
|
|
293
|
+
no_position?: boolean;
|
|
294
|
+
kind?: "long" | "short";
|
|
295
|
+
custom_filter?: string;
|
|
296
|
+
}): Promise<any[]>;
|
|
297
|
+
createOrUpdateLiveExchangeInstance(payload: {
|
|
298
|
+
account: ExchangeType;
|
|
299
|
+
symbol: string;
|
|
300
|
+
data?: any;
|
|
301
|
+
}): Promise<import("pocketbase").RecordModel>;
|
|
302
|
+
getLiveExchangeInstance(payload: {
|
|
303
|
+
account: ExchangeType;
|
|
304
|
+
symbol: string;
|
|
305
|
+
data?: any;
|
|
306
|
+
}): Promise<import("pocketbase").RecordModel>;
|
|
224
307
|
getProxyForAccount(account: ExchangeType): Promise<HttpsProxyAgent<`http://${string}`> | SocksProxyAgent>;
|
|
308
|
+
getAccounts(): Promise<ExchangeAccount[]>;
|
|
309
|
+
getAllSymbolConfigs(payload?: {
|
|
310
|
+
with_positions?: boolean;
|
|
311
|
+
custom_filter?: string;
|
|
312
|
+
}): Promise<SymbolConfig[]>;
|
|
225
313
|
get_exchange_db_instance(account: ExchangeType): Promise<ExchangeAccount & {
|
|
226
314
|
expand?: {
|
|
227
315
|
proxy: Proxy$1;
|
|
228
316
|
};
|
|
229
317
|
}>;
|
|
230
|
-
getPositions(
|
|
231
|
-
|
|
318
|
+
getPositions(options: {
|
|
319
|
+
account?: ExchangeType;
|
|
320
|
+
symbol?: string;
|
|
232
321
|
as_view?: boolean;
|
|
322
|
+
custom_filter?: string;
|
|
233
323
|
}): Promise<(PositionsView & {
|
|
234
324
|
expand?: {
|
|
235
325
|
config: ScheduledTrade;
|
|
326
|
+
account: ExchangeAccount;
|
|
236
327
|
};
|
|
237
328
|
})[]>;
|
|
238
329
|
private _createOrUpdatePosition;
|
|
@@ -244,18 +335,19 @@ export declare class AppDatabase {
|
|
|
244
335
|
}): Promise<(PositionsView & {
|
|
245
336
|
expand?: {
|
|
246
337
|
config: ScheduledTrade;
|
|
338
|
+
account: ExchangeAccount;
|
|
247
339
|
};
|
|
248
340
|
})[]>;
|
|
249
|
-
update_db_position(position: any, payload: any): Promise<RecordModel>;
|
|
341
|
+
update_db_position(position: any, payload: any): Promise<import("pocketbase").RecordModel>;
|
|
250
342
|
getSymbolConfigFromDB(symbol: string): Promise<SymbolConfig>;
|
|
251
343
|
getRunningInstanceFromDB(account: ExchangeType, symbol: string, options?: {
|
|
252
344
|
delay?: number;
|
|
253
345
|
}): Promise<TradeBlockTracking>;
|
|
254
|
-
updateRunningInstance(id: string, running: boolean): Promise<RecordModel>;
|
|
346
|
+
updateRunningInstance(id: string, running: boolean): Promise<import("pocketbase").RecordModel>;
|
|
255
347
|
getOrders(account: ExchangeType, options: {
|
|
256
348
|
symbol: string;
|
|
257
349
|
kind: "long" | "short";
|
|
258
|
-
}): Promise<RecordModel[]>;
|
|
350
|
+
}): Promise<import("pocketbase").RecordModel[]>;
|
|
259
351
|
deleteAndRecreateOrders(account: ExchangeType, options: {
|
|
260
352
|
symbol: string;
|
|
261
353
|
kind: "long" | "short";
|
|
@@ -268,7 +360,7 @@ export declare class AppDatabase {
|
|
|
268
360
|
stop: number;
|
|
269
361
|
order_id: string;
|
|
270
362
|
triggerPrice?: number;
|
|
271
|
-
}>): Promise<RecordModel[]>;
|
|
363
|
+
}>): Promise<import("pocketbase").RecordModel[]>;
|
|
272
364
|
cancelOrders(payload: {
|
|
273
365
|
cancelExchangeOrders: (payload: {
|
|
274
366
|
symbol: string;
|
|
@@ -296,44 +388,63 @@ export declare class AppDatabase {
|
|
|
296
388
|
message?: undefined;
|
|
297
389
|
exchange_result?: undefined;
|
|
298
390
|
}>;
|
|
391
|
+
getMoverExchangeInstances(): Promise<ExchangeAccount[]>;
|
|
392
|
+
updateScheduledTrade(id: string, payload: any): Promise<import("pocketbase").RecordModel>;
|
|
299
393
|
createOrUpdatePositionConfig(db_position: any, payload: {
|
|
300
394
|
entry: number;
|
|
301
395
|
stop: number;
|
|
302
396
|
risk_reward: number;
|
|
303
397
|
risk: number;
|
|
304
398
|
profit_percent?: number;
|
|
305
|
-
|
|
399
|
+
place_tp?: boolean;
|
|
400
|
+
profit?: number;
|
|
401
|
+
}): Promise<ScheduledTrade | import("pocketbase").RecordModel>;
|
|
306
402
|
getPositionConfig(payload: {
|
|
307
403
|
symbol: string;
|
|
308
404
|
kind: "long" | "short";
|
|
309
405
|
account: ExchangeType;
|
|
310
|
-
}): Promise<
|
|
406
|
+
}): Promise<ScheduledTrade | null>;
|
|
311
407
|
getPositionStrategy(account: ExchangeType): Promise<{
|
|
312
408
|
strategy_instance: Strategy;
|
|
313
409
|
focus_account: ExchangeAccount;
|
|
314
410
|
}>;
|
|
315
|
-
createOrUpdateWindingDownMarket(
|
|
316
|
-
|
|
411
|
+
createOrUpdateWindingDownMarket(payload: {
|
|
412
|
+
symbol: string;
|
|
413
|
+
risk_reward?: number;
|
|
414
|
+
}): Promise<import("pocketbase").RecordModel>;
|
|
415
|
+
getWindingDownMarkets(symbol?: string): Promise<WindingDownMarket[]>;
|
|
416
|
+
getBullishMarket(symbol: string): Promise<BullishMarket>;
|
|
317
417
|
getBullishMarkets(options?: {
|
|
318
418
|
new_markets: Array<{
|
|
319
419
|
symbol: string;
|
|
320
420
|
percent: number;
|
|
321
421
|
}>;
|
|
322
422
|
totalRisk: number;
|
|
423
|
+
max_count?: number;
|
|
323
424
|
}): Promise<{
|
|
324
425
|
updated_bullish: BullishMarket[];
|
|
325
426
|
moved_to_winding: WindingDownMarket[];
|
|
326
427
|
}>;
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
428
|
+
updateSymbolConfigs(payload?: {
|
|
429
|
+
configs: Array<{
|
|
430
|
+
symbol: string;
|
|
431
|
+
support: number;
|
|
432
|
+
leverage: number;
|
|
433
|
+
min_size: number;
|
|
434
|
+
resistance: number;
|
|
435
|
+
price_places: string;
|
|
436
|
+
decimal_places: string;
|
|
437
|
+
}>;
|
|
438
|
+
}): Promise<{
|
|
439
|
+
updated: number;
|
|
440
|
+
created: number;
|
|
441
|
+
} | SymbolConfig[]>;
|
|
442
|
+
unwindSymbolFromDB(symbol: string): Promise<boolean>;
|
|
443
|
+
hasExistingPosition(symbol: string): Promise<import("pocketbase").RecordModel[]>;
|
|
444
|
+
hasExistingOrders(symbol: string): Promise<import("pocketbase").RecordModel[]>;
|
|
445
|
+
removeSymbolFromUnwindingMarkets(symbol: string): Promise<boolean>;
|
|
446
|
+
removePosition(position: any): Promise<void>;
|
|
447
|
+
removePositionConfig(position: any): Promise<void>;
|
|
337
448
|
}
|
|
338
449
|
export type AppConfig = {
|
|
339
450
|
fee: number;
|
|
@@ -360,16 +471,35 @@ export type AppConfig = {
|
|
|
360
471
|
gap?: number;
|
|
361
472
|
rr?: number;
|
|
362
473
|
max_size?: number;
|
|
474
|
+
last_value?: any;
|
|
475
|
+
entries?: any[];
|
|
363
476
|
};
|
|
364
477
|
declare class ExchangeAccount$1 {
|
|
365
478
|
private instance;
|
|
366
|
-
|
|
479
|
+
exchange: BaseExchange;
|
|
480
|
+
main_exchange?: BaseExchange;
|
|
367
481
|
private app_db;
|
|
368
482
|
constructor(payload: ExchangeType, options: {
|
|
369
483
|
exchange: BaseExchange;
|
|
370
484
|
app_db: AppDatabase;
|
|
485
|
+
main_exchange?: BaseExchange;
|
|
371
486
|
});
|
|
372
|
-
|
|
487
|
+
/**
|
|
488
|
+
*In order to avoid rate limiting issues, we cache the live exchange
|
|
489
|
+
details for each symbol for an account in the database with an option
|
|
490
|
+
to refresh.
|
|
491
|
+
*/
|
|
492
|
+
getDBInstance(): AppDatabase;
|
|
493
|
+
getLiveExchangeInstance(payload: {
|
|
494
|
+
symbol: string;
|
|
495
|
+
refresh?: boolean;
|
|
496
|
+
refresh_symbol_config?: boolean;
|
|
497
|
+
}): Promise<import("pocketbase").RecordModel>;
|
|
498
|
+
getActiveAccount(payload: {
|
|
499
|
+
symbol: string;
|
|
500
|
+
full?: boolean;
|
|
501
|
+
refresh?: boolean;
|
|
502
|
+
}): Promise<Account | {
|
|
373
503
|
liquidation: {
|
|
374
504
|
long: number;
|
|
375
505
|
short: number;
|
|
@@ -383,13 +513,12 @@ declare class ExchangeAccount$1 {
|
|
|
383
513
|
kind?: "long" | "short";
|
|
384
514
|
update?: boolean;
|
|
385
515
|
as_view?: boolean;
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
};
|
|
390
|
-
}) | (PositionsView & {
|
|
516
|
+
leverage?: number;
|
|
517
|
+
live_refresh?: boolean;
|
|
518
|
+
}): Promise<PositionsView | (PositionsView & {
|
|
391
519
|
expand?: {
|
|
392
520
|
config: ScheduledTrade;
|
|
521
|
+
account: ExchangeAccount;
|
|
393
522
|
};
|
|
394
523
|
})[]>;
|
|
395
524
|
getRunningInstanceFromDB(symbol: string): Promise<TradeBlockTracking>;
|
|
@@ -398,6 +527,11 @@ declare class ExchangeAccount$1 {
|
|
|
398
527
|
kind: "long" | "short";
|
|
399
528
|
update?: boolean;
|
|
400
529
|
}): Promise<import("pocketbase").RecordModel[]>;
|
|
530
|
+
toggleStopBuying(payload: {
|
|
531
|
+
symbol: string;
|
|
532
|
+
kind: "long" | "short";
|
|
533
|
+
should_stop?: boolean;
|
|
534
|
+
}): Promise<import("pocketbase").RecordModel>;
|
|
401
535
|
cancelOrders(payload: {
|
|
402
536
|
symbol: string;
|
|
403
537
|
kind: "long" | "short";
|
|
@@ -461,9 +595,18 @@ declare class ExchangeAccount$1 {
|
|
|
461
595
|
kind: "long" | "short";
|
|
462
596
|
quantity: any;
|
|
463
597
|
is_limit: boolean;
|
|
598
|
+
neg_pnl: any;
|
|
464
599
|
};
|
|
465
600
|
trades: any[];
|
|
466
601
|
}>;
|
|
602
|
+
determineAmountToBuy(payload: {
|
|
603
|
+
orders: any[];
|
|
604
|
+
kind: "long" | "short";
|
|
605
|
+
decimal_places?: string;
|
|
606
|
+
price_places?: string;
|
|
607
|
+
symbol: string;
|
|
608
|
+
place?: boolean;
|
|
609
|
+
}): Promise<any[]>;
|
|
467
610
|
placeSharedOrder(action: "place_limit_orders" | "place_stop_orders" | "place_tp_orders", payload: {
|
|
468
611
|
symbol: string;
|
|
469
612
|
entry: number;
|
|
@@ -472,44 +615,222 @@ declare class ExchangeAccount$1 {
|
|
|
472
615
|
risk: number;
|
|
473
616
|
place?: boolean;
|
|
474
617
|
update_db?: boolean;
|
|
618
|
+
raw?: boolean;
|
|
619
|
+
use_current?: boolean;
|
|
475
620
|
}): Promise<any>;
|
|
476
621
|
getPositionConfig(payload: {
|
|
477
622
|
symbol: string;
|
|
478
623
|
kind: "long" | "short";
|
|
479
624
|
params?: {
|
|
480
|
-
entry
|
|
481
|
-
stop
|
|
482
|
-
risk_reward
|
|
483
|
-
risk
|
|
625
|
+
entry?: number;
|
|
626
|
+
stop?: number;
|
|
627
|
+
risk_reward?: number;
|
|
628
|
+
risk?: number;
|
|
484
629
|
profit_percent?: number;
|
|
630
|
+
place_tp?: boolean;
|
|
631
|
+
profit?: number;
|
|
485
632
|
};
|
|
486
|
-
}): Promise<import("pocketbase").RecordModel>;
|
|
633
|
+
}): Promise<ScheduledTrade | import("pocketbase").RecordModel>;
|
|
487
634
|
getCurrentPrice(symbol: string): Promise<any>;
|
|
488
635
|
getPositionStrategy(): Promise<{
|
|
489
636
|
strategy_instance: Strategy;
|
|
490
637
|
focus_account: ExchangeAccount;
|
|
491
638
|
}>;
|
|
639
|
+
buildReduceConfig(payload: {
|
|
640
|
+
symbol: string;
|
|
641
|
+
kind?: "long" | "short";
|
|
642
|
+
as_dict?: boolean;
|
|
643
|
+
trigger?: {
|
|
644
|
+
long: boolean;
|
|
645
|
+
short: boolean;
|
|
646
|
+
};
|
|
647
|
+
use_full?: boolean;
|
|
648
|
+
}): Promise<{
|
|
649
|
+
trigger_short: boolean;
|
|
650
|
+
trigger_long: boolean;
|
|
651
|
+
symbol: string;
|
|
652
|
+
short_minimum_pnl: number;
|
|
653
|
+
long_minimum_pnl: number;
|
|
654
|
+
short_profit: any;
|
|
655
|
+
long_profit: any;
|
|
656
|
+
owner: string;
|
|
657
|
+
exchange: string;
|
|
658
|
+
not_reduce: boolean;
|
|
659
|
+
reduce_ratio_long: any;
|
|
660
|
+
reduce_ratio_short: any;
|
|
661
|
+
use_full_long: any;
|
|
662
|
+
use_full_short: any;
|
|
663
|
+
} | {
|
|
664
|
+
long: {
|
|
665
|
+
minimum_pnl: number;
|
|
666
|
+
max_size: number;
|
|
667
|
+
profit: any;
|
|
668
|
+
increase: boolean;
|
|
669
|
+
not_reduce: boolean;
|
|
670
|
+
ratio: any;
|
|
671
|
+
use_full: boolean;
|
|
672
|
+
};
|
|
673
|
+
short: {
|
|
674
|
+
minimum_pnl: number;
|
|
675
|
+
max_size: number;
|
|
676
|
+
profit: any;
|
|
677
|
+
increase: boolean;
|
|
678
|
+
not_reduce: boolean;
|
|
679
|
+
ratio: any;
|
|
680
|
+
use_full: boolean;
|
|
681
|
+
};
|
|
682
|
+
trigger: {
|
|
683
|
+
long: boolean;
|
|
684
|
+
short: boolean;
|
|
685
|
+
};
|
|
686
|
+
}>;
|
|
492
687
|
getOriginalPlannedStop(payload: {
|
|
493
688
|
symbol: string;
|
|
494
689
|
kind: "long" | "short";
|
|
495
690
|
}): Promise<any>;
|
|
496
|
-
syncReduceClosePosition(
|
|
691
|
+
syncReduceClosePosition(payload?: {
|
|
692
|
+
symbol: string;
|
|
497
693
|
kind?: "long" | "short";
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
694
|
+
trigger?: boolean;
|
|
695
|
+
}): Promise<any>;
|
|
696
|
+
reduceMajorPositionEntry(payload: {
|
|
697
|
+
symbol: string;
|
|
698
|
+
long: any;
|
|
699
|
+
short: any;
|
|
700
|
+
trigger: {
|
|
501
701
|
long: boolean;
|
|
502
702
|
short: boolean;
|
|
503
703
|
};
|
|
504
704
|
}): Promise<any>;
|
|
705
|
+
placeProfitAndStop(payload: {
|
|
706
|
+
symbol: string;
|
|
707
|
+
trigger?: boolean;
|
|
708
|
+
refresh?: boolean;
|
|
709
|
+
kind?: "long" | "short";
|
|
710
|
+
}): Promise<any>;
|
|
711
|
+
reEnterPositionOnEmpty(symbol: string): Promise<void>;
|
|
712
|
+
generate_config_params(payload: {
|
|
713
|
+
entry: number;
|
|
714
|
+
stop: number;
|
|
715
|
+
risk_reward: number;
|
|
716
|
+
risk: number;
|
|
717
|
+
symbol: string;
|
|
718
|
+
with_trades?: boolean;
|
|
719
|
+
}): Promise<any>;
|
|
720
|
+
build_short_order(payload: {
|
|
721
|
+
symbol: string;
|
|
722
|
+
kind: "long" | "short";
|
|
723
|
+
}): Promise<any>;
|
|
724
|
+
extrapolateShortConfig(payload: {
|
|
725
|
+
kind: "long" | "short";
|
|
726
|
+
symbol: string;
|
|
727
|
+
risk_reward?: number;
|
|
728
|
+
risk?: number;
|
|
729
|
+
}): Promise<any>;
|
|
730
|
+
triggerTradeFromConfig(payload: {
|
|
731
|
+
symbol: string;
|
|
732
|
+
kind: "long" | "short";
|
|
733
|
+
place?: boolean;
|
|
734
|
+
raw?: boolean;
|
|
735
|
+
tp?: boolean;
|
|
736
|
+
stop?: boolean;
|
|
737
|
+
}): Promise<any>;
|
|
738
|
+
verifyStopLoss(payload: {
|
|
739
|
+
symbol: string;
|
|
740
|
+
kind: "long" | "short";
|
|
741
|
+
revert?: boolean;
|
|
742
|
+
}): Promise<import("pocketbase").RecordModel[]>;
|
|
743
|
+
windDownSymbol(payload: {
|
|
744
|
+
symbol: string;
|
|
745
|
+
risk_reward?: number;
|
|
746
|
+
risk?: number;
|
|
747
|
+
}): Promise<void>;
|
|
748
|
+
updateTargetPnl(payload: {
|
|
749
|
+
symbol: string;
|
|
750
|
+
kind: "long" | "short";
|
|
751
|
+
}): Promise<number>;
|
|
752
|
+
recomputeSymbolConfig(payload: {
|
|
753
|
+
symbol: string;
|
|
754
|
+
refresh?: boolean;
|
|
755
|
+
}): Promise<SymbolConfig>;
|
|
756
|
+
/**
|
|
757
|
+
* This function builds a config for a symbol
|
|
758
|
+
* @param payload
|
|
759
|
+
* @returns
|
|
760
|
+
*/
|
|
761
|
+
buildConfigForSymbol(payload: {
|
|
762
|
+
symbol: string;
|
|
763
|
+
risk: number;
|
|
764
|
+
kind?: "long" | "short";
|
|
765
|
+
risk_reward?: number;
|
|
766
|
+
as_config?: boolean;
|
|
767
|
+
with_trades?: boolean;
|
|
768
|
+
}): Promise<any>;
|
|
769
|
+
triggerBullishMarket(payload: {
|
|
770
|
+
symbol: string;
|
|
771
|
+
profit_percent?: number;
|
|
772
|
+
risk_reward?: number;
|
|
773
|
+
}): Promise<any>;
|
|
774
|
+
updateAllActiveSymbols(payload: {
|
|
775
|
+
interval?: number;
|
|
776
|
+
}): Promise<void>;
|
|
777
|
+
updateAllPositionsWithNoConfig(payload: {
|
|
778
|
+
kind: "long" | "short";
|
|
779
|
+
}): Promise<void>;
|
|
780
|
+
getSymbolsForPositions(): Promise<any[]>;
|
|
781
|
+
getNonEssentialSymbols(): Promise<any[]>;
|
|
782
|
+
_terminatePositions(payload: {
|
|
783
|
+
symbol: string;
|
|
784
|
+
}): Promise<void>;
|
|
785
|
+
getOrders(payload: {
|
|
786
|
+
symbol: string;
|
|
787
|
+
kind: "long" | "short";
|
|
788
|
+
type: "limit" | "stop" | "tp";
|
|
789
|
+
refresh?: boolean;
|
|
790
|
+
}): Promise<import("pocketbase").RecordModel[]>;
|
|
791
|
+
syncPositionConfigs(payload: {
|
|
792
|
+
symbol: string;
|
|
793
|
+
kind: "long" | "short";
|
|
794
|
+
refresh?: boolean;
|
|
795
|
+
}): Promise<void>;
|
|
796
|
+
terminatePositions(payload: {
|
|
797
|
+
symbol: string;
|
|
798
|
+
}): Promise<void>;
|
|
799
|
+
fetchAndUpdateTopMovers(): Promise<{
|
|
800
|
+
updated_bullish: BullishMarket[];
|
|
801
|
+
moved_to_winding: WindingDownMarket[];
|
|
802
|
+
}>;
|
|
803
|
+
computeTargetPnl(payload: {
|
|
804
|
+
symbol: string;
|
|
805
|
+
kind: "long" | "short";
|
|
806
|
+
}): Promise<number>;
|
|
807
|
+
placeTrade(payload: {
|
|
808
|
+
symbol: string;
|
|
809
|
+
kind: "long" | "short";
|
|
810
|
+
place?: boolean;
|
|
811
|
+
tp?: boolean;
|
|
812
|
+
stop?: boolean;
|
|
813
|
+
raw?: boolean;
|
|
814
|
+
cancel?: boolean;
|
|
815
|
+
}): Promise<any>;
|
|
505
816
|
}
|
|
506
817
|
declare class App {
|
|
507
|
-
|
|
818
|
+
app_db: AppDatabase;
|
|
819
|
+
proxyOptions?: {
|
|
820
|
+
proxy?: any;
|
|
821
|
+
ignore_proxy?: boolean;
|
|
822
|
+
canWithdraw?: boolean;
|
|
823
|
+
};
|
|
508
824
|
private getCredentials;
|
|
509
|
-
constructor(app_db: AppDatabase, getCredentials: (account: string, exchange: string) =>
|
|
825
|
+
constructor(app_db: AppDatabase, getCredentials: (account: string, exchange: string) => {
|
|
510
826
|
api_key: string;
|
|
511
827
|
api_secret: string;
|
|
512
|
-
|
|
828
|
+
email: string;
|
|
829
|
+
}, proxyOptions?: {
|
|
830
|
+
proxy?: any;
|
|
831
|
+
ignore_proxy?: boolean;
|
|
832
|
+
canWithdraw?: boolean;
|
|
833
|
+
});
|
|
513
834
|
getExchangeAccount(account: ExchangeType): Promise<ExchangeAccount$1>;
|
|
514
835
|
syncAccount(payload: {
|
|
515
836
|
account: ExchangeType;
|
|
@@ -517,13 +838,10 @@ declare class App {
|
|
|
517
838
|
kind?: "long" | "short";
|
|
518
839
|
update?: boolean;
|
|
519
840
|
as_view?: boolean;
|
|
520
|
-
}): Promise<(PositionsView & {
|
|
521
|
-
expand?: {
|
|
522
|
-
config: ScheduledTrade;
|
|
523
|
-
};
|
|
524
|
-
}) | (PositionsView & {
|
|
841
|
+
}): Promise<PositionsView | (PositionsView & {
|
|
525
842
|
expand?: {
|
|
526
843
|
config: ScheduledTrade;
|
|
844
|
+
account: ExchangeAccount;
|
|
527
845
|
};
|
|
528
846
|
})[]>;
|
|
529
847
|
syncOrders(payload: {
|
|
@@ -554,34 +872,6 @@ declare class App {
|
|
|
554
872
|
message?: undefined;
|
|
555
873
|
exchange_result?: undefined;
|
|
556
874
|
}>;
|
|
557
|
-
triggerTradeFromConfig(payload: {
|
|
558
|
-
account: ExchangeType;
|
|
559
|
-
symbol: string;
|
|
560
|
-
kind: "long" | "short";
|
|
561
|
-
}): Promise<any>;
|
|
562
|
-
toggleStopBuying(payload: {
|
|
563
|
-
account: ExchangeType;
|
|
564
|
-
symbol: string;
|
|
565
|
-
kind: "long" | "short";
|
|
566
|
-
should_stop?: boolean;
|
|
567
|
-
}): Promise<import("pocketbase").RecordModel>;
|
|
568
|
-
generate_config_params(exchange_account: ExchangeAccount$1, payload: {
|
|
569
|
-
entry: number;
|
|
570
|
-
stop: number;
|
|
571
|
-
risk_reward: number;
|
|
572
|
-
risk: number;
|
|
573
|
-
symbol: string;
|
|
574
|
-
}): Promise<{
|
|
575
|
-
place_stop: boolean;
|
|
576
|
-
profit_percent: number;
|
|
577
|
-
entry: number;
|
|
578
|
-
stop: number;
|
|
579
|
-
avg_size: any;
|
|
580
|
-
avg_entry: any;
|
|
581
|
-
risk_reward: number;
|
|
582
|
-
neg_pnl: any;
|
|
583
|
-
risk: number;
|
|
584
|
-
}>;
|
|
585
875
|
generateConfig(payload: {
|
|
586
876
|
account: ExchangeType;
|
|
587
877
|
symbol: string;
|
|
@@ -599,39 +889,51 @@ declare class App {
|
|
|
599
889
|
short_db_position: any;
|
|
600
890
|
balance: any;
|
|
601
891
|
}>;
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
risk: number;
|
|
892
|
+
getWindingDownMarkets(): Promise<WindingDownMarket[]>;
|
|
893
|
+
updateSymbolConfigs(payload: {
|
|
894
|
+
configs: {
|
|
895
|
+
symbol: string;
|
|
896
|
+
support: number;
|
|
897
|
+
leverage: number;
|
|
898
|
+
min_size: number;
|
|
899
|
+
resistance: number;
|
|
900
|
+
price_places: string;
|
|
901
|
+
decimal_places: string;
|
|
902
|
+
}[];
|
|
903
|
+
}): Promise<SymbolConfig[] | {
|
|
904
|
+
updated: number;
|
|
905
|
+
created: number;
|
|
617
906
|
}>;
|
|
618
|
-
|
|
907
|
+
updateAllAccountWithSymbols(with_positions?: boolean): Promise<void>;
|
|
908
|
+
windDownSymbol(payload: {
|
|
909
|
+
symbol: string;
|
|
910
|
+
risk?: number;
|
|
911
|
+
}): Promise<boolean>;
|
|
912
|
+
getNonEssentialSymbols(): Promise<Set<any>>;
|
|
913
|
+
refreshAllPositionsWithSymbol(payload: {
|
|
914
|
+
symbol: string;
|
|
915
|
+
}): Promise<void>;
|
|
916
|
+
getMoverExchangeInstances(): Promise<ExchangeAccount[]>;
|
|
917
|
+
updateTpOnAllMarkets(): Promise<void>;
|
|
918
|
+
triggerMoverTask(payload: {
|
|
919
|
+
callback: (params: {
|
|
920
|
+
symbol: string;
|
|
921
|
+
account: ExchangeType;
|
|
922
|
+
}) => Promise<any>;
|
|
923
|
+
removeCallback?: (params: {
|
|
924
|
+
symbol: string;
|
|
925
|
+
account: ExchangeType;
|
|
926
|
+
}) => Promise<any>;
|
|
927
|
+
}): Promise<void>;
|
|
928
|
+
placeTrade(payload: {
|
|
619
929
|
account: ExchangeType;
|
|
620
930
|
symbol: string;
|
|
621
931
|
kind: "long" | "short";
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
percent: number;
|
|
628
|
-
}[];
|
|
629
|
-
totalRisk: number;
|
|
630
|
-
}): Promise<{
|
|
631
|
-
updated_bullish: BullishMarket[];
|
|
632
|
-
moved_to_winding: WindingDownMarket[];
|
|
633
|
-
}>;
|
|
634
|
-
getWindingDownMarkets(): Promise<WindingDownMarket[]>;
|
|
932
|
+
place?: boolean;
|
|
933
|
+
tp?: boolean;
|
|
934
|
+
cancel?: boolean;
|
|
935
|
+
raw?: boolean;
|
|
936
|
+
}): Promise<any>;
|
|
635
937
|
}
|
|
636
938
|
export declare function initApp(payload: {
|
|
637
939
|
db: {
|
|
@@ -639,10 +941,21 @@ export declare function initApp(payload: {
|
|
|
639
941
|
email: string;
|
|
640
942
|
password: string;
|
|
641
943
|
};
|
|
642
|
-
|
|
944
|
+
password?: string;
|
|
945
|
+
getCredentials: (account: string, exchange: string) => {
|
|
643
946
|
api_key: string;
|
|
644
947
|
api_secret: string;
|
|
645
|
-
|
|
948
|
+
email: string;
|
|
949
|
+
};
|
|
950
|
+
proxy?: any;
|
|
951
|
+
ignore_proxy?: boolean;
|
|
952
|
+
canWithdraw?: boolean;
|
|
953
|
+
}): Promise<App>;
|
|
954
|
+
export declare function initialize(payload: {
|
|
955
|
+
password?: string;
|
|
956
|
+
proxy?: any;
|
|
957
|
+
ignore_proxy?: boolean;
|
|
958
|
+
canWithdraw?: boolean;
|
|
646
959
|
}): Promise<App>;
|
|
647
960
|
|
|
648
961
|
export {
|