@gbozee/ultimate 0.0.2-14 → 0.0.2-140

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 CHANGED
@@ -2,9 +2,233 @@
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;
9
+ export interface BaseSystemFields {
10
+ id: string;
11
+ created: string;
12
+ updated: string;
13
+ }
14
+ export interface ExchangeAccount extends BaseSystemFields {
15
+ exchange: "binance" | "bybit";
16
+ owner: string;
17
+ email?: string;
18
+ user?: string;
19
+ usdt?: number;
20
+ usdc?: number;
21
+ proxy?: string;
22
+ bullish?: boolean;
23
+ bearish?: boolean;
24
+ movePercent?: number;
25
+ totalRisk?: number;
26
+ max_non_essential?: number;
27
+ profit_percent?: number;
28
+ risk_reward?: number;
29
+ exclude_coins?: {
30
+ bullish?: string[];
31
+ };
32
+ include_delisted?: boolean;
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
+ }
44
+ export interface SymbolConfig extends BaseSystemFields {
45
+ symbol: string;
46
+ support?: number;
47
+ resistance?: number;
48
+ stop_percent?: number;
49
+ price_places?: string;
50
+ decimal_places?: string;
51
+ min_size?: number;
52
+ weight?: number;
53
+ leverage?: number;
54
+ candle_count?: number;
55
+ interval?: any;
56
+ fee_percent?: number;
57
+ }
58
+ export interface ScheduledTrade extends BaseSystemFields {
59
+ symbol: string;
60
+ account: string;
61
+ profit?: number;
62
+ risk?: number;
63
+ entry?: number;
64
+ stop?: number;
65
+ risk_reward?: number;
66
+ profit_percent?: number;
67
+ place_tp?: boolean;
68
+ kind?: "long" | "short";
69
+ follow?: boolean | 1 | 0;
70
+ reduce_ratio?: number;
71
+ sell_ratio?: number;
72
+ threshold_qty?: number;
73
+ pause_tp?: boolean;
74
+ stop_percent?: number;
75
+ }
76
+ export interface AccountStrategy extends BaseSystemFields {
77
+ account: string;
78
+ symbol: string;
79
+ risk?: number;
80
+ reward_factor?: number;
81
+ kind?: "long" | "short";
82
+ support?: number;
83
+ resistance?: number;
84
+ running?: boolean;
85
+ max_reward_factor?: number;
86
+ follow?: boolean;
87
+ risk_reward?: number;
88
+ dynamic?: boolean;
89
+ }
90
+ interface Proxy$1 extends BaseSystemFields {
91
+ ip_address?: string;
92
+ type?: "http" | "socks5";
93
+ }
94
+ export interface TradeBlockTracking extends BaseSystemFields {
95
+ account?: string;
96
+ symbol?: string;
97
+ running?: boolean;
98
+ }
99
+ export interface PositionsView {
100
+ id: string;
101
+ symbol?: any;
102
+ entry?: any;
103
+ quantity?: any;
104
+ take_profit?: any;
105
+ account?: any;
106
+ kind?: any;
107
+ target_pnl?: number;
108
+ liquidation?: number;
109
+ avg_price?: number;
110
+ avg_qty?: number;
111
+ next_order?: number;
112
+ last_order?: number;
113
+ config?: any;
114
+ stop_loss?: {
115
+ price: number;
116
+ quantity: number;
117
+ };
118
+ stop_pnl?: any;
119
+ leverage?: any;
120
+ avg_liquidation?: any;
121
+ balance?: any;
122
+ reduce_ratio?: number;
123
+ sell_ratio?: number;
124
+ threshold_qty?: number;
125
+ follow?: boolean | 1 | 0;
126
+ current_price?: number;
127
+ usd_balance?: number;
128
+ tp?: {
129
+ price: number;
130
+ quantity: number;
131
+ };
132
+ next_risk?: number;
133
+ }
134
+ export interface BullishMarket extends RecordModel {
135
+ id: string;
136
+ symbol: string;
137
+ risk: number;
138
+ }
139
+ export interface WindingDownMarket extends RecordModel {
140
+ id: string;
141
+ symbol: string;
142
+ risk_reward: number;
143
+ }
144
+ export interface BotInstance extends BaseSystemFields {
145
+ asset: string;
146
+ main_account?: string;
147
+ secondary_account?: string;
148
+ main_symbol: string;
149
+ secondary_symbol?: string;
150
+ direction?: "long" | "short";
151
+ budget?: number;
152
+ settings?: Record<string, any>;
153
+ user?: string;
154
+ }
155
+ export interface BotState extends BaseSystemFields {
156
+ bot: string;
157
+ running?: boolean;
158
+ status?: "main-trading" | "hedge-mode";
159
+ spot_quantity?: number;
160
+ exchange_details?: Record<string, any>;
161
+ completed?: boolean;
162
+ }
163
+ export interface BotOrderHistory extends BaseSystemFields {
164
+ field: string;
165
+ symbol: string;
166
+ pnl?: number;
167
+ kind?: "long" | "short";
168
+ type?: "future" | "spot";
169
+ }
170
+ export interface BotPositionData {
171
+ entry: number;
172
+ quantity: number;
173
+ tp: {
174
+ price: number;
175
+ quantity: number;
176
+ pnl: number;
177
+ };
178
+ current_price: number;
179
+ balance: number;
180
+ kind: "long" | "short";
181
+ next_order: number;
182
+ last_order: number;
183
+ avg: {
184
+ price: number;
185
+ quantity: number;
186
+ };
187
+ sl: {
188
+ price: number;
189
+ quantity: number;
190
+ pnl: number;
191
+ };
192
+ }
193
+ export interface BotView extends RecordModel {
194
+ id: string;
195
+ direction?: "long" | "short";
196
+ budget?: number;
197
+ main_symbol?: string;
198
+ main_long_position?: BotPositionData;
199
+ main_short_position?: BotPositionData;
200
+ secondary_symbol?: string;
201
+ secondary_long_position?: BotPositionData;
202
+ secondary_short_position?: BotPositionData;
203
+ main_account?: string;
204
+ secondary_account?: string;
205
+ settings?: Record<string, any>;
206
+ main_long_strategy?: string;
207
+ main_short_strategy?: string;
208
+ secondary_long_strategy?: string;
209
+ secondary_short_strategy?: string;
210
+ }
211
+ export type GlobalConfig = {
212
+ profit_percent: number;
213
+ symbol: string;
214
+ profit: number;
215
+ risk: number;
216
+ stop_percent: number;
217
+ kind: "long" | "short";
218
+ reduce_percent: number;
219
+ support: number;
220
+ resistance: number;
221
+ price_places: string;
222
+ decimal_places: string;
223
+ min_size: number;
224
+ accounts: {
225
+ owner: string;
226
+ exchange?: string;
227
+ }[];
228
+ risk_reward: number;
229
+ reverse_factor: number;
230
+ leverage?: number;
231
+ };
8
232
  interface Position$1 {
9
233
  id: number;
10
234
  kind: "long" | "short";
@@ -20,6 +244,7 @@ interface Position$1 {
20
244
  target_pnl?: number;
21
245
  reduce_ratio?: number;
22
246
  use_full?: boolean;
247
+ liquidation?: number;
23
248
  }
24
249
  export interface Account {
25
250
  id: number | string;
@@ -59,8 +284,68 @@ export interface Account {
59
284
  short: any;
60
285
  };
61
286
  }
62
- export interface BaseExchange {
287
+ interface Order$1 {
288
+ order_id?: string;
289
+ symbol?: string;
290
+ price: number;
291
+ quantity: number;
292
+ kind: "long" | "short";
293
+ side: "buy" | "sell";
294
+ stop: number;
295
+ triggerPrice?: number;
296
+ }
297
+ export interface CandlestickAnalysisResult {
298
+ candlesticks: {
299
+ [key: string]: any[];
300
+ };
301
+ resistance: {
302
+ [key: string]: number;
303
+ };
304
+ support: {
305
+ [key: string]: number;
306
+ };
307
+ current_price: number;
308
+ minimum_weekly: number;
309
+ }
310
+ declare abstract class BaseExchange {
63
311
  client: any;
312
+ getCredentials: (payload: {
313
+ account: string;
314
+ }) => Promise<{
315
+ api_key: string;
316
+ api_secret: string;
317
+ email: string;
318
+ }>;
319
+ proxyAgent?: any;
320
+ constructor(client: any);
321
+ protected abstract getPositionInfo(symbol: string): Promise<any>;
322
+ abstract cancelAllOrders(symbol: string, payload: {
323
+ type?: "limit" | "stop" | "tp";
324
+ side?: "buy" | "sell";
325
+ kind?: "long" | "short";
326
+ }): Promise<any>;
327
+ protected abstract getCurrentPrice(symbol: string): Promise<any>;
328
+ protected abstract getExchangeInfo(options: {
329
+ price_places?: string;
330
+ decimal_places?: string;
331
+ account: {
332
+ owner: string;
333
+ exchange: string;
334
+ };
335
+ symbol: string;
336
+ }): Promise<any>;
337
+ protected abstract _createLimitPurchaseOrders(payload: {
338
+ symbol: string;
339
+ orders: any[];
340
+ price_places?: string;
341
+ decimal_places?: string;
342
+ }): Promise<any>;
343
+ rawCreateLimitPurchaseOrders(payload: {
344
+ symbol: string;
345
+ orders: Order$1[];
346
+ price_places?: string;
347
+ decimal_places?: string;
348
+ }): Promise<any>;
64
349
  placeStopOrders(payload: {
65
350
  symbol: string;
66
351
  quantity: number;
@@ -71,33 +356,65 @@ export interface BaseExchange {
71
356
  place?: boolean;
72
357
  }): Promise<any>;
73
358
  bulkPlaceLimitOrders(payload: {
74
- orders: any[];
359
+ orders: Order$1[];
75
360
  kind: "long" | "short";
76
361
  decimal_places?: string;
77
362
  price_places?: string;
78
363
  symbol: string;
79
364
  place?: boolean;
80
- }): Promise<any>;
365
+ }): Promise<any[]>;
81
366
  get_current_price(symbol: string): Promise<any>;
82
- analyzeCharts(payload: {
367
+ abstract analyzeCharts(payload: {
83
368
  symbol: string;
84
369
  chartType: any;
85
- count: number;
370
+ limit: number;
86
371
  raw?: boolean;
87
372
  }): Promise<any>;
88
- getExchangeAccountInfo(account: {
89
- owner: string;
90
- exchange: string;
91
- }, symbol: string): Promise<any>;
373
+ getExchangeAccountInfo(options: {
374
+ price_places?: string;
375
+ decimal_places?: string;
376
+ account: {
377
+ owner: string;
378
+ exchange: string;
379
+ };
380
+ symbol: string;
381
+ }): Promise<any>;
382
+ protected abstract _cancelOrders(payload: {
383
+ symbol: string;
384
+ orders: Array<{
385
+ orderId: number;
386
+ }>;
387
+ }): Promise<any>;
92
388
  cancelOrders(payload: {
93
389
  symbol: string;
94
390
  orders: number[];
95
391
  }): Promise<any>;
392
+ protected abstract _placeTpOrder(payload: {
393
+ symbol: string;
394
+ tp: number;
395
+ kind: "long" | "short";
396
+ cancel?: boolean;
397
+ quantity?: number;
398
+ price_places?: string;
399
+ decimal_places?: string;
400
+ }): Promise<any>;
96
401
  placeTpOrder(payload: {
97
402
  symbol: string;
98
403
  take_profit: number;
99
404
  kind: "long" | "short";
100
405
  cancel?: boolean;
406
+ quantity?: number;
407
+ price_places?: string;
408
+ decimal_places?: string;
409
+ }): Promise<any>;
410
+ protected abstract placeLimitOrders(payload: {
411
+ symbol: string;
412
+ orders: Array<{
413
+ entry: number;
414
+ quantity: number;
415
+ }>;
416
+ kind: "long" | "short";
417
+ cancel?: boolean;
101
418
  price_places?: string;
102
419
  decimal_places?: string;
103
420
  }): Promise<any>;
@@ -109,6 +426,18 @@ export interface BaseExchange {
109
426
  price_places?: string;
110
427
  decimal_places?: string;
111
428
  }): Promise<any>;
429
+ protected abstract _placeStopOrder(payload: {
430
+ symbol: string;
431
+ stop: number;
432
+ quantity: number;
433
+ kind: "long" | "short";
434
+ price_places?: string;
435
+ decimal_places?: string;
436
+ final_stop: number;
437
+ cancel?: boolean;
438
+ is_limit?: boolean;
439
+ current_price: number;
440
+ }): Promise<any>;
112
441
  placeStopOrder(payload: {
113
442
  symbol: string;
114
443
  stop: number;
@@ -117,119 +446,143 @@ export interface BaseExchange {
117
446
  price_places?: string;
118
447
  decimal_places?: string;
119
448
  }): Promise<any>;
120
- setLeverage(payload: {
449
+ abstract setLeverage(payload: {
121
450
  symbol: string;
122
451
  leverage: number;
123
452
  }): Promise<any>;
124
- generateConfig(payload: {
453
+ abstract generateConfig(payload: {
125
454
  symbol: string;
455
+ interval?: any;
126
456
  limit?: number;
127
457
  }): Promise<any>;
458
+ abstract checkDelistedMovers(payload: {
459
+ movePercent: number;
460
+ include_delisted?: boolean;
461
+ }): Promise<any>;
462
+ closePosition(payload: {
463
+ symbol: string;
464
+ kind: "long" | "short";
465
+ price_places?: string;
466
+ decimal_places?: string;
467
+ }): Promise<any>;
468
+ protected abstract getAllOpenOrders(): Promise<any>;
469
+ getAllOpenSymbols(): Promise<unknown[]>;
470
+ createLimitPurchaseOrders(payload: {
471
+ orders: any[];
472
+ kind: "long" | "short";
473
+ decimal_places?: string;
474
+ price_places?: string;
475
+ symbol: string;
476
+ }): Promise<any>;
477
+ abstract getDelistedSpotSymbols(): Promise<any>;
478
+ abstract getOpenPositions(): Promise<any>;
479
+ abstract crossAccountTransfer(payload: {
480
+ from: {
481
+ owner: string;
482
+ wallet: string;
483
+ };
484
+ to: {
485
+ owner: string;
486
+ wallet: string;
487
+ };
488
+ asset: string;
489
+ amount: number;
490
+ }): Promise<any>;
491
+ placeMarketOrder(payload: {
492
+ symbol: string;
493
+ kind: "long" | "short";
494
+ quantity: number;
495
+ price_places?: string;
496
+ decimal_places?: string;
497
+ }): Promise<any>;
498
+ customStopLoss(payload: {
499
+ price_places: string;
500
+ decimal_places: string;
501
+ symbol: string;
502
+ kind: "long" | "short";
503
+ stop: number;
504
+ quantity: number;
505
+ increase?: boolean;
506
+ place?: boolean;
507
+ }): Promise<any>;
508
+ abstract getOpenOrders(payload: {
509
+ symbol: string;
510
+ }): Promise<any>;
511
+ placeBadStopEntry(payload: {
512
+ symbol: string;
513
+ orders: Order$1[];
514
+ price_places?: string;
515
+ decimal_places?: string;
516
+ }): Promise<any>;
517
+ analyzeCandlesticks(payload: {
518
+ symbol: string;
519
+ }): Promise<CandlestickAnalysisResult>;
520
+ setAccountDetails(payload: {
521
+ getCredentials: (payload: {
522
+ account: string;
523
+ }) => Promise<{
524
+ api_key: string;
525
+ api_secret: string;
526
+ email: string;
527
+ }>;
528
+ proxyAgent?: any;
529
+ }): void;
128
530
  }
129
- export interface BaseSystemFields {
130
- id: string;
131
- created: string;
132
- updated: string;
133
- }
134
- export interface ExchangeAccount extends BaseSystemFields {
135
- exchange: "binance" | "bybit";
531
+ declare function encryptObject(obj: any, password: string): string;
532
+ declare function decryptObject(encryptedString: string, password: string): any;
533
+ declare function initPocketBaseClient(proxy_credentials: {
534
+ host: string;
535
+ email: string;
536
+ password: string;
537
+ auto_cancellation?: boolean;
538
+ }): Promise<PocketBase>;
539
+ export type ExchangeType = {
136
540
  owner: string;
541
+ exchange: string;
542
+ };
543
+ export declare class AppDatabase {
544
+ pb: PocketBase;
137
545
  email?: string;
138
- user?: string;
139
- usdt?: number;
140
- usdc?: number;
141
- proxy?: string;
142
- }
143
- export interface SymbolConfig extends BaseSystemFields {
144
- symbol: string;
145
- support?: number;
146
- resistance?: number;
147
- stop_percent?: number;
148
- price_places?: string;
149
- decimal_places?: string;
150
- min_size?: number;
151
- weight?: number;
152
- leverage?: number;
153
- }
154
- export interface ScheduledTrade extends BaseSystemFields {
155
- symbol: string;
156
- account: string;
157
- profit?: number;
158
- risk?: number;
159
- entry?: number;
160
- stop?: number;
161
- risk_reward?: number;
162
- profit_percent?: number;
163
- place_tp?: boolean;
164
- kind?: "long" | "short";
165
- current_price?: number;
166
- }
167
- export interface Strategy extends BaseSystemFields {
168
- name: string;
169
- short_risk_factor?: number;
170
- long_risk_factor?: number;
171
- profit_percent?: number;
172
- cancel_short?: boolean;
173
- cancel_long?: boolean;
174
- recompute_short_config?: boolean;
175
- update_stop_loss?: boolean;
176
- liquidation_as_entry?: boolean;
177
- stop_as_entry?: boolean;
178
- tp_as_stop?: boolean;
179
- entry_as_stop?: boolean;
180
- place_stop?: boolean;
181
- save_config?: boolean;
182
- }
183
- interface Proxy$1 extends BaseSystemFields {
184
- ip_address?: string;
185
- type?: "http" | "socks5";
186
- }
187
- export interface TradeBlockTracking extends BaseSystemFields {
188
- account?: string;
189
- symbol?: string;
190
- running?: boolean;
191
- }
192
- export interface PositionsView {
193
- id: string;
194
- symbol?: any;
195
- entry?: any;
196
- quantity?: any;
197
- take_profit?: any;
198
- account?: any;
199
- kind?: any;
200
- target_pnl?: number;
201
- liquidation?: number;
202
- avg_price?: number;
203
- avg_qty?: number;
204
- next_order?: number;
205
- last_order?: number;
206
- config?: any;
207
- stop_loss?: {
208
- price: number;
209
- quantity: number;
210
- };
211
- stop_pnl?: any;
212
- leverage?: any;
213
- avg_liquidation?: any;
214
- balance?: any;
215
- }
216
- export interface BullishMarket extends RecordModel {
217
- id: string;
218
- symbol: string;
219
- risk: number;
220
- }
221
- export interface WindingDownMarket extends RecordModel {
222
- id: string;
223
- symbol: string;
224
- risk_reward: number;
225
- }
226
- export type ExchangeType = {
227
- owner: string;
228
- exchange: string;
229
- };
230
- export declare class AppDatabase {
231
- private pb;
232
- constructor(pb: PocketBase);
546
+ salt?: string;
547
+ constructor(pb: PocketBase, payload: {
548
+ email?: string;
549
+ salt?: string;
550
+ });
551
+ getUserByEmail(): Promise<import("pocketbase").RecordModel>;
552
+ verifyUserPassword(password: string): Promise<boolean>;
553
+ generateUserPassword(): Promise<boolean>;
554
+ getUserCredentials(): Promise<any>;
555
+ getCredentials(payload: {
556
+ password?: string;
557
+ }): Promise<any>;
558
+ saveCredentials(params: {
559
+ password?: string;
560
+ credentials: any;
561
+ }): Promise<import("pocketbase").RecordModel>;
562
+ changeUserPassword(payload: {
563
+ password: string;
564
+ }): Promise<boolean>;
565
+ verifyAdminPassword(password: string): Promise<boolean>;
566
+ setAdminPassword(payload: {
567
+ password: string;
568
+ salt: string;
569
+ }): Promise<boolean>;
570
+ addNewCredential(params: {
571
+ password?: string;
572
+ payload: {
573
+ name: string;
574
+ email: string;
575
+ exchange: string;
576
+ api_key: string;
577
+ api_secret: string;
578
+ };
579
+ }): Promise<void>;
580
+ getAccountWithActivePositions(): Promise<import("pocketbase").RecordModel[]>;
581
+ getAllSymbolsFromPositions(options?: {
582
+ no_position?: boolean;
583
+ kind?: "long" | "short";
584
+ custom_filter?: string;
585
+ }): Promise<any[]>;
233
586
  createOrUpdateLiveExchangeInstance(payload: {
234
587
  account: ExchangeType;
235
588
  symbol: string;
@@ -242,18 +595,24 @@ export declare class AppDatabase {
242
595
  }): Promise<import("pocketbase").RecordModel>;
243
596
  getProxyForAccount(account: ExchangeType): Promise<HttpsProxyAgent<`http://${string}`> | SocksProxyAgent>;
244
597
  getAccounts(): Promise<ExchangeAccount[]>;
245
- getAllSymbolConfigs(with_positions?: boolean): Promise<SymbolConfig[]>;
598
+ getAllSymbolConfigs(payload?: {
599
+ with_positions?: boolean;
600
+ custom_filter?: string;
601
+ }): Promise<SymbolConfig[]>;
246
602
  get_exchange_db_instance(account: ExchangeType): Promise<ExchangeAccount & {
247
603
  expand?: {
248
604
  proxy: Proxy$1;
249
605
  };
250
606
  }>;
251
- getPositions(account: ExchangeType, options: {
252
- symbol: string;
607
+ getPositions(options: {
608
+ account?: ExchangeType;
609
+ symbol?: string;
253
610
  as_view?: boolean;
611
+ custom_filter?: string;
254
612
  }): Promise<(PositionsView & {
255
613
  expand?: {
256
614
  config: ScheduledTrade;
615
+ account: ExchangeAccount;
257
616
  };
258
617
  })[]>;
259
618
  private _createOrUpdatePosition;
@@ -265,6 +624,7 @@ export declare class AppDatabase {
265
624
  }): Promise<(PositionsView & {
266
625
  expand?: {
267
626
  config: ScheduledTrade;
627
+ account: ExchangeAccount;
268
628
  };
269
629
  })[]>;
270
630
  update_db_position(position: any, payload: any): Promise<import("pocketbase").RecordModel>;
@@ -276,7 +636,7 @@ export declare class AppDatabase {
276
636
  getOrders(account: ExchangeType, options: {
277
637
  symbol: string;
278
638
  kind: "long" | "short";
279
- }): Promise<import("pocketbase").RecordModel[]>;
639
+ }): Promise<Order[]>;
280
640
  deleteAndRecreateOrders(account: ExchangeType, options: {
281
641
  symbol: string;
282
642
  kind: "long" | "short";
@@ -289,7 +649,33 @@ export declare class AppDatabase {
289
649
  stop: number;
290
650
  order_id: string;
291
651
  triggerPrice?: number;
292
- }>): Promise<import("pocketbase").RecordModel[]>;
652
+ }>): Promise<Order[]>;
653
+ deleteAndBulCreateAllOrders(payload: {
654
+ account: ExchangeType & {
655
+ id: string;
656
+ };
657
+ symbol: string;
658
+ all_orders: Array<{
659
+ symbol: string;
660
+ price: number;
661
+ quantity: number;
662
+ kind: "long" | "short";
663
+ side: "buy" | "sell";
664
+ stop: number;
665
+ order_id: string;
666
+ triggerPrice?: number;
667
+ }>;
668
+ }): Promise<void>;
669
+ cancelLimitOrders(payload: {
670
+ symbol: string;
671
+ kind: "long" | "short";
672
+ account: ExchangeType;
673
+ raw?: boolean;
674
+ cancelExchangeOrders: (payload: {
675
+ symbol: string;
676
+ orders: number[];
677
+ }) => Promise<any>;
678
+ }): Promise<any[]>;
293
679
  cancelOrders(payload: {
294
680
  cancelExchangeOrders: (payload: {
295
681
  symbol: string;
@@ -317,23 +703,60 @@ export declare class AppDatabase {
317
703
  message?: undefined;
318
704
  exchange_result?: undefined;
319
705
  }>;
706
+ getMoverExchangeInstances(): Promise<ExchangeAccount[]>;
707
+ updateScheduledTrade(id: string, payload: any): Promise<import("pocketbase").RecordModel>;
708
+ getPositionsToAutoFollow(): Promise<(Position$1 & {
709
+ expand: {
710
+ account: ExchangeAccount;
711
+ };
712
+ })[]>;
320
713
  createOrUpdatePositionConfig(db_position: any, payload: {
321
714
  entry: number;
322
715
  stop: number;
323
716
  risk_reward: number;
324
717
  risk: number;
325
718
  profit_percent?: number;
326
- }): Promise<void>;
719
+ place_tp?: boolean;
720
+ profit?: number;
721
+ }): Promise<import("pocketbase").RecordModel | ScheduledTrade>;
327
722
  getPositionConfig(payload: {
328
723
  symbol: string;
329
724
  kind: "long" | "short";
330
725
  account: ExchangeType;
331
726
  }): Promise<ScheduledTrade | null>;
332
- getPositionStrategy(account: ExchangeType): Promise<{
333
- strategy_instance: Strategy;
334
- focus_account: ExchangeAccount;
335
- }>;
336
- createOrUpdateWindingDownMarket(symbol: string): Promise<import("pocketbase").RecordModel>;
727
+ getRunningAccountStrategies(): Promise<(AccountStrategy & {
728
+ expand?: {
729
+ account: ExchangeAccount;
730
+ };
731
+ })[]>;
732
+ getAccountStrategy(payload: {
733
+ symbol: string;
734
+ account: ExchangeType;
735
+ }): Promise<AccountStrategy>;
736
+ getBotViewInstance(payload: {
737
+ asset: string;
738
+ main_account: ExchangeType;
739
+ }): Promise<BotView | null>;
740
+ getBotInstance(payload: {
741
+ asset: string;
742
+ main_account: ExchangeType;
743
+ }): Promise<BotInstance | null>;
744
+ getBotState(payload: {
745
+ asset: string;
746
+ main_account: ExchangeType;
747
+ running?: boolean;
748
+ }): Promise<BotState[]>;
749
+ getBotOrderHistories(payload: {
750
+ asset: string;
751
+ main_account: ExchangeType;
752
+ symbol?: string;
753
+ kind?: "long" | "short";
754
+ type?: "future" | "spot";
755
+ }): Promise<BotOrderHistory[]>;
756
+ createOrUpdateWindingDownMarket(payload: {
757
+ symbol: string;
758
+ risk_reward?: number;
759
+ }): Promise<import("pocketbase").RecordModel>;
337
760
  getWindingDownMarkets(symbol?: string): Promise<WindingDownMarket[]>;
338
761
  getBullishMarket(symbol: string): Promise<BullishMarket>;
339
762
  getBullishMarkets(options?: {
@@ -342,6 +765,7 @@ export declare class AppDatabase {
342
765
  percent: number;
343
766
  }>;
344
767
  totalRisk: number;
768
+ max_count?: number;
345
769
  }): Promise<{
346
770
  updated_bullish: BullishMarket[];
347
771
  moved_to_winding: WindingDownMarket[];
@@ -362,95 +786,1030 @@ export declare class AppDatabase {
362
786
  } | SymbolConfig[]>;
363
787
  unwindSymbolFromDB(symbol: string): Promise<boolean>;
364
788
  hasExistingPosition(symbol: string): Promise<import("pocketbase").RecordModel[]>;
789
+ getPositionWithLowestNextOrder(options: {
790
+ symbol?: string;
791
+ kind: "long" | "short";
792
+ asset?: string;
793
+ exclude?: ExchangeType[];
794
+ }): Promise<PositionsView | null>;
795
+ hasExistingOrders(symbol: string): Promise<import("pocketbase").RecordModel[]>;
365
796
  removeSymbolFromUnwindingMarkets(symbol: string): Promise<boolean>;
366
797
  removePosition(position: any): Promise<void>;
367
798
  removePositionConfig(position: any): Promise<void>;
799
+ getConfigProfiles(payload: {
800
+ config_id: string;
801
+ }): Promise<{
802
+ id: any;
803
+ entry: any;
804
+ stop: any;
805
+ kind: "long" | "short";
806
+ risk_reward: any;
807
+ risk: any;
808
+ profit_percent: any;
809
+ }[]>;
810
+ editConfigProfile(payload: {
811
+ id: string;
812
+ params: {
813
+ entry?: number;
814
+ stop?: number;
815
+ risk_reward?: number;
816
+ risk?: number;
817
+ profit_percent?: number;
818
+ };
819
+ }): Promise<void>;
820
+ createConfigProfile(payload: {
821
+ config_id: string;
822
+ symbol: string;
823
+ params: {
824
+ entry: number;
825
+ stop: number;
826
+ kind: "long" | "short";
827
+ risk_reward: number;
828
+ risk: number;
829
+ profit_percent: number;
830
+ };
831
+ }): Promise<void>;
368
832
  }
369
- export interface CodeNode {
370
- minimum_pnl: number;
371
- max_size: number;
372
- profit: number;
373
- ratio?: number;
374
- increase: boolean;
375
- not_reduce?: boolean;
376
- reduce_ratio?: number;
377
- use_full?: boolean;
378
- }
379
- export type AppConfig = {
380
- fee: number;
381
- risk_per_trade: number;
382
- risk_reward: number;
383
- symbol?: string;
384
- focus: number;
385
- budget: number;
386
- support: number;
387
- resistance: number;
388
- percent_change: number;
389
- tradeSplit?: number;
390
- take_profit?: number;
391
- kind: "long" | "short";
833
+ export type StrategyPosition = {
392
834
  entry: number;
835
+ quantity: number;
836
+ avg_price?: number;
837
+ avg_qty?: number;
838
+ };
839
+ export type GapCloserResult = {
840
+ avg_entry: number;
841
+ avg_size: number;
842
+ loss: number;
393
843
  stop: number;
394
- min_size: number;
395
- price_places?: string;
396
- strategy?: "quantity" | "entry";
397
- as_array?: boolean;
398
- decimal_places?: string;
399
- min_profit?: number;
400
- raw?: boolean;
401
- gap?: number;
402
- rr?: number;
403
- max_size?: number;
844
+ stop_quantity: number;
845
+ re_entry_quantity: number;
846
+ initial_pnl: number;
847
+ tp: number;
848
+ incurred_loss: number;
849
+ pnl: number;
850
+ remaining_quantity: number;
404
851
  };
405
- declare class ExchangeAccount$1 {
406
- private instance;
407
- private exchange;
408
- private app_db;
409
- constructor(payload: ExchangeType, options: {
410
- exchange: BaseExchange;
411
- app_db: AppDatabase;
852
+ export type Config = {
853
+ tp_percent: number;
854
+ short_tp_factor: number;
855
+ fee_percent?: number;
856
+ budget: number;
857
+ risk_reward: number;
858
+ reduce_ratio: number;
859
+ global_config: GlobalConfig;
860
+ };
861
+ export declare class Strategy {
862
+ position: {
863
+ long: StrategyPosition;
864
+ short: StrategyPosition;
865
+ };
866
+ dominant_position?: "long" | "short";
867
+ config: Config;
868
+ constructor(payload: {
869
+ long: StrategyPosition;
870
+ short: StrategyPosition;
871
+ config: Config;
872
+ dominant_position?: "long" | "short";
412
873
  });
413
- /**
414
- *In order to avoid rate limiting issues, we cache the live exchange
415
- details for each symbol for an account in the database with an option
416
- to refresh.
874
+ get price_places(): string;
875
+ get decimal_places(): string;
876
+ to_f(price: number): number;
877
+ to_df(quantity: number): number;
878
+ pnl(kind: "long" | "short", _position?: StrategyPosition): number;
879
+ tp(kind: "long" | "short"): number;
880
+ calculate_fee(position: {
881
+ price: number;
882
+ quantity: number;
883
+ }): number;
884
+ get long_tp(): number;
885
+ get short_tp(): number;
886
+ generateGapClosingAlgorithm(payload: {
887
+ kind: "long" | "short";
888
+ ignore_entries?: boolean;
889
+ reduce_ratio?: number;
890
+ sell_factor?: number;
891
+ }): {
892
+ last_entry: any;
893
+ first_entry: any;
894
+ threshold: any;
895
+ risk: number;
896
+ risk_reward: number;
897
+ spread: number;
898
+ gap_loss: number;
899
+ net_profit: number;
900
+ long: GapCloserResult;
901
+ short: GapCloserResult;
902
+ };
903
+ gapCloserHelper(payload: {
904
+ risk: number;
905
+ entries?: any[];
906
+ kind: "long" | "short";
907
+ sell_factor?: number;
908
+ reduce_ratio?: number;
909
+ }): {
910
+ risk: number;
911
+ risk_reward: number;
912
+ spread: number;
913
+ gap_loss: number;
914
+ net_profit: number;
915
+ long: GapCloserResult;
916
+ short: GapCloserResult;
917
+ };
918
+ runIterations(payload: {
919
+ kind: "long" | "short";
920
+ iterations: number;
921
+ risk_reward?: number;
922
+ ignore_entries?: boolean;
923
+ reduce_ratio?: number;
924
+ sell_factor?: number;
925
+ }): {
926
+ last_entry: any;
927
+ first_entry: any;
928
+ threshold: any;
929
+ risk: number;
930
+ risk_reward: number;
931
+ spread: number;
932
+ gap_loss: number;
933
+ net_profit: number;
934
+ long: GapCloserResult;
935
+ short: GapCloserResult;
936
+ }[];
937
+ getPositionAfterTp(payload: {
938
+ kind: "long" | "short";
939
+ include_fees?: boolean;
940
+ }): {
941
+ [x: string]: number | {
942
+ entry: number;
943
+ quantity: number;
944
+ diff?: undefined;
945
+ } | {
946
+ [x: string]: number;
947
+ diff: number;
948
+ entry?: undefined;
949
+ quantity?: undefined;
950
+ };
951
+ pnl: {
952
+ [x: string]: number;
953
+ diff: number;
954
+ };
955
+ spread: number;
956
+ };
957
+ getPositionAfterIteration(payload: {
958
+ kind: "long" | "short";
959
+ iterations: number;
960
+ with_fees?: boolean;
961
+ }): {
962
+ [x: string]: number | {
963
+ entry: number;
964
+ quantity: number;
965
+ diff?: undefined;
966
+ } | {
967
+ [x: string]: number;
968
+ diff: number;
969
+ entry?: undefined;
970
+ quantity?: undefined;
971
+ };
972
+ pnl: {
973
+ [x: string]: number;
974
+ diff: number;
975
+ };
976
+ spread: number;
977
+ }[];
978
+ /**To be used as one of the agent tools eventually since
979
+ * it is something that can be triggered continously without
980
+ * any risk
417
981
  */
418
- getLiveExchangeInstance(payload: {
419
- symbol: string;
420
- refresh?: boolean;
982
+ generateOppositeTrades(payload: {
983
+ kind: "long" | "short";
984
+ risk_factor?: number;
985
+ avg_entry?: number;
986
+ }): {
987
+ avg: {
988
+ entry: number;
989
+ price: number;
990
+ quantity: number;
991
+ };
992
+ loss: number;
993
+ profit_percent: number;
994
+ fee: number;
995
+ risk_per_trade: number;
996
+ risk_reward: number;
997
+ symbol?: string;
998
+ focus: number;
999
+ budget: number;
1000
+ support: number;
1001
+ resistance: number;
1002
+ percent_change: number;
1003
+ tradeSplit?: number;
1004
+ take_profit?: number;
1005
+ kind: "long" | "short";
1006
+ entry: number;
1007
+ stop: number;
1008
+ min_size: number;
421
1009
  price_places?: string;
1010
+ strategy?: "quantity" | "entry";
1011
+ as_array?: boolean;
422
1012
  decimal_places?: string;
423
- }): Promise<import("pocketbase").RecordModel>;
424
- getActiveAccount(symbol: string, full?: boolean): Promise<Account | {
425
- liquidation: {
1013
+ min_profit?: number;
1014
+ raw?: boolean;
1015
+ gap?: number;
1016
+ rr?: number;
1017
+ max_size?: number;
1018
+ max_quantity?: number;
1019
+ };
1020
+ identifyGapConfig(payload: {
1021
+ factor?: number;
1022
+ sell_factor?: number;
1023
+ kind?: "long" | "short";
1024
+ risk?: number;
1025
+ }): {
1026
+ profit_percent: {
426
1027
  long: number;
427
1028
  short: number;
428
1029
  };
429
- active_account: Account;
430
- current_price: any;
431
- exchange: any;
432
- }>;
433
- syncAccount(options: {
434
- symbol: string;
435
- kind?: "long" | "short";
436
- update?: boolean;
437
- as_view?: boolean;
438
- leverage?: number;
439
- }): Promise<PositionsView | (PositionsView & {
440
- expand?: {
441
- config: ScheduledTrade;
1030
+ risk: {
1031
+ short: number;
1032
+ long: number;
442
1033
  };
443
- })[]>;
444
- getRunningInstanceFromDB(symbol: string): Promise<TradeBlockTracking>;
445
- syncOrders(options: {
446
- symbol: string;
1034
+ take_profit: {
1035
+ long: number;
1036
+ short: number;
1037
+ };
1038
+ to_reduce: {
1039
+ short: number;
1040
+ long: number;
1041
+ };
1042
+ full_reduce: {
1043
+ short: number;
1044
+ long: number;
1045
+ };
1046
+ sell_quantity: {
1047
+ short: number;
1048
+ long: number;
1049
+ };
1050
+ gap: number;
1051
+ gap_loss: number;
1052
+ };
1053
+ analyzeProfit(payload: {
1054
+ reward_factor?: number;
1055
+ max_reward_factor: number;
1056
+ risk: number;
447
1057
  kind: "long" | "short";
448
- update?: boolean;
449
- }): Promise<import("pocketbase").RecordModel[]>;
450
- toggleStopBuying(payload: {
451
- symbol: string;
1058
+ }): {
1059
+ pnl: number;
1060
+ loss: number;
1061
+ full_loss: number;
1062
+ original_pnl: number;
1063
+ reward_factor: number;
1064
+ profit_percent: number;
452
1065
  kind: "long" | "short";
453
- should_stop?: boolean;
1066
+ sell_price: number;
1067
+ quantity: number;
1068
+ price_places: string;
1069
+ decimal_places: string;
1070
+ };
1071
+ simulateGapReduction(payload: {
1072
+ iterations?: number;
1073
+ factor?: number;
1074
+ direction: "long" | "short";
1075
+ kind?: "long" | "short";
1076
+ risk?: number;
1077
+ sell_factor?: number;
1078
+ }): {
1079
+ results: {
1080
+ profit_percent: {
1081
+ long: number;
1082
+ short: number;
1083
+ };
1084
+ risk: {
1085
+ short: number;
1086
+ long: number;
1087
+ };
1088
+ take_profit: {
1089
+ long: number;
1090
+ short: number;
1091
+ };
1092
+ sell_quantity: {
1093
+ short: number;
1094
+ long: number;
1095
+ };
1096
+ gap_loss: number;
1097
+ position: {
1098
+ long: {
1099
+ entry: number;
1100
+ quantity: number;
1101
+ };
1102
+ short: {
1103
+ entry: number;
1104
+ quantity: number;
1105
+ };
1106
+ };
1107
+ }[];
1108
+ quantity: number;
1109
+ };
1110
+ }
1111
+ export type SignalConfigType = {
1112
+ focus: number;
1113
+ budget: number;
1114
+ percent_change?: number;
1115
+ price_places?: string;
1116
+ decimal_places?: string;
1117
+ zone_risk?: number;
1118
+ fee?: number;
1119
+ support?: number;
1120
+ risk_reward?: number;
1121
+ resistance?: number;
1122
+ risk_per_trade?: number;
1123
+ increase_size?: boolean;
1124
+ additional_increase?: number;
1125
+ minimum_pnl?: number;
1126
+ take_profit?: number;
1127
+ increase_position?: boolean;
1128
+ minimum_size?: number;
1129
+ first_order_size?: number;
1130
+ gap?: number;
1131
+ max_size?: number;
1132
+ };
1133
+ declare class Signal {
1134
+ focus: number;
1135
+ budget: number;
1136
+ percent_change: number;
1137
+ price_places: string;
1138
+ decimal_places: string;
1139
+ zone_risk: number;
1140
+ fee: number;
1141
+ support?: number;
1142
+ risk_reward: number;
1143
+ resistance?: number;
1144
+ risk_per_trade?: number;
1145
+ increase_size: boolean;
1146
+ additional_increase: number;
1147
+ minimum_pnl: number;
1148
+ take_profit?: number;
1149
+ increase_position: boolean;
1150
+ minimum_size: any;
1151
+ first_order_size: number;
1152
+ gap: number;
1153
+ max_size: number;
1154
+ constructor({ focus, 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, }: SignalConfigType);
1155
+ build_entry({ current_price, stop_loss, pnl, stop_percent, kind, risk, no_of_trades, take_profit, }: {
1156
+ take_profit?: number;
1157
+ no_of_trades?: number;
1158
+ current_price: number;
1159
+ stop_loss?: number;
1160
+ kind?: "long" | "short";
1161
+ risk: number;
1162
+ stop_percent?: number;
1163
+ pnl?: number;
1164
+ }): any;
1165
+ get risk(): number;
1166
+ get min_trades(): number;
1167
+ get min_price(): number;
1168
+ build_opposite_order({ current_price, kind, }: {
1169
+ current_price: number;
1170
+ kind?: "long" | "short";
1171
+ }): any;
1172
+ special_build_orders({ current_price, kind, }: {
1173
+ current_price: number;
1174
+ kind?: "long" | "short";
1175
+ }): any;
1176
+ build_orders({ current_price, kind, limit, replace_focus, max_index, min_index, }: {
1177
+ current_price: number;
1178
+ kind?: "long" | "short";
1179
+ limit?: boolean;
1180
+ replace_focus?: boolean;
1181
+ max_index?: number;
1182
+ min_index?: number;
1183
+ }): any;
1184
+ build_orders_old({ current_price, kind, limit, replace_focus, max_index, min_index, }: {
1185
+ current_price: number;
1186
+ kind?: "long" | "short";
1187
+ limit?: boolean;
1188
+ replace_focus?: boolean;
1189
+ max_index?: number;
1190
+ min_index?: number;
1191
+ }): any;
1192
+ get_bulk_trade_zones({ current_price, kind, limit, }: {
1193
+ current_price: number;
1194
+ kind?: "long" | "short";
1195
+ limit?: boolean;
1196
+ }): any;
1197
+ get_future_zones({ current_price, kind, raw, }: {
1198
+ raw?: boolean;
1199
+ current_price: number;
1200
+ kind?: "long" | "short";
1201
+ }): number[];
1202
+ to_f(value: number, places?: string): number;
1203
+ get_margin_zones({ current_price, kind, }: {
1204
+ current_price: number;
1205
+ kind?: "long" | "short";
1206
+ }): number[][];
1207
+ get_margin_range(current_price: number, kind?: string): number[];
1208
+ process_orders({ current_price, stop_loss, trade_zones, kind, }: {
1209
+ current_price: number;
1210
+ stop_loss: number;
1211
+ trade_zones: number[];
1212
+ kind?: "long" | "short";
1213
+ }): any[];
1214
+ get_risk_per_trade(number_of_orders: number): number;
1215
+ build_trade_dict({ entry, stop, risk, arr, index, new_fees, kind, start, take_profit, }: {
1216
+ entry: number;
1217
+ stop: number;
1218
+ risk: number;
1219
+ arr: number[];
1220
+ index: number;
1221
+ new_fees?: number;
1222
+ kind?: "long" | "short";
1223
+ start?: number;
1224
+ take_profit?: number;
1225
+ }): {
1226
+ entry: number;
1227
+ risk: number;
1228
+ quantity: number;
1229
+ sell_price: number;
1230
+ risk_sell: number;
1231
+ stop: number;
1232
+ pnl: number;
1233
+ fee: number;
1234
+ net: number;
1235
+ incurred: number;
1236
+ stop_percent: number;
1237
+ };
1238
+ to_df(currentPrice: number, places?: string): number;
1239
+ }
1240
+ export declare function determine_average_entry_and_size(orders: Array<{
1241
+ price: number;
1242
+ quantity: number;
1243
+ }>, places?: string, price_places?: string): {
1244
+ entry: number;
1245
+ price: number;
1246
+ quantity: number;
1247
+ };
1248
+ export declare const createArray: (start: number, stop: number, step: number) => number[];
1249
+ export type AppConfig = {
1250
+ fee: number;
1251
+ risk_per_trade: number;
1252
+ risk_reward: number;
1253
+ symbol?: string;
1254
+ focus: number;
1255
+ budget: number;
1256
+ support: number;
1257
+ resistance: number;
1258
+ percent_change: number;
1259
+ tradeSplit?: number;
1260
+ take_profit?: number;
1261
+ kind: "long" | "short";
1262
+ entry: number;
1263
+ stop: number;
1264
+ min_size: number;
1265
+ price_places?: string;
1266
+ strategy?: "quantity" | "entry";
1267
+ as_array?: boolean;
1268
+ decimal_places?: string;
1269
+ min_profit?: number;
1270
+ raw?: boolean;
1271
+ gap?: number;
1272
+ rr?: number;
1273
+ max_size?: number;
1274
+ last_value?: any;
1275
+ entries?: any[];
1276
+ max_quantity?: number;
1277
+ };
1278
+ export type ExtendConfigType = {
1279
+ take_profit?: number;
1280
+ entry: number;
1281
+ risk?: number;
1282
+ stop?: number;
1283
+ risk_reward?: number;
1284
+ raw_instance?: boolean;
1285
+ no_of_trades?: number;
1286
+ increase?: boolean;
1287
+ price_places?: string;
1288
+ decimal_places?: string;
1289
+ min_profit?: number;
1290
+ kind?: "long" | "short";
1291
+ gap?: number;
1292
+ rr?: number;
1293
+ };
1294
+ 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, }: ExtendConfigType): any[] | Signal;
1295
+ export declare function buildAvg({ _trades, kind, }: {
1296
+ _trades: any[];
1297
+ kind: "long" | "short";
1298
+ }): any;
1299
+ export declare function sortedBuildConfig(app_config: AppConfig, options: any): any[];
1300
+ export declare function get_app_config_and_max_size(config: GlobalConfig, payload: {
1301
+ entry: number;
1302
+ stop: number;
1303
+ kind: "long" | "short";
1304
+ }): {
1305
+ app_config: AppConfig;
1306
+ max_size: any;
1307
+ last_value: any;
1308
+ entries: {
1309
+ entry: any;
1310
+ avg_entry: any;
1311
+ avg_size: any;
1312
+ neg_pnl: any;
1313
+ quantity: any;
1314
+ }[];
1315
+ };
1316
+ export declare function buildAppConfig(config: GlobalConfig, payload: {
1317
+ entry: number;
1318
+ stop: number;
1319
+ risk_reward: number;
1320
+ risk: number;
1321
+ symbol: string;
1322
+ profit?: number;
1323
+ }): AppConfig;
1324
+ export declare function getOptimumStopAndRisk(app_config: AppConfig, params: {
1325
+ max_size: number;
1326
+ target_stop: number;
1327
+ highest_risk?: number;
1328
+ }): {
1329
+ optimal_stop: number;
1330
+ optimal_risk: number;
1331
+ avg_size: any;
1332
+ avg_entry: any;
1333
+ result: any[];
1334
+ first_entry: any;
1335
+ neg_pnl: any;
1336
+ risk_reward: number;
1337
+ size_diff: number;
1338
+ entry_diff: number;
1339
+ };
1340
+ export declare function generate_config_params(app_config: AppConfig, payload: {
1341
+ entry: number;
1342
+ stop: number;
1343
+ risk_reward: number;
1344
+ risk: number;
1345
+ symbol: string;
1346
+ }): {
1347
+ entry: number;
1348
+ stop: number;
1349
+ avg_size: any;
1350
+ avg_entry: any;
1351
+ risk_reward: number;
1352
+ neg_pnl: any;
1353
+ risk: number;
1354
+ };
1355
+ export declare function determine_break_even_price(payload: {
1356
+ long_position: {
1357
+ entry: number;
1358
+ quantity: number;
1359
+ };
1360
+ short_position: {
1361
+ entry: number;
1362
+ quantity: number;
1363
+ };
1364
+ fee_percent?: number;
1365
+ }): {
1366
+ price: number;
1367
+ direction: string;
1368
+ };
1369
+ export declare function determine_amount_to_buy(payload: {
1370
+ orders: any[];
1371
+ kind: "long" | "short";
1372
+ decimal_places?: string;
1373
+ price_places?: string;
1374
+ place?: boolean;
1375
+ position: any;
1376
+ existingOrders: any[];
1377
+ }): any[];
1378
+ export declare function generateOptimumAppConfig(config: GlobalConfig, payload: {
1379
+ entry: number;
1380
+ stop: number;
1381
+ risk_reward: number;
1382
+ start_risk: number;
1383
+ max_risk?: number;
1384
+ }, position: {
1385
+ entry: number;
1386
+ quantity: number;
1387
+ kind: "long" | "short";
1388
+ }): AppConfig | null;
1389
+ export declare function determineOptimumReward(app_config: AppConfig, increase?: boolean, low_range?: number, high_range?: number): number | {
1390
+ result: any[];
1391
+ value: number;
1392
+ total: number;
1393
+ risk_per_trade: number;
1394
+ max: number;
1395
+ min: number;
1396
+ neg_pnl: any;
1397
+ entry: any;
1398
+ };
1399
+ export declare function determineOptimumRisk(config: GlobalConfig, payload: {
1400
+ entry: number;
1401
+ stop: number;
1402
+ risk_reward: number;
1403
+ risk: number;
1404
+ symbol: string;
1405
+ }, params: {
1406
+ highest_risk: number;
1407
+ tolerance?: number;
1408
+ max_iterations?: number;
1409
+ }): {
1410
+ optimal_risk: number;
1411
+ achieved_neg_pnl: number;
1412
+ target_neg_pnl: number;
1413
+ difference: number;
1414
+ iterations: number;
1415
+ converged: boolean;
1416
+ last_value: any;
1417
+ entries: any[];
1418
+ app_config: AppConfig;
1419
+ };
1420
+ export declare function computeRiskReward(payload: {
1421
+ app_config: AppConfig;
1422
+ entry: number;
1423
+ stop: number;
1424
+ risk_per_trade: number;
1425
+ }): number | {
1426
+ result: any[];
1427
+ value: number;
1428
+ total: number;
1429
+ risk_per_trade: number;
1430
+ max: number;
1431
+ min: number;
1432
+ neg_pnl: any;
1433
+ entry: any;
1434
+ };
1435
+ export declare function getRiskReward(payload: {
1436
+ entry: number;
1437
+ stop: number;
1438
+ risk: number;
1439
+ global_config: GlobalConfig;
1440
+ force_exact_risk?: boolean;
1441
+ }): any;
1442
+ export declare function computeProfitDetail(payload: {
1443
+ focus_position: {
1444
+ kind: "long" | "short";
1445
+ entry: number;
1446
+ quantity: number;
1447
+ avg_qty: number;
1448
+ avg_price: number;
1449
+ };
1450
+ strategy: {
1451
+ reward_factor: number;
1452
+ max_reward_factor: number;
1453
+ risk: number;
1454
+ };
1455
+ pnl: number;
1456
+ reduce_position?: {
1457
+ kind: "long" | "short";
1458
+ entry: number;
1459
+ quantity: number;
1460
+ avg_qty: number;
1461
+ avg_price: number;
1462
+ };
1463
+ reverse_position?: {
1464
+ kind: "long" | "short";
1465
+ avg_qty: number;
1466
+ avg_price: number;
1467
+ stop_loss: {
1468
+ price: number;
1469
+ quantity: number;
1470
+ };
1471
+ };
1472
+ full_ratio?: number;
1473
+ price_places?: string;
1474
+ decimal_places?: string;
1475
+ }): {
1476
+ pnl: number;
1477
+ loss: number;
1478
+ full_loss: number;
1479
+ original_pnl: number;
1480
+ reward_factor: number;
1481
+ profit_percent: number;
1482
+ kind: "long" | "short";
1483
+ sell_price: number;
1484
+ quantity: number;
1485
+ price_places: string;
1486
+ decimal_places: string;
1487
+ };
1488
+ export declare function generateGapTp(payload: {
1489
+ long: {
1490
+ entry: number;
1491
+ quantity: number;
1492
+ };
1493
+ short: {
1494
+ entry: number;
1495
+ quantity: number;
1496
+ };
1497
+ risk?: number;
1498
+ kind?: "long" | "short";
1499
+ factor?: number;
1500
+ sell_factor?: number;
1501
+ price_places?: string;
1502
+ decimal_places?: string;
1503
+ }): {
1504
+ profit_percent: {
1505
+ long: number;
1506
+ short: number;
1507
+ };
1508
+ risk: {
1509
+ short: number;
1510
+ long: number;
1511
+ };
1512
+ take_profit: {
1513
+ long: number;
1514
+ short: number;
1515
+ };
1516
+ to_reduce: {
1517
+ short: number;
1518
+ long: number;
1519
+ };
1520
+ full_reduce: {
1521
+ short: number;
1522
+ long: number;
1523
+ };
1524
+ sell_quantity: {
1525
+ short: number;
1526
+ long: number;
1527
+ };
1528
+ gap: number;
1529
+ gap_loss: number;
1530
+ };
1531
+ export declare function determineRewardFactor(payload: {
1532
+ quantity: number;
1533
+ avg_qty: number;
1534
+ minimum_pnl: number;
1535
+ risk: number;
1536
+ }): number;
1537
+ export type BotPosition = {
1538
+ kind: "long" | "short";
1539
+ entry: number;
1540
+ quantity: number;
1541
+ tp: {
1542
+ price: number;
1543
+ };
1544
+ };
1545
+ export declare function getHedgeZone(payload: {
1546
+ symbol_config: GlobalConfig;
1547
+ risk: number;
1548
+ position: BotPosition;
1549
+ reward_factor?: number;
1550
+ risk_factor?: number;
1551
+ support?: number;
1552
+ }): {
1553
+ support: number;
1554
+ resistance: number;
1555
+ risk: number;
1556
+ profit_percent: number;
1557
+ };
1558
+ export declare function getOptimumHedgeFactor(payload: {
1559
+ target_support: number;
1560
+ tolerance?: number;
1561
+ max_iterations?: number;
1562
+ min_factor?: number;
1563
+ max_factor?: number;
1564
+ symbol_config: GlobalConfig;
1565
+ risk: number;
1566
+ position: BotPosition;
1567
+ }): {
1568
+ reward_factor: number;
1569
+ achieved_support: number;
1570
+ target_support: number;
1571
+ difference: number;
1572
+ iterations: number;
1573
+ converged?: undefined;
1574
+ } | {
1575
+ reward_factor: number;
1576
+ achieved_support: number;
1577
+ target_support: number;
1578
+ difference: number;
1579
+ iterations: number;
1580
+ converged: boolean;
1581
+ };
1582
+ export type CType = {
1583
+ next_order: number;
1584
+ take_profit: number;
1585
+ };
1586
+ export declare function determineCompoundLongTrade(payload: {
1587
+ focus_short_position: CType;
1588
+ focus_long_position: CType;
1589
+ shortConfig: {
1590
+ entry: number;
1591
+ stop: number;
1592
+ risk_reward: number;
1593
+ risk: number;
1594
+ symbol: string;
1595
+ profit_percent: number;
1596
+ };
1597
+ rr?: number;
1598
+ global_config: GlobalConfig;
1599
+ }): {
1600
+ start_risk: number;
1601
+ short_profit: number;
1602
+ support: number;
1603
+ resistance: number;
1604
+ long_v: any;
1605
+ profit_percent: number;
1606
+ result: any;
1607
+ short_max_size: any;
1608
+ };
1609
+ declare class ExchangePosition {
1610
+ exchange: BaseExchange;
1611
+ exchange_account: ExchangeAccount$1;
1612
+ private app_db;
1613
+ private instance;
1614
+ constructor(payload: {
1615
+ exchange: BaseExchange;
1616
+ app_db: AppDatabase;
1617
+ instance: PositionsView;
1618
+ exchange_account: ExchangeAccount$1;
1619
+ without_view?: PositionsView;
1620
+ });
1621
+ get symbol(): any;
1622
+ get kind(): any;
1623
+ get account(): any;
1624
+ cancelOrders(payload: {
1625
+ limit?: boolean;
1626
+ price?: number;
1627
+ }): Promise<any[] | {
1628
+ success: boolean;
1629
+ message: string;
1630
+ exchange_result?: undefined;
1631
+ error?: undefined;
1632
+ } | {
1633
+ success: boolean;
1634
+ exchange_result: any;
1635
+ message?: undefined;
1636
+ error?: undefined;
1637
+ } | {
1638
+ success: boolean;
1639
+ error: any;
1640
+ message?: undefined;
1641
+ exchange_result?: undefined;
1642
+ }>;
1643
+ getConfig(payload?: {
1644
+ params?: {
1645
+ entry?: number;
1646
+ stop?: number;
1647
+ risk_reward?: number;
1648
+ risk?: number;
1649
+ profit_percent?: number;
1650
+ place_tp?: boolean;
1651
+ profit?: number;
1652
+ };
1653
+ }): Promise<import("pocketbase").RecordModel | ScheduledTrade>;
1654
+ updateTargetPnl(): Promise<number>;
1655
+ updateConfigPnl(): Promise<void>;
1656
+ triggerTradeFromConfig(payload: {
1657
+ place?: boolean;
1658
+ raw?: boolean;
1659
+ tp?: boolean;
1660
+ stop?: boolean;
1661
+ use_current?: boolean;
1662
+ ignore_config?: boolean;
1663
+ }): Promise<any>;
1664
+ placeSharedOrder(action: "place_limit_orders" | "place_stop_orders" | "place_tp_orders", payload: {
1665
+ entry: number;
1666
+ stop: number;
1667
+ risk_reward: number;
1668
+ risk: number;
1669
+ place?: boolean;
1670
+ update_db?: boolean;
1671
+ raw?: boolean;
1672
+ use_current?: boolean;
1673
+ }): Promise<any>;
1674
+ buildAppConfig(payload: {
1675
+ entry: number;
1676
+ stop: number;
1677
+ risk_reward: number;
1678
+ risk: number;
1679
+ profit?: number;
1680
+ update_db?: boolean;
1681
+ profit_percent?: number;
1682
+ }): Promise<AppConfig>;
1683
+ placeConfigOrders(app_config: AppConfig, solution: {
1684
+ risk_reward: number;
1685
+ entry: number;
1686
+ stop: number;
1687
+ risk_per_trade: number;
1688
+ avg_size: number;
1689
+ neg_pnl: number;
1690
+ min_size: number;
1691
+ symbol: string;
1692
+ }, place?: boolean, skip_stop?: boolean): Promise<{
1693
+ entry_orders: {
1694
+ orders: {
1695
+ entry: any;
1696
+ quantity: any;
1697
+ reverse_avg_entry: any;
1698
+ reverse_avg_quantity: any;
1699
+ avg_entry: any;
1700
+ avg_size: any;
1701
+ }[];
1702
+ kind: "long" | "short";
1703
+ };
1704
+ stop_orders: {
1705
+ stop: number;
1706
+ final_stop: number;
1707
+ kind: "long" | "short";
1708
+ quantity: any;
1709
+ is_limit: boolean;
1710
+ neg_pnl: any;
1711
+ };
1712
+ trades: any[];
1713
+ }>;
1714
+ determineAmountToBuy(payload: {
1715
+ orders: any[];
1716
+ kind: "long" | "short";
1717
+ refresh?: boolean;
1718
+ decimal_places?: string;
1719
+ price_places?: string;
1720
+ cancel?: boolean;
1721
+ place?: boolean;
1722
+ }): Promise<any[]>;
1723
+ refresh(live_refresh?: boolean): Promise<{
1724
+ instance: PositionsView;
1725
+ existingOrders: void | Order[];
1726
+ }>;
1727
+ placeTrade(payload: {
1728
+ place?: boolean;
1729
+ tp?: boolean;
1730
+ stop?: boolean;
1731
+ raw?: boolean;
1732
+ cancel?: boolean;
1733
+ ignore_config?: boolean;
1734
+ }): Promise<any>;
1735
+ }
1736
+ declare class ExchangeAccount$1 {
1737
+ instance: {
1738
+ owner: string;
1739
+ exchange: string;
1740
+ };
1741
+ exchange: BaseExchange;
1742
+ main_exchange?: BaseExchange;
1743
+ private app_db;
1744
+ private long_position?;
1745
+ private short_position?;
1746
+ constructor(payload: ExchangeType, options: {
1747
+ exchange: BaseExchange;
1748
+ app_db: AppDatabase;
1749
+ main_exchange?: BaseExchange;
1750
+ });
1751
+ /**
1752
+ *In order to avoid rate limiting issues, we cache the live exchange
1753
+ details for each symbol for an account in the database with an option
1754
+ to refresh.
1755
+ */
1756
+ getDBInstance(): AppDatabase;
1757
+ getLiveExchangeInstance(payload: {
1758
+ symbol: string;
1759
+ refresh?: boolean;
1760
+ refresh_symbol_config?: boolean;
1761
+ }): Promise<import("pocketbase").RecordModel>;
1762
+ initializePositions(payload: {
1763
+ symbol: string;
1764
+ as_view?: boolean;
1765
+ kind: "long" | "short";
1766
+ }): Promise<ExchangePosition>;
1767
+ getActiveAccount(payload: {
1768
+ symbol: string;
1769
+ full?: boolean;
1770
+ refresh?: boolean;
1771
+ }): Promise<Account | {
1772
+ liquidation: {
1773
+ long: number;
1774
+ short: number;
1775
+ };
1776
+ active_account: Account;
1777
+ current_price: any;
1778
+ exchange: any;
1779
+ }>;
1780
+ refreshAccount(payload: {
1781
+ symbol: string;
1782
+ live_refresh?: boolean;
1783
+ leverage?: number;
1784
+ }): Promise<(PositionsView & {
1785
+ expand?: {
1786
+ config: ScheduledTrade;
1787
+ account: ExchangeAccount;
1788
+ };
1789
+ })[]>;
1790
+ syncAccount(options: {
1791
+ symbol: string;
1792
+ kind?: "long" | "short";
1793
+ update?: boolean;
1794
+ as_view?: boolean;
1795
+ leverage?: number;
1796
+ live_refresh?: boolean;
1797
+ }): Promise<PositionsView | (PositionsView & {
1798
+ expand?: {
1799
+ config: ScheduledTrade;
1800
+ account: ExchangeAccount;
1801
+ };
1802
+ })[]>;
1803
+ getRunningInstanceFromDB(symbol: string): Promise<TradeBlockTracking>;
1804
+ syncOrders(options: {
1805
+ symbol: string;
1806
+ kind?: "long" | "short";
1807
+ update?: boolean;
1808
+ }): Promise<void | Order[]>;
1809
+ toggleStopBuying(payload: {
1810
+ symbol: string;
1811
+ kind: "long" | "short";
1812
+ should_stop?: boolean;
454
1813
  }): Promise<import("pocketbase").RecordModel>;
455
1814
  cancelOrders(payload: {
456
1815
  symbol: string;
@@ -458,7 +1817,9 @@ declare class ExchangeAccount$1 {
458
1817
  price?: number;
459
1818
  all?: boolean;
460
1819
  stop?: boolean;
461
- }): Promise<{
1820
+ limit?: boolean;
1821
+ raw?: boolean;
1822
+ }): Promise<any[] | {
462
1823
  success: boolean;
463
1824
  message: string;
464
1825
  exchange_result?: undefined;
@@ -478,135 +1839,676 @@ declare class ExchangeAccount$1 {
478
1839
  symbol: string;
479
1840
  orders: number[];
480
1841
  }): Promise<any>;
1842
+ getBreakEvenPrice(payload: {
1843
+ symbol: string;
1844
+ }): Promise<{
1845
+ price: number;
1846
+ direction: string;
1847
+ }>;
481
1848
  buildAppConfig(payload: {
482
1849
  entry: number;
483
1850
  stop: number;
484
1851
  risk_reward: number;
485
1852
  risk: number;
486
1853
  symbol: string;
487
- profit?: number;
488
- update_db?: boolean;
489
- profit_percent?: number;
490
- }): Promise<AppConfig>;
491
- placeConfigOrders(app_config: AppConfig, solution: {
1854
+ profit?: number;
1855
+ update_db?: boolean;
1856
+ profit_percent?: number;
1857
+ }): Promise<AppConfig>;
1858
+ tradeConfig(payload: {
1859
+ symbol: string;
1860
+ kind: "long" | "short";
1861
+ }): Promise<AppConfig>;
1862
+ justInTimeProfit(payload: {
1863
+ symbol: string;
1864
+ target_pnl: number;
1865
+ kind: "long" | "short";
1866
+ refresh?: boolean;
1867
+ place?: boolean;
1868
+ take_profit?: number;
1869
+ pause_tp?: boolean;
1870
+ }): Promise<{
1871
+ sell_ratio: number;
1872
+ current_pnl: number;
1873
+ profit_percent: number;
1874
+ current_price: number;
1875
+ notional_value: number;
1876
+ }>;
1877
+ buildTrades(payload: {
1878
+ symbol: string;
1879
+ kind: "long" | "short";
1880
+ risk?: number;
1881
+ }): Promise<{
1882
+ trades: any[];
1883
+ max_size: any;
1884
+ last_price: any;
1885
+ total_size: number;
1886
+ avg_entry: number;
1887
+ }>;
1888
+ placeConfigOrders(app_config: AppConfig, solution: {
1889
+ risk_reward: number;
1890
+ entry: number;
1891
+ stop: number;
1892
+ risk_per_trade: number;
1893
+ avg_size: number;
1894
+ neg_pnl: number;
1895
+ min_size: number;
1896
+ symbol: string;
1897
+ stop_percent?: number;
1898
+ }, place?: boolean, skip_stop?: boolean): Promise<{
1899
+ entry_orders: {
1900
+ orders: {
1901
+ entry: any;
1902
+ quantity: any;
1903
+ reverse_avg_entry: any;
1904
+ reverse_avg_quantity: any;
1905
+ avg_entry: any;
1906
+ avg_size: any;
1907
+ }[];
1908
+ kind: "long" | "short";
1909
+ };
1910
+ stop_orders: {
1911
+ stop: number;
1912
+ final_stop: number;
1913
+ kind: "long" | "short";
1914
+ quantity: any;
1915
+ is_limit: boolean;
1916
+ neg_pnl: any;
1917
+ original_stop: number;
1918
+ last_entry: any;
1919
+ };
1920
+ trades: any[];
1921
+ }>;
1922
+ determineAmountToBuy(payload: {
1923
+ orders: any[];
1924
+ kind: "long" | "short";
1925
+ refresh?: boolean;
1926
+ decimal_places?: string;
1927
+ price_places?: string;
1928
+ symbol: string;
1929
+ cancel?: boolean;
1930
+ place?: boolean;
1931
+ }): Promise<any[]>;
1932
+ placeSharedOrder(action: "place_limit_orders" | "place_stop_orders" | "place_tp_orders" | "dangerous_entry_orders", payload: {
1933
+ symbol: string;
1934
+ entry: number;
1935
+ stop: number;
1936
+ risk_reward: number;
1937
+ risk: number;
1938
+ place?: boolean;
1939
+ update_db?: boolean;
1940
+ raw?: boolean;
1941
+ use_current?: boolean;
1942
+ stop_percent?: number;
1943
+ }): Promise<any>;
1944
+ getOrCreatePositionConfig(payload: {
1945
+ symbol: string;
1946
+ kind: "long" | "short";
1947
+ risk?: number;
1948
+ risk_reward?: number;
1949
+ }): Promise<import("pocketbase").RecordModel | ScheduledTrade>;
1950
+ getPositionConfig(payload: {
1951
+ symbol: string;
1952
+ kind: "long" | "short";
1953
+ params?: {
1954
+ entry?: number;
1955
+ stop?: number;
1956
+ risk_reward?: number;
1957
+ risk?: number;
1958
+ profit_percent?: number;
1959
+ place_tp?: boolean;
1960
+ profit?: number;
1961
+ };
1962
+ }): Promise<import("pocketbase").RecordModel | ScheduledTrade>;
1963
+ getCurrentPrice(symbol: string): Promise<any>;
1964
+ getAccountStrategy(payload: {
1965
+ symbol: string;
1966
+ }): Promise<AccountStrategy>;
1967
+ buildReduceConfig(payload: {
1968
+ symbol: string;
1969
+ kind?: "long" | "short";
1970
+ as_dict?: boolean;
1971
+ target_pnl?: number;
1972
+ trigger?: {
1973
+ long: boolean;
1974
+ short: boolean;
1975
+ };
1976
+ use_full?: boolean;
1977
+ }): Promise<{
1978
+ trigger_short: boolean;
1979
+ trigger_long: boolean;
1980
+ symbol: string;
1981
+ short_minimum_pnl: number;
1982
+ long_minimum_pnl: number;
1983
+ short_profit: any;
1984
+ long_profit: any;
1985
+ owner: string;
1986
+ exchange: string;
1987
+ not_reduce: boolean;
1988
+ reduce_ratio_long: any;
1989
+ reduce_ratio_short: any;
1990
+ use_full_long: any;
1991
+ use_full_short: any;
1992
+ } | {
1993
+ long: {
1994
+ minimum_pnl: number;
1995
+ max_size: number;
1996
+ profit: any;
1997
+ increase: boolean;
1998
+ not_reduce: boolean;
1999
+ ratio: any;
2000
+ use_full: boolean;
2001
+ sell_ratio: any;
2002
+ };
2003
+ short: {
2004
+ minimum_pnl: number;
2005
+ max_size: number;
2006
+ profit: any;
2007
+ increase: boolean;
2008
+ not_reduce: boolean;
2009
+ ratio: any;
2010
+ use_full: boolean;
2011
+ sell_ratio: any;
2012
+ };
2013
+ trigger: {
2014
+ long: boolean;
2015
+ short: boolean;
2016
+ };
2017
+ }>;
2018
+ getOriginalPlannedStop(payload: {
2019
+ symbol: string;
2020
+ kind: "long" | "short";
2021
+ }): Promise<any>;
2022
+ syncReduceClosePosition(payload?: {
2023
+ symbol: string;
2024
+ kind?: "long" | "short";
2025
+ trigger?: boolean;
2026
+ }): Promise<any>;
2027
+ reduceMajorPositionEntry(payload: {
2028
+ symbol: string;
2029
+ long: any;
2030
+ short: any;
2031
+ trigger: {
2032
+ long: boolean;
2033
+ short: boolean;
2034
+ };
2035
+ }): Promise<any>;
2036
+ placeProfitAndStop(payload: {
2037
+ symbol: string;
2038
+ trigger?: boolean;
2039
+ refresh?: boolean;
2040
+ kind?: "long" | "short";
2041
+ target_pnl?: number;
2042
+ }): Promise<any>;
2043
+ reEnterPositionOnEmpty(symbol: string): Promise<void>;
2044
+ generate_config_params(payload: {
2045
+ entry: number;
2046
+ stop: number;
2047
+ risk_reward: number;
2048
+ risk: number;
2049
+ symbol: string;
2050
+ with_trades?: boolean;
2051
+ }): Promise<any>;
2052
+ build_short_order(payload: {
2053
+ symbol: string;
2054
+ kind: "long" | "short";
2055
+ }): Promise<any>;
2056
+ extrapolateShortConfig(payload: {
2057
+ kind: "long" | "short";
2058
+ symbol: string;
2059
+ risk_reward?: number;
2060
+ risk?: number;
2061
+ }): Promise<any>;
2062
+ placeMarketOrder(payload: {
2063
+ symbol: string;
2064
+ kind: "long" | "short";
2065
+ quantity: number;
2066
+ }): Promise<void>;
2067
+ placeSingleOrder(payload: {
2068
+ symbol: string;
2069
+ kind: "long" | "short";
2070
+ }): Promise<string>;
2071
+ increasePositionAtStop(payload: {
2072
+ symbol: string;
2073
+ kind: "long" | "short";
2074
+ place?: boolean;
2075
+ }): Promise<any>;
2076
+ triggerTradeFromConfig(payload: {
2077
+ symbol: string;
2078
+ kind: "long" | "short";
2079
+ place?: boolean;
2080
+ raw?: boolean;
2081
+ tp?: boolean;
2082
+ stop?: boolean;
2083
+ use_current?: boolean;
2084
+ ignore_config?: boolean;
2085
+ }): Promise<any>;
2086
+ verifyStopLoss(payload: {
2087
+ symbol: string;
2088
+ kind: "long" | "short";
2089
+ revert?: boolean;
2090
+ }): Promise<void | Order[]>;
2091
+ windDownSymbol(payload: {
2092
+ symbol: string;
2093
+ risk_reward?: number;
2094
+ risk?: number;
2095
+ }): Promise<void>;
2096
+ updateTargetPnl(payload: {
2097
+ symbol: string;
2098
+ kind: "long" | "short";
2099
+ }): Promise<number>;
2100
+ /**
2101
+ * Updates the risk configuration for an empty position using the next_risk value.
2102
+ * This implements progressive risk management where successful trades increase future risk tolerance.
2103
+ *
2104
+ * @param payload.symbol - The trading symbol (e.g., "BTCUSDT")
2105
+ * @param payload.kind - Position type: "long" or "short"
2106
+ * @returns Object indicating if update was successful with old/new risk values
2107
+ */
2108
+ updateRiskOnEmpty(payload: {
2109
+ symbol: string;
2110
+ kind: "long" | "short";
2111
+ }): Promise<{
2112
+ updated: boolean;
2113
+ symbol: string;
2114
+ kind: "long" | "short";
2115
+ old_risk: number;
2116
+ new_risk: number;
2117
+ reason?: undefined;
2118
+ } | {
2119
+ updated: boolean;
2120
+ symbol: string;
2121
+ kind: "long" | "short";
2122
+ reason: string;
2123
+ old_risk?: undefined;
2124
+ new_risk?: undefined;
2125
+ }>;
2126
+ updateGoodHedgeConfig(payload: {
2127
+ symbol: string;
2128
+ params?: {
2129
+ support: number;
2130
+ resistance: number;
2131
+ risk: number;
2132
+ profit_percent: number;
2133
+ };
2134
+ risk_factor?: number;
2135
+ update?: boolean;
2136
+ place?: boolean;
2137
+ update_tp?: boolean;
2138
+ }): Promise<{
2139
+ support: number;
2140
+ resistance: number;
2141
+ risk: number;
2142
+ profit_percent: number;
2143
+ }>;
2144
+ /**
2145
+ * This method is used to place the opposite trade action
2146
+ */
2147
+ placeOppositeTradeAction(payload: {
2148
+ symbol: string;
2149
+ kind: "long" | "short";
2150
+ data: {
2151
+ avg: {
2152
+ quantity: number;
2153
+ price: number;
2154
+ };
2155
+ entry: number;
2156
+ stop: number;
2157
+ risk_per_trade: number;
2158
+ profit_percent: number;
2159
+ risk_reward: number;
2160
+ };
2161
+ }): Promise<void>;
2162
+ buildOppositeTrades(payload: {
2163
+ symbol: string;
2164
+ kind: "long" | "short";
2165
+ place?: boolean;
2166
+ place_symbol?: string;
2167
+ }): Promise<{
2168
+ avg: {
2169
+ entry: number;
2170
+ price: number;
2171
+ quantity: number;
2172
+ };
2173
+ loss: number;
2174
+ profit_percent: number;
2175
+ fee: number;
2176
+ risk_per_trade: number;
492
2177
  risk_reward: number;
2178
+ symbol?: string;
2179
+ focus: number;
2180
+ budget: number;
2181
+ support: number;
2182
+ resistance: number;
2183
+ percent_change: number;
2184
+ tradeSplit?: number;
2185
+ take_profit?: number;
2186
+ kind: "long" | "short";
493
2187
  entry: number;
494
2188
  stop: number;
495
- risk_per_trade: number;
496
- avg_size: number;
497
- neg_pnl: number;
498
2189
  min_size: number;
2190
+ price_places?: string;
2191
+ strategy?: "quantity" | "entry";
2192
+ as_array?: boolean;
2193
+ decimal_places?: string;
2194
+ min_profit?: number;
2195
+ raw?: boolean;
2196
+ gap?: number;
2197
+ rr?: number;
2198
+ max_size?: number;
2199
+ max_quantity?: number;
2200
+ }>;
2201
+ runSimulation(payload: {
499
2202
  symbol: string;
500
- }, place?: boolean, skip_stop?: boolean): Promise<{
501
- entry_orders: {
502
- orders: {
503
- entry: any;
504
- quantity: any;
505
- reverse_avg_entry: any;
506
- reverse_avg_quantity: any;
507
- avg_entry: any;
508
- avg_size: any;
509
- }[];
510
- kind: "long" | "short";
2203
+ kind: "long" | "short";
2204
+ iterations?: number;
2205
+ raw?: boolean;
2206
+ }): Promise<Strategy | {
2207
+ last_entry: any;
2208
+ first_entry: any;
2209
+ threshold: any;
2210
+ risk: number;
2211
+ risk_reward: number;
2212
+ spread: number;
2213
+ gap_loss: number;
2214
+ net_profit: number;
2215
+ long: {
2216
+ avg_entry: number;
2217
+ avg_size: number;
2218
+ loss: number;
2219
+ stop: number;
2220
+ stop_quantity: number;
2221
+ re_entry_quantity: number;
2222
+ initial_pnl: number;
2223
+ tp: number;
2224
+ incurred_loss: number;
2225
+ pnl: number;
2226
+ remaining_quantity: number;
511
2227
  };
512
- stop_orders: {
2228
+ short: {
2229
+ avg_entry: number;
2230
+ avg_size: number;
2231
+ loss: number;
513
2232
  stop: number;
514
- final_stop: number;
515
- kind: "long" | "short";
516
- quantity: any;
517
- is_limit: boolean;
2233
+ stop_quantity: number;
2234
+ re_entry_quantity: number;
2235
+ initial_pnl: number;
2236
+ tp: number;
2237
+ incurred_loss: number;
2238
+ pnl: number;
2239
+ remaining_quantity: number;
518
2240
  };
519
- trades: any[];
520
- }>;
521
- placeSharedOrder(action: "place_limit_orders" | "place_stop_orders" | "place_tp_orders", payload: {
2241
+ }[]>;
2242
+ getCurrentRun(payload: {
2243
+ symbol: string;
2244
+ kind?: "long" | "short";
2245
+ pnl?: number;
2246
+ }): Promise<true | import("pocketbase").RecordModel>;
2247
+ recomputeSymbolConfig(payload: {
2248
+ symbol: string;
2249
+ refresh?: boolean;
2250
+ }): Promise<SymbolConfig>;
2251
+ /**
2252
+ * This function builds a config for a symbol
2253
+ * @param payload
2254
+ * @returns
2255
+ */
2256
+ buildConfigForSymbol(payload: {
522
2257
  symbol: string;
523
- entry: number;
524
- stop: number;
525
- risk_reward: number;
526
2258
  risk: number;
527
- place?: boolean;
528
- update_db?: boolean;
2259
+ kind?: "long" | "short";
2260
+ risk_reward?: number;
2261
+ as_config?: boolean;
2262
+ with_trades?: boolean;
529
2263
  }): Promise<any>;
530
- getPositionConfig(payload: {
2264
+ triggerBullishMarket(payload: {
2265
+ symbol: string;
2266
+ profit_percent?: number;
2267
+ risk_reward?: number;
2268
+ }): Promise<any>;
2269
+ updateAllActiveSymbols(payload: {
2270
+ interval?: number;
2271
+ }): Promise<void>;
2272
+ updateAllPositionsWithNoConfig(payload: {
2273
+ kind: "long" | "short";
2274
+ }): Promise<void>;
2275
+ getSymbolsForPositions(): Promise<any[]>;
2276
+ getNonEssentialSymbols(): Promise<any[]>;
2277
+ _terminatePositions(payload: {
2278
+ symbol: string;
2279
+ }): Promise<void>;
2280
+ getOrders(payload: {
531
2281
  symbol: string;
532
2282
  kind: "long" | "short";
533
- params?: {
534
- entry: number;
535
- stop: number;
536
- risk_reward: number;
537
- risk: number;
538
- profit_percent?: number;
539
- };
540
- }): Promise<ScheduledTrade>;
541
- getCurrentPrice(symbol: string): Promise<any>;
542
- getPositionStrategy(): Promise<{
543
- strategy_instance: Strategy;
544
- focus_account: ExchangeAccount;
2283
+ type: "limit" | "stop" | "tp";
2284
+ }): Promise<Order[]>;
2285
+ syncPositionConfigs(payload: {
2286
+ symbol: string;
2287
+ kind: "long" | "short";
2288
+ refresh?: boolean;
2289
+ }): Promise<void>;
2290
+ terminatePositions(payload: {
2291
+ symbol: string;
2292
+ }): Promise<void>;
2293
+ fetchAndUpdateTopMovers(): Promise<{
2294
+ updated_bullish: BullishMarket[];
2295
+ moved_to_winding: WindingDownMarket[];
545
2296
  }>;
546
- getOriginalPlannedStop(payload: {
2297
+ computeTargetPnl(payload: {
2298
+ symbol: string;
2299
+ kind: "long" | "short";
2300
+ }): Promise<number>;
2301
+ placeStopLimit(payload: {
547
2302
  symbol: string;
548
2303
  kind: "long" | "short";
2304
+ place?: boolean;
2305
+ stop: number;
2306
+ quantity?: number;
549
2307
  }): Promise<any>;
550
- syncReduceClosePosition(symbol: string, payload?: {
551
- kind?: "long" | "short";
552
- long?: CodeNode;
553
- short?: CodeNode;
554
- trigger?: {
555
- long: boolean;
556
- short: boolean;
557
- };
2308
+ placeTrade(payload: {
2309
+ symbol: string;
2310
+ kind: "long" | "short";
2311
+ place?: boolean;
2312
+ limit?: boolean;
2313
+ tp?: boolean;
2314
+ stop?: boolean;
2315
+ raw?: boolean;
2316
+ cancel?: boolean;
2317
+ ignore_config?: boolean;
2318
+ target_pnl?: number;
558
2319
  }): Promise<any>;
559
- generate_config_params(payload: {
560
- entry: number;
561
- stop: number;
562
- risk_reward: number;
563
- risk: number;
2320
+ updateConfigPnl(payload: {
2321
+ symbol: string;
2322
+ kind: "long" | "short";
2323
+ }): Promise<void>;
2324
+ determineReduceTp(payload: {
564
2325
  symbol: string;
2326
+ factor: number;
565
2327
  }): Promise<{
566
- place_stop: boolean;
567
- profit_percent: number;
568
- entry: number;
569
- stop: number;
570
- avg_size: any;
571
- avg_entry: any;
572
- risk_reward: number;
573
- neg_pnl: any;
574
- risk: number;
2328
+ long_diff: number;
2329
+ short_diff: number;
2330
+ gap: number;
2331
+ gap_cost: number;
2332
+ long_tp: number;
2333
+ short_tp: number;
2334
+ long_percent: number;
2335
+ short_percent: number;
575
2336
  }>;
576
- extrapolateShortConfig(payload: {
577
- kind: "long" | "short";
2337
+ profitWithinGapStrategy(payload: {
578
2338
  symbol: string;
579
- risk_reward?: number;
580
2339
  }): Promise<{
581
- place_stop: boolean;
582
- profit_percent: number;
583
- entry: number;
584
- stop: number;
585
- avg_size: any;
586
- avg_entry: any;
587
- risk_reward: number;
588
- neg_pnl: any;
589
- risk: number;
2340
+ positions: {
2341
+ long: PositionsView & {
2342
+ expand?: {
2343
+ account_strategy?: AccountStrategy;
2344
+ };
2345
+ };
2346
+ short: PositionsView & {
2347
+ expand?: {
2348
+ account_strategy?: AccountStrategy;
2349
+ };
2350
+ };
2351
+ };
2352
+ config_details: {
2353
+ app_config: {
2354
+ fee: number;
2355
+ risk_per_trade: number;
2356
+ risk_reward: number;
2357
+ symbol?: string;
2358
+ focus: number;
2359
+ budget: number;
2360
+ support: number;
2361
+ resistance: number;
2362
+ percent_change: number;
2363
+ tradeSplit?: number;
2364
+ take_profit?: number;
2365
+ kind: "long" | "short";
2366
+ entry: number;
2367
+ stop: number;
2368
+ min_size: number;
2369
+ price_places?: string;
2370
+ strategy?: "quantity" | "entry";
2371
+ as_array?: boolean;
2372
+ decimal_places?: string;
2373
+ min_profit?: number;
2374
+ raw?: boolean;
2375
+ gap?: number;
2376
+ rr?: number;
2377
+ max_size?: number;
2378
+ max_quantity?: number;
2379
+ };
2380
+ last_value: any;
2381
+ config: {
2382
+ entry: number;
2383
+ stop: number;
2384
+ risk: number;
2385
+ risk_reward: number | {
2386
+ result: any[];
2387
+ value: number;
2388
+ total: number;
2389
+ risk_per_trade: number;
2390
+ max: number;
2391
+ min: number;
2392
+ neg_pnl: any;
2393
+ entry: any;
2394
+ };
2395
+ profit_percent: number;
2396
+ };
2397
+ pnl: number;
2398
+ };
590
2399
  }>;
591
- triggerTradeFromConfig(payload: {
2400
+ generateGapTp(payload: {
2401
+ symbol: string;
2402
+ factor?: number;
2403
+ }): Promise<{
2404
+ profit_percent: {
2405
+ long: number;
2406
+ short: number;
2407
+ };
2408
+ risk: {
2409
+ short: number;
2410
+ long: number;
2411
+ };
2412
+ take_profit: {
2413
+ long: number;
2414
+ short: number;
2415
+ };
2416
+ to_reduce: {
2417
+ short: number;
2418
+ long: number;
2419
+ };
2420
+ full_reduce: {
2421
+ short: number;
2422
+ long: number;
2423
+ };
2424
+ sell_quantity: {
2425
+ short: number;
2426
+ long: number;
2427
+ };
2428
+ gap: number;
2429
+ gap_loss: number;
2430
+ }>;
2431
+ getSellPriceFromStrategy(payload: {
592
2432
  symbol: string;
2433
+ reduce_position: PositionsView;
2434
+ kind?: "long" | "short";
2435
+ full_ratio?: number;
2436
+ }): Promise<{
2437
+ pnl: number;
2438
+ loss: number;
2439
+ full_loss: number;
2440
+ original_pnl: number;
2441
+ reward_factor: number;
2442
+ profit_percent: number;
593
2443
  kind: "long" | "short";
594
- }): Promise<any>;
595
- verifyStopLoss(payload: {
2444
+ sell_price: number;
2445
+ quantity: number;
2446
+ price_places: string;
2447
+ decimal_places: string;
2448
+ }>;
2449
+ placeCompoundShortTrade(payload: {}): Promise<void>;
2450
+ placeCompoundLongTrade(payload: {
2451
+ symbol: string;
2452
+ params: {
2453
+ resistance: number;
2454
+ support: number;
2455
+ profit_percent: number;
2456
+ risk_reward: number;
2457
+ risk: number;
2458
+ };
2459
+ place?: boolean;
2460
+ }): Promise<void>;
2461
+ getConfigProfiles(payload: {
596
2462
  symbol: string;
597
2463
  kind: "long" | "short";
598
- revert?: boolean;
599
- }): Promise<import("pocketbase").RecordModel[]>;
600
- windDownSymbol(symbol: string, risk_reward?: number): Promise<void>;
601
- triggerBullishMarket(symbol: string): Promise<any>;
2464
+ }): Promise<{
2465
+ id: any;
2466
+ entry: any;
2467
+ stop: any;
2468
+ kind: "long" | "short";
2469
+ risk_reward: any;
2470
+ risk: any;
2471
+ profit_percent: any;
2472
+ }[]>;
602
2473
  }
2474
+ declare function getExchangeAccount(payload: {
2475
+ account: ExchangeType;
2476
+ app_db: AppDatabase;
2477
+ getCredentials: (payload: {
2478
+ account: string;
2479
+ exchange: string;
2480
+ app_db: AppDatabase;
2481
+ }) => Promise<{
2482
+ api_key: string;
2483
+ api_secret: string;
2484
+ email: string;
2485
+ }>;
2486
+ proxyOptions?: {
2487
+ proxy?: any;
2488
+ ignore_proxy?: boolean;
2489
+ };
2490
+ canWithdraw?: boolean;
2491
+ }): Promise<ExchangeAccount$1>;
603
2492
  declare class App {
604
- private app_db;
2493
+ app_db: AppDatabase;
2494
+ proxyOptions?: {
2495
+ proxy?: any;
2496
+ ignore_proxy?: boolean;
2497
+ canWithdraw?: boolean;
2498
+ };
605
2499
  private getCredentials;
606
- constructor(app_db: AppDatabase, getCredentials: (account: string, exchange: string) => (account: string, exchange: string) => Promise<{
2500
+ constructor(app_db: AppDatabase, getCredentials: (payload: {
2501
+ account: string;
2502
+ exchange: string;
2503
+ }) => Promise<{
607
2504
  api_key: string;
608
2505
  api_secret: string;
609
- }>);
2506
+ email: string;
2507
+ }>, proxyOptions?: {
2508
+ proxy?: any;
2509
+ ignore_proxy?: boolean;
2510
+ canWithdraw?: boolean;
2511
+ });
610
2512
  getExchangeAccount(account: ExchangeType): Promise<ExchangeAccount$1>;
611
2513
  syncAccount(payload: {
612
2514
  account: ExchangeType;
@@ -617,6 +2519,7 @@ declare class App {
617
2519
  }): Promise<PositionsView | (PositionsView & {
618
2520
  expand?: {
619
2521
  config: ScheduledTrade;
2522
+ account: ExchangeAccount;
620
2523
  };
621
2524
  })[]>;
622
2525
  syncOrders(payload: {
@@ -631,7 +2534,7 @@ declare class App {
631
2534
  price?: number;
632
2535
  all?: boolean;
633
2536
  stop?: boolean;
634
- }): Promise<{
2537
+ }): Promise<any[] | {
635
2538
  success: boolean;
636
2539
  message: string;
637
2540
  exchange_result?: undefined;
@@ -647,39 +2550,6 @@ declare class App {
647
2550
  message?: undefined;
648
2551
  exchange_result?: undefined;
649
2552
  }>;
650
- generateConfig(payload: {
651
- account: ExchangeType;
652
- symbol: string;
653
- kind: "long" | "short";
654
- update_orders?: boolean;
655
- place_orders?: boolean;
656
- }): Promise<any>;
657
- updateReduceRatio(payload: {
658
- account: ExchangeType;
659
- symbol: string;
660
- }): Promise<{
661
- long_position: any;
662
- short_position: any;
663
- long_db_position: any;
664
- short_db_position: any;
665
- balance: any;
666
- }>;
667
- verifyStopLoss(payload: {
668
- account: ExchangeType;
669
- symbol: string;
670
- kind: "long" | "short";
671
- revert?: boolean;
672
- }): Promise<import("pocketbase").RecordModel[]>;
673
- updateTopMovers(payload?: {
674
- new_markets: {
675
- symbol: string;
676
- percent: number;
677
- }[];
678
- totalRisk: number;
679
- }): Promise<{
680
- updated_bullish: BullishMarket[];
681
- moved_to_winding: WindingDownMarket[];
682
- }>;
683
2553
  getWindingDownMarkets(): Promise<WindingDownMarket[]>;
684
2554
  updateSymbolConfigs(payload: {
685
2555
  configs: {
@@ -696,7 +2566,137 @@ declare class App {
696
2566
  created: number;
697
2567
  }>;
698
2568
  updateAllAccountWithSymbols(with_positions?: boolean): Promise<void>;
699
- windDownSymbol(symbol: string): Promise<boolean>;
2569
+ windDownSymbol(payload: {
2570
+ symbol: string;
2571
+ risk?: number;
2572
+ }): Promise<boolean>;
2573
+ getNonEssentialSymbols(): Promise<Set<any>>;
2574
+ refreshAllPositionsWithSymbol(payload: {
2575
+ symbol: string;
2576
+ }): Promise<void>;
2577
+ autoFollowPositions(): Promise<void>;
2578
+ getMoverExchangeInstances(): Promise<ExchangeAccount[]>;
2579
+ updateTpOnAllMarkets(): Promise<void>;
2580
+ triggerMoverTask(payload: {
2581
+ callback: (params: {
2582
+ symbol: string;
2583
+ account: ExchangeType;
2584
+ }) => Promise<any>;
2585
+ removeCallback?: (params: {
2586
+ symbol: string;
2587
+ account: ExchangeType;
2588
+ }) => Promise<any>;
2589
+ }): Promise<void>;
2590
+ placeTrade(payload: {
2591
+ account: ExchangeType;
2592
+ symbol: string;
2593
+ kind: "long" | "short";
2594
+ place?: boolean;
2595
+ tp?: boolean;
2596
+ cancel?: boolean;
2597
+ raw?: boolean;
2598
+ }): Promise<any>;
2599
+ runDbStrategyAccounts(callback: (params: {
2600
+ symbol: string;
2601
+ account: ExchangeType;
2602
+ }) => Promise<any>): Promise<void>;
2603
+ profitWithinGapStrategy(payload: {
2604
+ account: ExchangeType;
2605
+ symbol: string;
2606
+ }): Promise<{
2607
+ positions: {
2608
+ long: PositionsView & {
2609
+ expand?: {
2610
+ account_strategy?: AccountStrategy;
2611
+ };
2612
+ };
2613
+ short: PositionsView & {
2614
+ expand?: {
2615
+ account_strategy?: AccountStrategy;
2616
+ };
2617
+ };
2618
+ };
2619
+ config_details: {
2620
+ app_config: {
2621
+ fee: number;
2622
+ risk_per_trade: number;
2623
+ risk_reward: number;
2624
+ symbol?: string;
2625
+ focus: number;
2626
+ budget: number;
2627
+ support: number;
2628
+ resistance: number;
2629
+ percent_change: number;
2630
+ tradeSplit?: number;
2631
+ take_profit?: number;
2632
+ kind: "long" | "short";
2633
+ entry: number;
2634
+ stop: number;
2635
+ min_size: number;
2636
+ price_places?: string;
2637
+ strategy?: "quantity" | "entry";
2638
+ as_array?: boolean;
2639
+ decimal_places?: string;
2640
+ min_profit?: number;
2641
+ raw?: boolean;
2642
+ gap?: number;
2643
+ rr?: number;
2644
+ max_size?: number;
2645
+ max_quantity?: number;
2646
+ };
2647
+ last_value: any;
2648
+ config: {
2649
+ entry: number;
2650
+ stop: number;
2651
+ risk: number;
2652
+ risk_reward: number | {
2653
+ result: any[];
2654
+ value: number;
2655
+ total: number;
2656
+ risk_per_trade: number;
2657
+ max: number;
2658
+ min: number;
2659
+ neg_pnl: any;
2660
+ entry: any;
2661
+ };
2662
+ profit_percent: number;
2663
+ };
2664
+ pnl: number;
2665
+ };
2666
+ }>;
2667
+ compoundLongTrade(payload: {
2668
+ main_account: ExchangeType & {
2669
+ symbol: string;
2670
+ };
2671
+ focus_account: ExchangeType & {
2672
+ symbol: string;
2673
+ };
2674
+ place?: boolean;
2675
+ rr?: number;
2676
+ }): Promise<{
2677
+ start_risk: number;
2678
+ short_profit: number;
2679
+ support: number;
2680
+ resistance: number;
2681
+ long_v: any;
2682
+ profit_percent: number;
2683
+ result: any;
2684
+ short_max_size: any;
2685
+ }>;
2686
+ reduceExistingPosition(payload: {
2687
+ main_account: ExchangeType & {
2688
+ symbol: string;
2689
+ kind?: "long" | "short";
2690
+ };
2691
+ reduce_account: ExchangeType & {
2692
+ symbol: string;
2693
+ };
2694
+ kind: "long" | "short";
2695
+ place?: boolean;
2696
+ increase?: boolean;
2697
+ full_ratio?: number;
2698
+ cancel_limit?: boolean;
2699
+ }): Promise<any>;
700
2700
  }
701
2701
  export declare function initApp(payload: {
702
2702
  db: {
@@ -704,14 +2704,50 @@ export declare function initApp(payload: {
704
2704
  email: string;
705
2705
  password: string;
706
2706
  };
707
- getCredentials: (account: string, exchange: string) => (account: string, exchange: string) => Promise<{
2707
+ password?: string;
2708
+ salt?: string;
2709
+ email?: string;
2710
+ getCredentials: (payload: {
2711
+ account: string;
2712
+ exchange: string;
2713
+ app_db: AppDatabase;
2714
+ }) => Promise<{
708
2715
  api_key: string;
709
2716
  api_secret: string;
2717
+ email: string;
710
2718
  }>;
2719
+ proxy?: any;
2720
+ ignore_proxy?: boolean;
2721
+ canWithdraw?: boolean;
2722
+ triggerToken?: string;
2723
+ }): Promise<App>;
2724
+ declare function getCredentials(payload: {
2725
+ account: string;
2726
+ exchange: string;
2727
+ app_db: AppDatabase;
2728
+ }): Promise<any>;
2729
+ export declare function initialize(payload: {
2730
+ password?: string;
2731
+ proxy?: any;
2732
+ ignore_proxy?: boolean;
2733
+ canWithdraw?: boolean;
711
2734
  }): Promise<App>;
712
2735
 
2736
+ declare namespace database {
2737
+ export { AppDatabase, ExchangeType, decryptObject, encryptObject, initPocketBaseClient };
2738
+ }
2739
+ declare namespace exchange_account {
2740
+ export { ExchangeAccount$1 as ExchangeAccount, getExchangeAccount };
2741
+ }
2742
+ declare namespace app {
2743
+ export { App, getCredentials, initApp, initialize };
2744
+ }
2745
+
713
2746
  export {
714
2747
  ExchangeAccount$1 as ExchangeAccount,
2748
+ app,
2749
+ database,
2750
+ exchange_account,
715
2751
  };
716
2752
 
717
2753
  export {};