@gbozee/ultimate 0.0.2-37 → 0.0.2-39

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +120 -127
  2. package/dist/index.js +1743 -1761
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -5,6 +5,105 @@ import PocketBase from 'pocketbase';
5
5
  import { RecordModel } from 'pocketbase';
6
6
  import { SocksProxyAgent } from 'socks-proxy-agent';
7
7
 
8
+ export interface BaseSystemFields {
9
+ id: string;
10
+ created: string;
11
+ updated: string;
12
+ }
13
+ export interface ExchangeAccount extends BaseSystemFields {
14
+ exchange: "binance" | "bybit";
15
+ owner: string;
16
+ email?: string;
17
+ user?: string;
18
+ usdt?: number;
19
+ usdc?: number;
20
+ proxy?: string;
21
+ bullish?: boolean;
22
+ bearish?: boolean;
23
+ movePercent?: number;
24
+ totalRisk?: number;
25
+ max_non_essential?: number;
26
+ profit_percent?: number;
27
+ risk_reward?: number;
28
+ exclude_coins?: {
29
+ bullish?: string[];
30
+ };
31
+ include_delisted?: boolean;
32
+ }
33
+ export interface SymbolConfig extends BaseSystemFields {
34
+ symbol: string;
35
+ support?: number;
36
+ resistance?: number;
37
+ stop_percent?: number;
38
+ price_places?: string;
39
+ decimal_places?: string;
40
+ min_size?: number;
41
+ weight?: number;
42
+ leverage?: number;
43
+ candle_count?: number;
44
+ interval?: any;
45
+ }
46
+ export interface ScheduledTrade extends BaseSystemFields {
47
+ symbol: string;
48
+ account: string;
49
+ profit?: number;
50
+ risk?: number;
51
+ entry?: number;
52
+ stop?: number;
53
+ risk_reward?: number;
54
+ profit_percent?: number;
55
+ place_tp?: boolean;
56
+ kind?: "long" | "short";
57
+ current_price?: number;
58
+ }
59
+ export interface AccountStrategy extends BaseSystemFields {
60
+ account: string;
61
+ symbol: string;
62
+ watch_symbol: string;
63
+ }
64
+ interface Proxy$1 extends BaseSystemFields {
65
+ ip_address?: string;
66
+ type?: "http" | "socks5";
67
+ }
68
+ export interface TradeBlockTracking extends BaseSystemFields {
69
+ account?: string;
70
+ symbol?: string;
71
+ running?: boolean;
72
+ }
73
+ export interface PositionsView {
74
+ id: string;
75
+ symbol?: any;
76
+ entry?: any;
77
+ quantity?: any;
78
+ take_profit?: any;
79
+ account?: any;
80
+ kind?: any;
81
+ target_pnl?: number;
82
+ liquidation?: number;
83
+ avg_price?: number;
84
+ avg_qty?: number;
85
+ next_order?: number;
86
+ last_order?: number;
87
+ config?: any;
88
+ stop_loss?: {
89
+ price: number;
90
+ quantity: number;
91
+ };
92
+ stop_pnl?: any;
93
+ leverage?: any;
94
+ avg_liquidation?: any;
95
+ balance?: any;
96
+ }
97
+ export interface BullishMarket extends RecordModel {
98
+ id: string;
99
+ symbol: string;
100
+ risk: number;
101
+ }
102
+ export interface WindingDownMarket extends RecordModel {
103
+ id: string;
104
+ symbol: string;
105
+ risk_reward: number;
106
+ }
8
107
  export type GlobalConfig = {
9
108
  profit_percent: number;
10
109
  symbol: string;
@@ -191,116 +290,6 @@ export interface BaseExchange {
191
290
  decimal_places?: string;
192
291
  }): Promise<any>;
193
292
  }
194
- export interface BaseSystemFields {
195
- id: string;
196
- created: string;
197
- updated: string;
198
- }
199
- export interface ExchangeAccount extends BaseSystemFields {
200
- exchange: "binance" | "bybit";
201
- owner: string;
202
- email?: string;
203
- user?: string;
204
- usdt?: number;
205
- usdc?: number;
206
- proxy?: string;
207
- bullish?: boolean;
208
- bearish?: boolean;
209
- movePercent?: number;
210
- totalRisk?: number;
211
- max_non_essential?: number;
212
- profit_percent?: number;
213
- risk_reward?: number;
214
- exclude_coins?: {
215
- bullish?: string[];
216
- };
217
- include_delisted?: boolean;
218
- }
219
- export interface SymbolConfig extends BaseSystemFields {
220
- symbol: string;
221
- support?: number;
222
- resistance?: number;
223
- stop_percent?: number;
224
- price_places?: string;
225
- decimal_places?: string;
226
- min_size?: number;
227
- weight?: number;
228
- leverage?: number;
229
- candle_count?: number;
230
- interval?: any;
231
- }
232
- export interface ScheduledTrade extends BaseSystemFields {
233
- symbol: string;
234
- account: string;
235
- profit?: number;
236
- risk?: number;
237
- entry?: number;
238
- stop?: number;
239
- risk_reward?: number;
240
- profit_percent?: number;
241
- place_tp?: boolean;
242
- kind?: "long" | "short";
243
- current_price?: number;
244
- }
245
- export interface Strategy extends BaseSystemFields {
246
- name: string;
247
- short_risk_factor?: number;
248
- long_risk_factor?: number;
249
- profit_percent?: number;
250
- cancel_short?: boolean;
251
- cancel_long?: boolean;
252
- recompute_short_config?: boolean;
253
- update_stop_loss?: boolean;
254
- liquidation_as_entry?: boolean;
255
- stop_as_entry?: boolean;
256
- tp_as_stop?: boolean;
257
- entry_as_stop?: boolean;
258
- place_stop?: boolean;
259
- save_config?: boolean;
260
- }
261
- interface Proxy$1 extends BaseSystemFields {
262
- ip_address?: string;
263
- type?: "http" | "socks5";
264
- }
265
- export interface TradeBlockTracking extends BaseSystemFields {
266
- account?: string;
267
- symbol?: string;
268
- running?: boolean;
269
- }
270
- export interface PositionsView {
271
- id: string;
272
- symbol?: any;
273
- entry?: any;
274
- quantity?: any;
275
- take_profit?: any;
276
- account?: any;
277
- kind?: any;
278
- target_pnl?: number;
279
- liquidation?: number;
280
- avg_price?: number;
281
- avg_qty?: number;
282
- next_order?: number;
283
- last_order?: number;
284
- config?: any;
285
- stop_loss?: {
286
- price: number;
287
- quantity: number;
288
- };
289
- stop_pnl?: any;
290
- leverage?: any;
291
- avg_liquidation?: any;
292
- balance?: any;
293
- }
294
- export interface BullishMarket extends RecordModel {
295
- id: string;
296
- symbol: string;
297
- risk: number;
298
- }
299
- export interface WindingDownMarket extends RecordModel {
300
- id: string;
301
- symbol: string;
302
- risk_reward: number;
303
- }
304
293
  export type ExchangeType = {
305
294
  owner: string;
306
295
  exchange: string;
@@ -388,6 +377,15 @@ export declare class AppDatabase {
388
377
  order_id: string;
389
378
  triggerPrice?: number;
390
379
  }>): Promise<import("pocketbase").RecordModel[]>;
380
+ cancelLimitOrders(payload: {
381
+ symbol: string;
382
+ kind: "long" | "short";
383
+ account: ExchangeType;
384
+ cancelExchangeOrders: (payload: {
385
+ symbol: string;
386
+ orders: number[];
387
+ }) => Promise<any>;
388
+ }): Promise<void>;
391
389
  cancelOrders(payload: {
392
390
  cancelExchangeOrders: (payload: {
393
391
  symbol: string;
@@ -436,10 +434,7 @@ export declare class AppDatabase {
436
434
  kind: "long" | "short";
437
435
  account: ExchangeType;
438
436
  }): Promise<ScheduledTrade | null>;
439
- getPositionStrategy(account: ExchangeType): Promise<{
440
- strategy_instance: Strategy;
441
- focus_account: ExchangeAccount;
442
- }>;
437
+ getPositionStrategy(account: ExchangeType): Promise<AccountStrategy>;
443
438
  createOrUpdateWindingDownMarket(payload: {
444
439
  symbol: string;
445
440
  risk_reward?: number;
@@ -799,7 +794,8 @@ declare class ExchangeAccount$1 {
799
794
  price?: number;
800
795
  all?: boolean;
801
796
  stop?: boolean;
802
- }): Promise<{
797
+ limit?: boolean;
798
+ }): Promise<void | {
803
799
  success: boolean;
804
800
  message: string;
805
801
  exchange_result?: undefined;
@@ -918,10 +914,10 @@ declare class ExchangeAccount$1 {
918
914
  };
919
915
  }): Promise<ScheduledTrade | import("pocketbase").RecordModel>;
920
916
  getCurrentPrice(symbol: string): Promise<any>;
921
- getPositionStrategy(): Promise<{
922
- strategy_instance: Strategy;
923
- focus_account: ExchangeAccount;
924
- }>;
917
+ getPositionStrategy(): Promise<AccountStrategy>;
918
+ toUpdate(payload: {
919
+ refresh?: boolean;
920
+ }): Promise<void>;
925
921
  buildReduceConfig(payload: {
926
922
  symbol: string;
927
923
  kind?: "long" | "short";
@@ -1109,6 +1105,10 @@ declare class ExchangeAccount$1 {
1109
1105
  raw?: boolean;
1110
1106
  cancel?: boolean;
1111
1107
  }): Promise<any>;
1108
+ updateConfigPnl(payload: {
1109
+ symbol: string;
1110
+ kind: "long" | "short";
1111
+ }): Promise<void>;
1112
1112
  }
1113
1113
  declare class App {
1114
1114
  app_db: AppDatabase;
@@ -1152,7 +1152,7 @@ declare class App {
1152
1152
  price?: number;
1153
1153
  all?: boolean;
1154
1154
  stop?: boolean;
1155
- }): Promise<{
1155
+ }): Promise<void | {
1156
1156
  success: boolean;
1157
1157
  message: string;
1158
1158
  exchange_result?: undefined;
@@ -1168,13 +1168,6 @@ declare class App {
1168
1168
  message?: undefined;
1169
1169
  exchange_result?: undefined;
1170
1170
  }>;
1171
- generateConfig(payload: {
1172
- account: ExchangeType;
1173
- symbol: string;
1174
- kind: "long" | "short";
1175
- update_orders?: boolean;
1176
- place_orders?: boolean;
1177
- }): Promise<any>;
1178
1171
  updateReduceRatio(payload: {
1179
1172
  account: ExchangeType;
1180
1173
  symbol: string;