@gbozee/ultimate 0.0.2-7 → 0.0.2-71
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.d.ts +544 -0
- package/dist/frontend-index.js +2124 -0
- package/dist/index.cjs +58854 -0
- package/dist/index.d.ts +1252 -222
- package/dist/index.js +40254 -17091
- package/package.json +15 -4
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,156 @@
|
|
|
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
|
+
}
|
|
75
|
+
export interface AccountStrategy extends BaseSystemFields {
|
|
76
|
+
account: string;
|
|
77
|
+
symbol: string;
|
|
78
|
+
tp_percent: number;
|
|
79
|
+
short_tp_factor: number;
|
|
80
|
+
fee_percent: number;
|
|
81
|
+
budget: number;
|
|
82
|
+
risk_reward: number;
|
|
83
|
+
reduce_ratio: number;
|
|
84
|
+
}
|
|
85
|
+
interface Proxy$1 extends BaseSystemFields {
|
|
86
|
+
ip_address?: string;
|
|
87
|
+
type?: "http" | "socks5";
|
|
88
|
+
}
|
|
89
|
+
export interface TradeBlockTracking extends BaseSystemFields {
|
|
90
|
+
account?: string;
|
|
91
|
+
symbol?: string;
|
|
92
|
+
running?: boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface PositionsView {
|
|
95
|
+
id: string;
|
|
96
|
+
symbol?: any;
|
|
97
|
+
entry?: any;
|
|
98
|
+
quantity?: any;
|
|
99
|
+
take_profit?: any;
|
|
100
|
+
account?: any;
|
|
101
|
+
kind?: any;
|
|
102
|
+
target_pnl?: number;
|
|
103
|
+
liquidation?: number;
|
|
104
|
+
avg_price?: number;
|
|
105
|
+
avg_qty?: number;
|
|
106
|
+
next_order?: number;
|
|
107
|
+
last_order?: number;
|
|
108
|
+
config?: any;
|
|
109
|
+
stop_loss?: {
|
|
110
|
+
price: number;
|
|
111
|
+
quantity: number;
|
|
112
|
+
};
|
|
113
|
+
stop_pnl?: any;
|
|
114
|
+
leverage?: any;
|
|
115
|
+
avg_liquidation?: any;
|
|
116
|
+
balance?: any;
|
|
117
|
+
reduce_ratio?: number;
|
|
118
|
+
sell_ratio?: number;
|
|
119
|
+
threshold_qty?: number;
|
|
120
|
+
follow?: boolean | 1 | 0;
|
|
121
|
+
current_price?: number;
|
|
122
|
+
usd_balance?: number;
|
|
123
|
+
}
|
|
124
|
+
export interface BullishMarket extends RecordModel {
|
|
125
|
+
id: string;
|
|
126
|
+
symbol: string;
|
|
127
|
+
risk: number;
|
|
128
|
+
}
|
|
129
|
+
export interface WindingDownMarket extends RecordModel {
|
|
130
|
+
id: string;
|
|
131
|
+
symbol: string;
|
|
132
|
+
risk_reward: number;
|
|
133
|
+
}
|
|
134
|
+
export type GlobalConfig = {
|
|
135
|
+
profit_percent: number;
|
|
136
|
+
symbol: string;
|
|
137
|
+
profit: number;
|
|
138
|
+
risk: number;
|
|
139
|
+
stop_percent: number;
|
|
140
|
+
kind: "long" | "short";
|
|
141
|
+
reduce_percent: number;
|
|
142
|
+
support: number;
|
|
143
|
+
resistance: number;
|
|
144
|
+
price_places: string;
|
|
145
|
+
decimal_places: string;
|
|
146
|
+
min_size: number;
|
|
147
|
+
accounts: {
|
|
148
|
+
owner: string;
|
|
149
|
+
exchange?: string;
|
|
150
|
+
}[];
|
|
151
|
+
risk_reward: number;
|
|
152
|
+
reverse_factor: number;
|
|
153
|
+
leverage?: number;
|
|
154
|
+
};
|
|
8
155
|
interface Position$1 {
|
|
9
156
|
id: number;
|
|
10
157
|
kind: "long" | "short";
|
|
@@ -85,10 +232,15 @@ export interface BaseExchange {
|
|
|
85
232
|
count: number;
|
|
86
233
|
raw?: boolean;
|
|
87
234
|
}): Promise<any>;
|
|
88
|
-
getExchangeAccountInfo(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
235
|
+
getExchangeAccountInfo(options: {
|
|
236
|
+
price_places?: string;
|
|
237
|
+
decimal_places?: string;
|
|
238
|
+
account: {
|
|
239
|
+
owner: string;
|
|
240
|
+
exchange: string;
|
|
241
|
+
};
|
|
242
|
+
symbol: string;
|
|
243
|
+
}): Promise<any>;
|
|
92
244
|
cancelOrders(payload: {
|
|
93
245
|
symbol: string;
|
|
94
246
|
orders: number[];
|
|
@@ -98,6 +250,7 @@ export interface BaseExchange {
|
|
|
98
250
|
take_profit: number;
|
|
99
251
|
kind: "long" | "short";
|
|
100
252
|
cancel?: boolean;
|
|
253
|
+
quantity?: number;
|
|
101
254
|
price_places?: string;
|
|
102
255
|
decimal_places?: string;
|
|
103
256
|
}): Promise<any>;
|
|
@@ -121,122 +274,107 @@ export interface BaseExchange {
|
|
|
121
274
|
symbol: string;
|
|
122
275
|
leverage: number;
|
|
123
276
|
}): Promise<any>;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
name: string;
|
|
165
|
-
short_risk_factor?: number;
|
|
166
|
-
long_risk_factor?: number;
|
|
167
|
-
profit_percent?: number;
|
|
168
|
-
cancel_short?: boolean;
|
|
169
|
-
cancel_long?: boolean;
|
|
170
|
-
recompute_short_config?: boolean;
|
|
171
|
-
update_stop_loss?: boolean;
|
|
172
|
-
liquidation_as_entry?: boolean;
|
|
173
|
-
stop_as_entry?: boolean;
|
|
174
|
-
tp_as_stop?: boolean;
|
|
175
|
-
entry_as_stop?: boolean;
|
|
176
|
-
place_stop?: boolean;
|
|
177
|
-
save_config?: boolean;
|
|
178
|
-
}
|
|
179
|
-
interface Proxy$1 extends BaseSystemFields {
|
|
180
|
-
ip_address?: string;
|
|
181
|
-
type?: "http" | "socks5";
|
|
182
|
-
}
|
|
183
|
-
export interface TradeBlockTracking extends BaseSystemFields {
|
|
184
|
-
account?: string;
|
|
185
|
-
symbol?: string;
|
|
186
|
-
running?: boolean;
|
|
187
|
-
}
|
|
188
|
-
export interface PositionsView {
|
|
189
|
-
id: string;
|
|
190
|
-
symbol?: any;
|
|
191
|
-
entry?: any;
|
|
192
|
-
quantity?: any;
|
|
193
|
-
take_profit?: any;
|
|
194
|
-
account?: any;
|
|
195
|
-
kind?: any;
|
|
196
|
-
target_pnl?: number;
|
|
197
|
-
liquidation?: number;
|
|
198
|
-
avg_price?: number;
|
|
199
|
-
avg_qty?: number;
|
|
200
|
-
next_order?: number;
|
|
201
|
-
last_order?: number;
|
|
202
|
-
config?: any;
|
|
203
|
-
stop_loss?: {
|
|
204
|
-
price: number;
|
|
277
|
+
generateConfig(payload: {
|
|
278
|
+
symbol: string;
|
|
279
|
+
interval?: any;
|
|
280
|
+
limit?: number;
|
|
281
|
+
}): Promise<any>;
|
|
282
|
+
checkDelistedMovers(payload: {
|
|
283
|
+
movePercent: number;
|
|
284
|
+
include_delisted?: boolean;
|
|
285
|
+
}): Promise<any>;
|
|
286
|
+
closePosition(payload: {
|
|
287
|
+
symbol: string;
|
|
288
|
+
kind: "long" | "short";
|
|
289
|
+
price_places?: string;
|
|
290
|
+
decimal_places?: string;
|
|
291
|
+
}): Promise<any>;
|
|
292
|
+
getAllOpenSymbols(): Promise<string[]>;
|
|
293
|
+
createLimitPurchaseOrders(payload: {
|
|
294
|
+
orders: any[];
|
|
295
|
+
kind: "long" | "short";
|
|
296
|
+
decimal_places?: string;
|
|
297
|
+
price_places?: string;
|
|
298
|
+
symbol: string;
|
|
299
|
+
}): Promise<any>;
|
|
300
|
+
getDelistedSpotSymbols(): Promise<any>;
|
|
301
|
+
getOpenPositions(): Promise<any>;
|
|
302
|
+
crossAccountTransfer(payload: {
|
|
303
|
+
from: {
|
|
304
|
+
owner: string;
|
|
305
|
+
wallet: string;
|
|
306
|
+
};
|
|
307
|
+
to: {
|
|
308
|
+
owner: string;
|
|
309
|
+
wallet: string;
|
|
310
|
+
};
|
|
311
|
+
asset: string;
|
|
312
|
+
amount: number;
|
|
313
|
+
}): Promise<any>;
|
|
314
|
+
placeMarketOrder(payload: {
|
|
315
|
+
symbol: string;
|
|
316
|
+
kind: "long" | "short";
|
|
205
317
|
quantity: number;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
avg_liquidation?: any;
|
|
210
|
-
balance?: any;
|
|
211
|
-
}
|
|
212
|
-
export interface BullishMarket extends RecordModel {
|
|
213
|
-
id: string;
|
|
214
|
-
symbol: string;
|
|
215
|
-
risk: number;
|
|
216
|
-
}
|
|
217
|
-
export interface WindingDownMarket extends RecordModel {
|
|
218
|
-
id: string;
|
|
219
|
-
symbol: string;
|
|
318
|
+
price_places?: string;
|
|
319
|
+
decimal_places?: string;
|
|
320
|
+
}): Promise<any>;
|
|
220
321
|
}
|
|
322
|
+
declare function initPocketBaseClient(proxy_credentials: {
|
|
323
|
+
host: string;
|
|
324
|
+
email: string;
|
|
325
|
+
password: string;
|
|
326
|
+
auto_cancellation?: boolean;
|
|
327
|
+
}): Promise<PocketBase>;
|
|
221
328
|
export type ExchangeType = {
|
|
222
329
|
owner: string;
|
|
223
330
|
exchange: string;
|
|
224
331
|
};
|
|
225
332
|
export declare class AppDatabase {
|
|
226
|
-
|
|
333
|
+
pb: PocketBase;
|
|
227
334
|
constructor(pb: PocketBase);
|
|
335
|
+
getCredentials(password: string): any;
|
|
336
|
+
saveCredentials(password: string, credentials: any): Promise<void>;
|
|
337
|
+
addNewCredential(password: string, payload: {
|
|
338
|
+
name: string;
|
|
339
|
+
exchange: string;
|
|
340
|
+
api_key: string;
|
|
341
|
+
api_secret: string;
|
|
342
|
+
}): Promise<void>;
|
|
343
|
+
getAllSymbolsFromPositions(options?: {
|
|
344
|
+
no_position?: boolean;
|
|
345
|
+
kind?: "long" | "short";
|
|
346
|
+
custom_filter?: string;
|
|
347
|
+
}): Promise<any[]>;
|
|
348
|
+
createOrUpdateLiveExchangeInstance(payload: {
|
|
349
|
+
account: ExchangeType;
|
|
350
|
+
symbol: string;
|
|
351
|
+
data?: any;
|
|
352
|
+
}): Promise<import("pocketbase").RecordModel>;
|
|
353
|
+
getLiveExchangeInstance(payload: {
|
|
354
|
+
account: ExchangeType;
|
|
355
|
+
symbol: string;
|
|
356
|
+
data?: any;
|
|
357
|
+
}): Promise<import("pocketbase").RecordModel>;
|
|
228
358
|
getProxyForAccount(account: ExchangeType): Promise<HttpsProxyAgent<`http://${string}`> | SocksProxyAgent>;
|
|
359
|
+
getAccounts(): Promise<ExchangeAccount[]>;
|
|
360
|
+
getAllSymbolConfigs(payload?: {
|
|
361
|
+
with_positions?: boolean;
|
|
362
|
+
custom_filter?: string;
|
|
363
|
+
}): Promise<SymbolConfig[]>;
|
|
229
364
|
get_exchange_db_instance(account: ExchangeType): Promise<ExchangeAccount & {
|
|
230
365
|
expand?: {
|
|
231
366
|
proxy: Proxy$1;
|
|
232
367
|
};
|
|
233
368
|
}>;
|
|
234
|
-
getPositions(
|
|
235
|
-
|
|
369
|
+
getPositions(options: {
|
|
370
|
+
account?: ExchangeType;
|
|
371
|
+
symbol?: string;
|
|
236
372
|
as_view?: boolean;
|
|
373
|
+
custom_filter?: string;
|
|
237
374
|
}): Promise<(PositionsView & {
|
|
238
375
|
expand?: {
|
|
239
376
|
config: ScheduledTrade;
|
|
377
|
+
account: ExchangeAccount;
|
|
240
378
|
};
|
|
241
379
|
})[]>;
|
|
242
380
|
private _createOrUpdatePosition;
|
|
@@ -248,6 +386,7 @@ export declare class AppDatabase {
|
|
|
248
386
|
}): Promise<(PositionsView & {
|
|
249
387
|
expand?: {
|
|
250
388
|
config: ScheduledTrade;
|
|
389
|
+
account: ExchangeAccount;
|
|
251
390
|
};
|
|
252
391
|
})[]>;
|
|
253
392
|
update_db_position(position: any, payload: any): Promise<import("pocketbase").RecordModel>;
|
|
@@ -259,7 +398,7 @@ export declare class AppDatabase {
|
|
|
259
398
|
getOrders(account: ExchangeType, options: {
|
|
260
399
|
symbol: string;
|
|
261
400
|
kind: "long" | "short";
|
|
262
|
-
}): Promise<
|
|
401
|
+
}): Promise<Order[]>;
|
|
263
402
|
deleteAndRecreateOrders(account: ExchangeType, options: {
|
|
264
403
|
symbol: string;
|
|
265
404
|
kind: "long" | "short";
|
|
@@ -272,7 +411,32 @@ export declare class AppDatabase {
|
|
|
272
411
|
stop: number;
|
|
273
412
|
order_id: string;
|
|
274
413
|
triggerPrice?: number;
|
|
275
|
-
}>): Promise<
|
|
414
|
+
}>): Promise<Order[]>;
|
|
415
|
+
deleteAndBulCreateAllOrders(payload: {
|
|
416
|
+
account: ExchangeType & {
|
|
417
|
+
id: string;
|
|
418
|
+
};
|
|
419
|
+
symbol: string;
|
|
420
|
+
all_orders: Array<{
|
|
421
|
+
symbol: string;
|
|
422
|
+
price: number;
|
|
423
|
+
quantity: number;
|
|
424
|
+
kind: "long" | "short";
|
|
425
|
+
side: "buy" | "sell";
|
|
426
|
+
stop: number;
|
|
427
|
+
order_id: string;
|
|
428
|
+
triggerPrice?: number;
|
|
429
|
+
}>;
|
|
430
|
+
}): Promise<void>;
|
|
431
|
+
cancelLimitOrders(payload: {
|
|
432
|
+
symbol: string;
|
|
433
|
+
kind: "long" | "short";
|
|
434
|
+
account: ExchangeType;
|
|
435
|
+
cancelExchangeOrders: (payload: {
|
|
436
|
+
symbol: string;
|
|
437
|
+
orders: number[];
|
|
438
|
+
}) => Promise<any>;
|
|
439
|
+
}): Promise<void>;
|
|
276
440
|
cancelOrders(payload: {
|
|
277
441
|
cancelExchangeOrders: (payload: {
|
|
278
442
|
symbol: string;
|
|
@@ -300,30 +464,41 @@ export declare class AppDatabase {
|
|
|
300
464
|
message?: undefined;
|
|
301
465
|
exchange_result?: undefined;
|
|
302
466
|
}>;
|
|
467
|
+
getMoverExchangeInstances(): Promise<ExchangeAccount[]>;
|
|
468
|
+
updateScheduledTrade(id: string, payload: any): Promise<import("pocketbase").RecordModel>;
|
|
469
|
+
getPositionsToAutoFollow(): Promise<(Position$1 & {
|
|
470
|
+
expand: {
|
|
471
|
+
account: ExchangeAccount;
|
|
472
|
+
};
|
|
473
|
+
})[]>;
|
|
303
474
|
createOrUpdatePositionConfig(db_position: any, payload: {
|
|
304
475
|
entry: number;
|
|
305
476
|
stop: number;
|
|
306
477
|
risk_reward: number;
|
|
307
478
|
risk: number;
|
|
308
479
|
profit_percent?: number;
|
|
309
|
-
|
|
480
|
+
place_tp?: boolean;
|
|
481
|
+
profit?: number;
|
|
482
|
+
}): Promise<import("pocketbase").RecordModel | ScheduledTrade>;
|
|
310
483
|
getPositionConfig(payload: {
|
|
311
484
|
symbol: string;
|
|
312
485
|
kind: "long" | "short";
|
|
313
486
|
account: ExchangeType;
|
|
487
|
+
}): Promise<ScheduledTrade | null>;
|
|
488
|
+
getPositionStrategy(account: ExchangeType): Promise<AccountStrategy>;
|
|
489
|
+
createOrUpdateWindingDownMarket(payload: {
|
|
490
|
+
symbol: string;
|
|
491
|
+
risk_reward?: number;
|
|
314
492
|
}): Promise<import("pocketbase").RecordModel>;
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
focus_account: ExchangeAccount;
|
|
318
|
-
}>;
|
|
319
|
-
createOrUpdateWindingDownMarket(symbol: string): Promise<import("pocketbase").RecordModel>;
|
|
320
|
-
getWindingDownMarkets(): Promise<WindingDownMarket[]>;
|
|
493
|
+
getWindingDownMarkets(symbol?: string): Promise<WindingDownMarket[]>;
|
|
494
|
+
getBullishMarket(symbol: string): Promise<BullishMarket>;
|
|
321
495
|
getBullishMarkets(options?: {
|
|
322
496
|
new_markets: Array<{
|
|
323
497
|
symbol: string;
|
|
324
498
|
percent: number;
|
|
325
499
|
}>;
|
|
326
500
|
totalRisk: number;
|
|
501
|
+
max_count?: number;
|
|
327
502
|
}): Promise<{
|
|
328
503
|
updated_bullish: BullishMarket[];
|
|
329
504
|
moved_to_winding: WindingDownMarket[];
|
|
@@ -342,18 +517,293 @@ export declare class AppDatabase {
|
|
|
342
517
|
updated: number;
|
|
343
518
|
created: number;
|
|
344
519
|
} | SymbolConfig[]>;
|
|
345
|
-
unwindSymbolFromDB(symbol: string): Promise<
|
|
520
|
+
unwindSymbolFromDB(symbol: string): Promise<boolean>;
|
|
521
|
+
hasExistingPosition(symbol: string): Promise<import("pocketbase").RecordModel[]>;
|
|
522
|
+
hasExistingOrders(symbol: string): Promise<import("pocketbase").RecordModel[]>;
|
|
523
|
+
removeSymbolFromUnwindingMarkets(symbol: string): Promise<boolean>;
|
|
524
|
+
removePosition(position: any): Promise<void>;
|
|
525
|
+
removePositionConfig(position: any): Promise<void>;
|
|
526
|
+
}
|
|
527
|
+
export type StrategyPosition = {
|
|
528
|
+
entry: number;
|
|
529
|
+
quantity: number;
|
|
530
|
+
};
|
|
531
|
+
export type Config = {
|
|
532
|
+
tp_percent: number;
|
|
533
|
+
short_tp_factor: number;
|
|
534
|
+
fee_percent?: number;
|
|
535
|
+
budget: number;
|
|
536
|
+
risk_reward: number;
|
|
537
|
+
reduce_ratio: number;
|
|
538
|
+
global_config: GlobalConfig;
|
|
539
|
+
};
|
|
540
|
+
export declare class Strategy {
|
|
541
|
+
position: {
|
|
542
|
+
long: StrategyPosition;
|
|
543
|
+
short: StrategyPosition;
|
|
544
|
+
};
|
|
545
|
+
dominant_position?: "long" | "short";
|
|
546
|
+
config: Config;
|
|
547
|
+
constructor(payload: {
|
|
548
|
+
long: StrategyPosition;
|
|
549
|
+
short: StrategyPosition;
|
|
550
|
+
config: Config;
|
|
551
|
+
dominant_position?: "long" | "short";
|
|
552
|
+
});
|
|
553
|
+
get price_places(): string;
|
|
554
|
+
get decimal_places(): string;
|
|
555
|
+
to_f(price: number): number;
|
|
556
|
+
to_df(quantity: number): number;
|
|
557
|
+
pnl(kind: "long" | "short", _position?: StrategyPosition): number;
|
|
558
|
+
tp(kind: "long" | "short"): number;
|
|
559
|
+
calculate_fee(position: {
|
|
560
|
+
price: number;
|
|
561
|
+
quantity: number;
|
|
562
|
+
}): number;
|
|
563
|
+
get long_tp(): number;
|
|
564
|
+
get short_tp(): number;
|
|
565
|
+
generateGapClosingAlgorithm(payload: {
|
|
566
|
+
kind: "long" | "short";
|
|
567
|
+
}): {
|
|
568
|
+
[x: string]: any;
|
|
569
|
+
risk: number;
|
|
570
|
+
risk_reward: number;
|
|
571
|
+
last_entry: any;
|
|
572
|
+
first_entry: any;
|
|
573
|
+
threshold: any;
|
|
574
|
+
};
|
|
575
|
+
runIterations(payload: {
|
|
576
|
+
kind: "long" | "short";
|
|
577
|
+
iterations: number;
|
|
578
|
+
risk_reward?: number;
|
|
579
|
+
}): {
|
|
580
|
+
[x: string]: any;
|
|
581
|
+
risk: number;
|
|
582
|
+
risk_reward: number;
|
|
583
|
+
last_entry: any;
|
|
584
|
+
first_entry: any;
|
|
585
|
+
threshold: any;
|
|
586
|
+
}[];
|
|
587
|
+
getPositionAfterTp(payload: {
|
|
588
|
+
kind: "long" | "short";
|
|
589
|
+
include_fees?: boolean;
|
|
590
|
+
}): {
|
|
591
|
+
[x: string]: number | {
|
|
592
|
+
entry: number;
|
|
593
|
+
quantity: number;
|
|
594
|
+
diff?: undefined;
|
|
595
|
+
} | {
|
|
596
|
+
[x: string]: number;
|
|
597
|
+
diff: number;
|
|
598
|
+
entry?: undefined;
|
|
599
|
+
quantity?: undefined;
|
|
600
|
+
};
|
|
601
|
+
pnl: {
|
|
602
|
+
[x: string]: number;
|
|
603
|
+
diff: number;
|
|
604
|
+
};
|
|
605
|
+
spread: number;
|
|
606
|
+
};
|
|
607
|
+
getPositionAfterIteration(payload: {
|
|
608
|
+
kind: "long" | "short";
|
|
609
|
+
iterations: number;
|
|
610
|
+
with_fees?: boolean;
|
|
611
|
+
}): {
|
|
612
|
+
[x: string]: number | {
|
|
613
|
+
entry: number;
|
|
614
|
+
quantity: number;
|
|
615
|
+
diff?: undefined;
|
|
616
|
+
} | {
|
|
617
|
+
[x: string]: number;
|
|
618
|
+
diff: number;
|
|
619
|
+
entry?: undefined;
|
|
620
|
+
quantity?: undefined;
|
|
621
|
+
};
|
|
622
|
+
pnl: {
|
|
623
|
+
[x: string]: number;
|
|
624
|
+
diff: number;
|
|
625
|
+
};
|
|
626
|
+
spread: number;
|
|
627
|
+
}[];
|
|
628
|
+
/**To be used as one of the agent tools eventually since
|
|
629
|
+
* it is something that can be triggered continously without
|
|
630
|
+
* any risk
|
|
631
|
+
*/
|
|
632
|
+
generateOppositeTrades(payload: {
|
|
633
|
+
kind: "long" | "short";
|
|
634
|
+
risk_factor?: number;
|
|
635
|
+
}): {
|
|
636
|
+
avg: {
|
|
637
|
+
entry: number;
|
|
638
|
+
price: number;
|
|
639
|
+
quantity: number;
|
|
640
|
+
};
|
|
641
|
+
loss: number;
|
|
642
|
+
profit_percent: number;
|
|
643
|
+
fee: number;
|
|
644
|
+
risk_per_trade: number;
|
|
645
|
+
risk_reward: number;
|
|
646
|
+
symbol?: string;
|
|
647
|
+
focus: number;
|
|
648
|
+
budget: number;
|
|
649
|
+
support: number;
|
|
650
|
+
resistance: number;
|
|
651
|
+
percent_change: number;
|
|
652
|
+
tradeSplit?: number;
|
|
653
|
+
take_profit?: number;
|
|
654
|
+
kind: "long" | "short";
|
|
655
|
+
entry: number;
|
|
656
|
+
stop: number;
|
|
657
|
+
min_size: number;
|
|
658
|
+
price_places?: string;
|
|
659
|
+
strategy?: "quantity" | "entry";
|
|
660
|
+
as_array?: boolean;
|
|
661
|
+
decimal_places?: string;
|
|
662
|
+
min_profit?: number;
|
|
663
|
+
raw?: boolean;
|
|
664
|
+
gap?: number;
|
|
665
|
+
rr?: number;
|
|
666
|
+
max_size?: number;
|
|
667
|
+
};
|
|
346
668
|
}
|
|
347
|
-
export
|
|
669
|
+
export type SignalConfigType = {
|
|
670
|
+
focus: number;
|
|
671
|
+
budget: number;
|
|
672
|
+
percent_change?: number;
|
|
673
|
+
price_places?: string;
|
|
674
|
+
decimal_places?: string;
|
|
675
|
+
zone_risk?: number;
|
|
676
|
+
fee?: number;
|
|
677
|
+
support?: number;
|
|
678
|
+
risk_reward?: number;
|
|
679
|
+
resistance?: number;
|
|
680
|
+
risk_per_trade?: number;
|
|
681
|
+
increase_size?: boolean;
|
|
682
|
+
additional_increase?: number;
|
|
683
|
+
minimum_pnl?: number;
|
|
684
|
+
take_profit?: number;
|
|
685
|
+
increase_position?: boolean;
|
|
686
|
+
minimum_size?: number;
|
|
687
|
+
first_order_size?: number;
|
|
688
|
+
gap?: number;
|
|
689
|
+
max_size?: number;
|
|
690
|
+
};
|
|
691
|
+
declare class Signal {
|
|
692
|
+
focus: number;
|
|
693
|
+
budget: number;
|
|
694
|
+
percent_change: number;
|
|
695
|
+
price_places: string;
|
|
696
|
+
decimal_places: string;
|
|
697
|
+
zone_risk: number;
|
|
698
|
+
fee: number;
|
|
699
|
+
support?: number;
|
|
700
|
+
risk_reward: number;
|
|
701
|
+
resistance?: number;
|
|
702
|
+
risk_per_trade?: number;
|
|
703
|
+
increase_size: boolean;
|
|
704
|
+
additional_increase: number;
|
|
348
705
|
minimum_pnl: number;
|
|
706
|
+
take_profit?: number;
|
|
707
|
+
increase_position: boolean;
|
|
708
|
+
minimum_size: any;
|
|
709
|
+
first_order_size: number;
|
|
710
|
+
gap: number;
|
|
349
711
|
max_size: number;
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
712
|
+
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);
|
|
713
|
+
build_entry({ current_price, stop_loss, pnl, stop_percent, kind, risk, no_of_trades, take_profit, }: {
|
|
714
|
+
take_profit?: number;
|
|
715
|
+
no_of_trades?: number;
|
|
716
|
+
current_price: number;
|
|
717
|
+
stop_loss?: number;
|
|
718
|
+
kind?: "long" | "short";
|
|
719
|
+
risk: number;
|
|
720
|
+
stop_percent?: number;
|
|
721
|
+
pnl?: number;
|
|
722
|
+
}): any;
|
|
723
|
+
get risk(): number;
|
|
724
|
+
get min_trades(): number;
|
|
725
|
+
get min_price(): number;
|
|
726
|
+
build_opposite_order({ current_price, kind, }: {
|
|
727
|
+
current_price: number;
|
|
728
|
+
kind?: "long" | "short";
|
|
729
|
+
}): any;
|
|
730
|
+
special_build_orders({ current_price, kind, }: {
|
|
731
|
+
current_price: number;
|
|
732
|
+
kind?: "long" | "short";
|
|
733
|
+
}): any;
|
|
734
|
+
build_orders({ current_price, kind, limit, replace_focus, max_index, min_index, }: {
|
|
735
|
+
current_price: number;
|
|
736
|
+
kind?: "long" | "short";
|
|
737
|
+
limit?: boolean;
|
|
738
|
+
replace_focus?: boolean;
|
|
739
|
+
max_index?: number;
|
|
740
|
+
min_index?: number;
|
|
741
|
+
}): any;
|
|
742
|
+
build_orders_old({ current_price, kind, limit, replace_focus, max_index, min_index, }: {
|
|
743
|
+
current_price: number;
|
|
744
|
+
kind?: "long" | "short";
|
|
745
|
+
limit?: boolean;
|
|
746
|
+
replace_focus?: boolean;
|
|
747
|
+
max_index?: number;
|
|
748
|
+
min_index?: number;
|
|
749
|
+
}): any;
|
|
750
|
+
get_bulk_trade_zones({ current_price, kind, limit, }: {
|
|
751
|
+
current_price: number;
|
|
752
|
+
kind?: "long" | "short";
|
|
753
|
+
limit?: boolean;
|
|
754
|
+
}): any;
|
|
755
|
+
get_future_zones({ current_price, kind, raw, }: {
|
|
756
|
+
raw?: boolean;
|
|
757
|
+
current_price: number;
|
|
758
|
+
kind?: "long" | "short";
|
|
759
|
+
}): number[];
|
|
760
|
+
to_f(value: number, places?: string): number;
|
|
761
|
+
get_margin_zones({ current_price, kind, }: {
|
|
762
|
+
current_price: number;
|
|
763
|
+
kind?: "long" | "short";
|
|
764
|
+
}): number[][];
|
|
765
|
+
get_margin_range(current_price: number, kind?: string): number[];
|
|
766
|
+
process_orders({ current_price, stop_loss, trade_zones, kind, }: {
|
|
767
|
+
current_price: number;
|
|
768
|
+
stop_loss: number;
|
|
769
|
+
trade_zones: number[];
|
|
770
|
+
kind?: "long" | "short";
|
|
771
|
+
}): any[];
|
|
772
|
+
get_risk_per_trade(number_of_orders: number): number;
|
|
773
|
+
build_trade_dict({ entry, stop, risk, arr, index, new_fees, kind, start, take_profit, }: {
|
|
774
|
+
entry: number;
|
|
775
|
+
stop: number;
|
|
776
|
+
risk: number;
|
|
777
|
+
arr: number[];
|
|
778
|
+
index: number;
|
|
779
|
+
new_fees?: number;
|
|
780
|
+
kind?: "long" | "short";
|
|
781
|
+
start?: number;
|
|
782
|
+
take_profit?: number;
|
|
783
|
+
}): {
|
|
784
|
+
entry: number;
|
|
785
|
+
risk: number;
|
|
786
|
+
quantity: number;
|
|
787
|
+
sell_price: number;
|
|
788
|
+
risk_sell: number;
|
|
789
|
+
stop: number;
|
|
790
|
+
pnl: number;
|
|
791
|
+
fee: number;
|
|
792
|
+
net: number;
|
|
793
|
+
incurred: number;
|
|
794
|
+
stop_percent: number;
|
|
795
|
+
};
|
|
796
|
+
to_df(currentPrice: number, places?: string): number;
|
|
356
797
|
}
|
|
798
|
+
export declare function determine_average_entry_and_size(orders: Array<{
|
|
799
|
+
price: number;
|
|
800
|
+
quantity: number;
|
|
801
|
+
}>, places?: string, price_places?: string): {
|
|
802
|
+
entry: number;
|
|
803
|
+
price: number;
|
|
804
|
+
quantity: number;
|
|
805
|
+
};
|
|
806
|
+
export declare const createArray: (start: number, stop: number, step: number) => number[];
|
|
357
807
|
export type AppConfig = {
|
|
358
808
|
fee: number;
|
|
359
809
|
risk_per_trade: number;
|
|
@@ -379,16 +829,311 @@ export type AppConfig = {
|
|
|
379
829
|
gap?: number;
|
|
380
830
|
rr?: number;
|
|
381
831
|
max_size?: number;
|
|
832
|
+
last_value?: any;
|
|
833
|
+
entries?: any[];
|
|
834
|
+
};
|
|
835
|
+
export type ExtendConfigType = {
|
|
836
|
+
take_profit?: number;
|
|
837
|
+
entry: number;
|
|
838
|
+
risk?: number;
|
|
839
|
+
stop?: number;
|
|
840
|
+
risk_reward?: number;
|
|
841
|
+
raw_instance?: boolean;
|
|
842
|
+
no_of_trades?: number;
|
|
843
|
+
increase?: boolean;
|
|
844
|
+
price_places?: string;
|
|
845
|
+
decimal_places?: string;
|
|
846
|
+
min_profit?: number;
|
|
847
|
+
kind?: "long" | "short";
|
|
848
|
+
gap?: number;
|
|
849
|
+
rr?: number;
|
|
850
|
+
};
|
|
851
|
+
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;
|
|
852
|
+
export declare function buildAvg({ _trades, kind, }: {
|
|
853
|
+
_trades: any[];
|
|
854
|
+
kind: "long" | "short";
|
|
855
|
+
}): any;
|
|
856
|
+
export declare function sortedBuildConfig(app_config: AppConfig, options: any): any[];
|
|
857
|
+
export declare function get_app_config_and_max_size(config: GlobalConfig, payload: {
|
|
858
|
+
entry: number;
|
|
859
|
+
stop: number;
|
|
860
|
+
kind: "long" | "short";
|
|
861
|
+
}): {
|
|
862
|
+
app_config: AppConfig;
|
|
863
|
+
max_size: any;
|
|
864
|
+
last_value: any;
|
|
865
|
+
entries: {
|
|
866
|
+
entry: any;
|
|
867
|
+
avg_entry: any;
|
|
868
|
+
avg_size: any;
|
|
869
|
+
neg_pnl: any;
|
|
870
|
+
quantity: any;
|
|
871
|
+
}[];
|
|
872
|
+
};
|
|
873
|
+
export declare function buildAppConfig(config: GlobalConfig, payload: {
|
|
874
|
+
entry: number;
|
|
875
|
+
stop: number;
|
|
876
|
+
risk_reward: number;
|
|
877
|
+
risk: number;
|
|
878
|
+
symbol: string;
|
|
879
|
+
profit?: number;
|
|
880
|
+
}): AppConfig;
|
|
881
|
+
export declare function getOptimumStopAndRisk(app_config: AppConfig, params: {
|
|
882
|
+
max_size: number;
|
|
883
|
+
target_stop: number;
|
|
884
|
+
highest_risk?: number;
|
|
885
|
+
}): {
|
|
886
|
+
optimal_stop: number;
|
|
887
|
+
optimal_risk: number;
|
|
888
|
+
avg_size: any;
|
|
889
|
+
avg_entry: any;
|
|
890
|
+
result: any[];
|
|
891
|
+
first_entry: any;
|
|
892
|
+
neg_pnl: any;
|
|
893
|
+
risk_reward: number;
|
|
894
|
+
size_diff: number;
|
|
895
|
+
entry_diff: number;
|
|
896
|
+
};
|
|
897
|
+
export declare function generate_config_params(app_config: AppConfig, payload: {
|
|
898
|
+
entry: number;
|
|
899
|
+
stop: number;
|
|
900
|
+
risk_reward: number;
|
|
901
|
+
risk: number;
|
|
902
|
+
symbol: string;
|
|
903
|
+
}): {
|
|
904
|
+
entry: number;
|
|
905
|
+
stop: number;
|
|
906
|
+
avg_size: any;
|
|
907
|
+
avg_entry: any;
|
|
908
|
+
risk_reward: number;
|
|
909
|
+
neg_pnl: any;
|
|
910
|
+
risk: number;
|
|
911
|
+
};
|
|
912
|
+
export declare function determine_break_even_price(payload: {
|
|
913
|
+
long_position: {
|
|
914
|
+
entry: number;
|
|
915
|
+
quantity: number;
|
|
916
|
+
};
|
|
917
|
+
short_position: {
|
|
918
|
+
entry: number;
|
|
919
|
+
quantity: number;
|
|
920
|
+
};
|
|
921
|
+
fee_percent?: number;
|
|
922
|
+
}): {
|
|
923
|
+
price: number;
|
|
924
|
+
direction: string;
|
|
925
|
+
};
|
|
926
|
+
export declare function determine_amount_to_buy(payload: {
|
|
927
|
+
orders: any[];
|
|
928
|
+
kind: "long" | "short";
|
|
929
|
+
decimal_places?: string;
|
|
930
|
+
price_places?: string;
|
|
931
|
+
place?: boolean;
|
|
932
|
+
position: any;
|
|
933
|
+
existingOrders: any[];
|
|
934
|
+
}): any[];
|
|
935
|
+
export declare function generateOptimumAppConfig(config: GlobalConfig, payload: {
|
|
936
|
+
entry: number;
|
|
937
|
+
stop: number;
|
|
938
|
+
risk_reward: number;
|
|
939
|
+
start_risk: number;
|
|
940
|
+
max_risk?: number;
|
|
941
|
+
}, position: {
|
|
942
|
+
entry: number;
|
|
943
|
+
quantity: number;
|
|
944
|
+
kind: "long" | "short";
|
|
945
|
+
}): AppConfig | null;
|
|
946
|
+
export declare function determineOptimumReward(app_config: AppConfig, increase?: boolean, low_range?: number, high_range?: number): number | {
|
|
947
|
+
result: any[];
|
|
948
|
+
value: number;
|
|
949
|
+
total: number;
|
|
950
|
+
risk_per_trade: number;
|
|
951
|
+
max: number;
|
|
952
|
+
min: number;
|
|
953
|
+
neg_pnl: any;
|
|
954
|
+
entry: any;
|
|
955
|
+
};
|
|
956
|
+
export declare function computeRiskReward(payload: {
|
|
957
|
+
app_config: AppConfig;
|
|
958
|
+
entry: number;
|
|
959
|
+
stop: number;
|
|
960
|
+
risk_per_trade: number;
|
|
961
|
+
}): number | {
|
|
962
|
+
result: any[];
|
|
963
|
+
value: number;
|
|
964
|
+
total: number;
|
|
965
|
+
risk_per_trade: number;
|
|
966
|
+
max: number;
|
|
967
|
+
min: number;
|
|
968
|
+
neg_pnl: any;
|
|
969
|
+
entry: any;
|
|
382
970
|
};
|
|
971
|
+
export declare function getRiskReward(payload: {
|
|
972
|
+
entry: number;
|
|
973
|
+
stop: number;
|
|
974
|
+
risk: number;
|
|
975
|
+
global_config: GlobalConfig;
|
|
976
|
+
}): any;
|
|
977
|
+
declare class ExchangePosition {
|
|
978
|
+
exchange: BaseExchange;
|
|
979
|
+
exchange_account: ExchangeAccount$1;
|
|
980
|
+
private app_db;
|
|
981
|
+
private instance;
|
|
982
|
+
constructor(payload: {
|
|
983
|
+
exchange: BaseExchange;
|
|
984
|
+
app_db: AppDatabase;
|
|
985
|
+
instance: PositionsView;
|
|
986
|
+
exchange_account: ExchangeAccount$1;
|
|
987
|
+
without_view?: PositionsView;
|
|
988
|
+
});
|
|
989
|
+
get symbol(): any;
|
|
990
|
+
get kind(): any;
|
|
991
|
+
get account(): any;
|
|
992
|
+
cancelOrders(payload: {
|
|
993
|
+
limit?: boolean;
|
|
994
|
+
price?: number;
|
|
995
|
+
}): Promise<void | {
|
|
996
|
+
success: boolean;
|
|
997
|
+
message: string;
|
|
998
|
+
exchange_result?: undefined;
|
|
999
|
+
error?: undefined;
|
|
1000
|
+
} | {
|
|
1001
|
+
success: boolean;
|
|
1002
|
+
exchange_result: any;
|
|
1003
|
+
message?: undefined;
|
|
1004
|
+
error?: undefined;
|
|
1005
|
+
} | {
|
|
1006
|
+
success: boolean;
|
|
1007
|
+
error: any;
|
|
1008
|
+
message?: undefined;
|
|
1009
|
+
exchange_result?: undefined;
|
|
1010
|
+
}>;
|
|
1011
|
+
getConfig(payload?: {
|
|
1012
|
+
params?: {
|
|
1013
|
+
entry?: number;
|
|
1014
|
+
stop?: number;
|
|
1015
|
+
risk_reward?: number;
|
|
1016
|
+
risk?: number;
|
|
1017
|
+
profit_percent?: number;
|
|
1018
|
+
place_tp?: boolean;
|
|
1019
|
+
profit?: number;
|
|
1020
|
+
};
|
|
1021
|
+
}): Promise<import("pocketbase").RecordModel | ScheduledTrade>;
|
|
1022
|
+
updateTargetPnl(): Promise<number>;
|
|
1023
|
+
updateConfigPnl(): Promise<void>;
|
|
1024
|
+
triggerTradeFromConfig(payload: {
|
|
1025
|
+
place?: boolean;
|
|
1026
|
+
raw?: boolean;
|
|
1027
|
+
tp?: boolean;
|
|
1028
|
+
stop?: boolean;
|
|
1029
|
+
use_current?: boolean;
|
|
1030
|
+
ignore_config?: boolean;
|
|
1031
|
+
}): Promise<any>;
|
|
1032
|
+
placeSharedOrder(action: "place_limit_orders" | "place_stop_orders" | "place_tp_orders", payload: {
|
|
1033
|
+
entry: number;
|
|
1034
|
+
stop: number;
|
|
1035
|
+
risk_reward: number;
|
|
1036
|
+
risk: number;
|
|
1037
|
+
place?: boolean;
|
|
1038
|
+
update_db?: boolean;
|
|
1039
|
+
raw?: boolean;
|
|
1040
|
+
use_current?: boolean;
|
|
1041
|
+
}): Promise<any>;
|
|
1042
|
+
buildAppConfig(payload: {
|
|
1043
|
+
entry: number;
|
|
1044
|
+
stop: number;
|
|
1045
|
+
risk_reward: number;
|
|
1046
|
+
risk: number;
|
|
1047
|
+
profit?: number;
|
|
1048
|
+
update_db?: boolean;
|
|
1049
|
+
profit_percent?: number;
|
|
1050
|
+
}): Promise<AppConfig>;
|
|
1051
|
+
placeConfigOrders(app_config: AppConfig, solution: {
|
|
1052
|
+
risk_reward: number;
|
|
1053
|
+
entry: number;
|
|
1054
|
+
stop: number;
|
|
1055
|
+
risk_per_trade: number;
|
|
1056
|
+
avg_size: number;
|
|
1057
|
+
neg_pnl: number;
|
|
1058
|
+
min_size: number;
|
|
1059
|
+
symbol: string;
|
|
1060
|
+
}, place?: boolean, skip_stop?: boolean): Promise<{
|
|
1061
|
+
entry_orders: {
|
|
1062
|
+
orders: {
|
|
1063
|
+
entry: any;
|
|
1064
|
+
quantity: any;
|
|
1065
|
+
reverse_avg_entry: any;
|
|
1066
|
+
reverse_avg_quantity: any;
|
|
1067
|
+
avg_entry: any;
|
|
1068
|
+
avg_size: any;
|
|
1069
|
+
}[];
|
|
1070
|
+
kind: "long" | "short";
|
|
1071
|
+
};
|
|
1072
|
+
stop_orders: {
|
|
1073
|
+
stop: number;
|
|
1074
|
+
final_stop: number;
|
|
1075
|
+
kind: "long" | "short";
|
|
1076
|
+
quantity: any;
|
|
1077
|
+
is_limit: boolean;
|
|
1078
|
+
neg_pnl: any;
|
|
1079
|
+
};
|
|
1080
|
+
trades: any[];
|
|
1081
|
+
}>;
|
|
1082
|
+
determineAmountToBuy(payload: {
|
|
1083
|
+
orders: any[];
|
|
1084
|
+
kind: "long" | "short";
|
|
1085
|
+
refresh?: boolean;
|
|
1086
|
+
decimal_places?: string;
|
|
1087
|
+
price_places?: string;
|
|
1088
|
+
cancel?: boolean;
|
|
1089
|
+
place?: boolean;
|
|
1090
|
+
}): Promise<any[]>;
|
|
1091
|
+
refresh(live_refresh?: boolean): Promise<{
|
|
1092
|
+
instance: PositionsView;
|
|
1093
|
+
existingOrders: void | Order[];
|
|
1094
|
+
}>;
|
|
1095
|
+
placeTrade(payload: {
|
|
1096
|
+
place?: boolean;
|
|
1097
|
+
tp?: boolean;
|
|
1098
|
+
stop?: boolean;
|
|
1099
|
+
raw?: boolean;
|
|
1100
|
+
cancel?: boolean;
|
|
1101
|
+
ignore_config?: boolean;
|
|
1102
|
+
}): Promise<any>;
|
|
1103
|
+
}
|
|
383
1104
|
declare class ExchangeAccount$1 {
|
|
384
1105
|
private instance;
|
|
385
|
-
|
|
1106
|
+
exchange: BaseExchange;
|
|
1107
|
+
main_exchange?: BaseExchange;
|
|
386
1108
|
private app_db;
|
|
1109
|
+
private long_position?;
|
|
1110
|
+
private short_position?;
|
|
387
1111
|
constructor(payload: ExchangeType, options: {
|
|
388
1112
|
exchange: BaseExchange;
|
|
389
1113
|
app_db: AppDatabase;
|
|
1114
|
+
main_exchange?: BaseExchange;
|
|
390
1115
|
});
|
|
391
|
-
|
|
1116
|
+
/**
|
|
1117
|
+
*In order to avoid rate limiting issues, we cache the live exchange
|
|
1118
|
+
details for each symbol for an account in the database with an option
|
|
1119
|
+
to refresh.
|
|
1120
|
+
*/
|
|
1121
|
+
getDBInstance(): AppDatabase;
|
|
1122
|
+
getLiveExchangeInstance(payload: {
|
|
1123
|
+
symbol: string;
|
|
1124
|
+
refresh?: boolean;
|
|
1125
|
+
refresh_symbol_config?: boolean;
|
|
1126
|
+
}): Promise<import("pocketbase").RecordModel>;
|
|
1127
|
+
initializePositions(payload: {
|
|
1128
|
+
symbol: string;
|
|
1129
|
+
as_view?: boolean;
|
|
1130
|
+
kind: "long" | "short";
|
|
1131
|
+
}): Promise<ExchangePosition>;
|
|
1132
|
+
getActiveAccount(payload: {
|
|
1133
|
+
symbol: string;
|
|
1134
|
+
full?: boolean;
|
|
1135
|
+
refresh?: boolean;
|
|
1136
|
+
}): Promise<Account | {
|
|
392
1137
|
liquidation: {
|
|
393
1138
|
long: number;
|
|
394
1139
|
short: number;
|
|
@@ -397,34 +1142,48 @@ declare class ExchangeAccount$1 {
|
|
|
397
1142
|
current_price: any;
|
|
398
1143
|
exchange: any;
|
|
399
1144
|
}>;
|
|
400
|
-
|
|
1145
|
+
refreshAccount(payload: {
|
|
401
1146
|
symbol: string;
|
|
402
|
-
|
|
403
|
-
update?: boolean;
|
|
404
|
-
as_view?: boolean;
|
|
1147
|
+
live_refresh?: boolean;
|
|
405
1148
|
leverage?: number;
|
|
406
1149
|
}): Promise<(PositionsView & {
|
|
407
1150
|
expand?: {
|
|
408
1151
|
config: ScheduledTrade;
|
|
1152
|
+
account: ExchangeAccount;
|
|
409
1153
|
};
|
|
410
|
-
})
|
|
1154
|
+
})[]>;
|
|
1155
|
+
syncAccount(options: {
|
|
1156
|
+
symbol: string;
|
|
1157
|
+
kind?: "long" | "short";
|
|
1158
|
+
update?: boolean;
|
|
1159
|
+
as_view?: boolean;
|
|
1160
|
+
leverage?: number;
|
|
1161
|
+
live_refresh?: boolean;
|
|
1162
|
+
}): Promise<PositionsView | (PositionsView & {
|
|
411
1163
|
expand?: {
|
|
412
1164
|
config: ScheduledTrade;
|
|
1165
|
+
account: ExchangeAccount;
|
|
413
1166
|
};
|
|
414
1167
|
})[]>;
|
|
415
1168
|
getRunningInstanceFromDB(symbol: string): Promise<TradeBlockTracking>;
|
|
416
1169
|
syncOrders(options: {
|
|
417
1170
|
symbol: string;
|
|
418
|
-
kind
|
|
1171
|
+
kind?: "long" | "short";
|
|
419
1172
|
update?: boolean;
|
|
420
|
-
}): Promise<
|
|
1173
|
+
}): Promise<void | Order[]>;
|
|
1174
|
+
toggleStopBuying(payload: {
|
|
1175
|
+
symbol: string;
|
|
1176
|
+
kind: "long" | "short";
|
|
1177
|
+
should_stop?: boolean;
|
|
1178
|
+
}): Promise<import("pocketbase").RecordModel>;
|
|
421
1179
|
cancelOrders(payload: {
|
|
422
1180
|
symbol: string;
|
|
423
1181
|
kind: "long" | "short";
|
|
424
1182
|
price?: number;
|
|
425
1183
|
all?: boolean;
|
|
426
1184
|
stop?: boolean;
|
|
427
|
-
|
|
1185
|
+
limit?: boolean;
|
|
1186
|
+
}): Promise<void | {
|
|
428
1187
|
success: boolean;
|
|
429
1188
|
message: string;
|
|
430
1189
|
exchange_result?: undefined;
|
|
@@ -444,6 +1203,12 @@ declare class ExchangeAccount$1 {
|
|
|
444
1203
|
symbol: string;
|
|
445
1204
|
orders: number[];
|
|
446
1205
|
}): Promise<any>;
|
|
1206
|
+
getBreakEvenPrice(payload: {
|
|
1207
|
+
symbol: string;
|
|
1208
|
+
}): Promise<{
|
|
1209
|
+
price: number;
|
|
1210
|
+
direction: string;
|
|
1211
|
+
}>;
|
|
447
1212
|
buildAppConfig(payload: {
|
|
448
1213
|
entry: number;
|
|
449
1214
|
stop: number;
|
|
@@ -454,6 +1219,36 @@ declare class ExchangeAccount$1 {
|
|
|
454
1219
|
update_db?: boolean;
|
|
455
1220
|
profit_percent?: number;
|
|
456
1221
|
}): Promise<AppConfig>;
|
|
1222
|
+
tradeConfig(payload: {
|
|
1223
|
+
symbol: string;
|
|
1224
|
+
kind: "long" | "short";
|
|
1225
|
+
}): Promise<AppConfig>;
|
|
1226
|
+
justInTimeProfit(payload: {
|
|
1227
|
+
symbol: string;
|
|
1228
|
+
target_pnl: number;
|
|
1229
|
+
kind: "long" | "short";
|
|
1230
|
+
refresh?: boolean;
|
|
1231
|
+
place?: boolean;
|
|
1232
|
+
take_profit?: number;
|
|
1233
|
+
pause_tp?: boolean;
|
|
1234
|
+
}): Promise<{
|
|
1235
|
+
sell_ratio: number;
|
|
1236
|
+
current_pnl: number;
|
|
1237
|
+
profit_percent: number;
|
|
1238
|
+
current_price: number;
|
|
1239
|
+
notional_value: number;
|
|
1240
|
+
}>;
|
|
1241
|
+
buildTrades(payload: {
|
|
1242
|
+
symbol: string;
|
|
1243
|
+
kind: "long" | "short";
|
|
1244
|
+
risk?: number;
|
|
1245
|
+
}): Promise<{
|
|
1246
|
+
trades: any[];
|
|
1247
|
+
max_size: any;
|
|
1248
|
+
last_price: any;
|
|
1249
|
+
total_size: number;
|
|
1250
|
+
avg_entry: number;
|
|
1251
|
+
}>;
|
|
457
1252
|
placeConfigOrders(app_config: AppConfig, solution: {
|
|
458
1253
|
risk_reward: number;
|
|
459
1254
|
entry: number;
|
|
@@ -481,9 +1276,20 @@ declare class ExchangeAccount$1 {
|
|
|
481
1276
|
kind: "long" | "short";
|
|
482
1277
|
quantity: any;
|
|
483
1278
|
is_limit: boolean;
|
|
1279
|
+
neg_pnl: any;
|
|
484
1280
|
};
|
|
485
1281
|
trades: any[];
|
|
486
1282
|
}>;
|
|
1283
|
+
determineAmountToBuy(payload: {
|
|
1284
|
+
orders: any[];
|
|
1285
|
+
kind: "long" | "short";
|
|
1286
|
+
refresh?: boolean;
|
|
1287
|
+
decimal_places?: string;
|
|
1288
|
+
price_places?: string;
|
|
1289
|
+
symbol: string;
|
|
1290
|
+
cancel?: boolean;
|
|
1291
|
+
place?: boolean;
|
|
1292
|
+
}): Promise<any[]>;
|
|
487
1293
|
placeSharedOrder(action: "place_limit_orders" | "place_stop_orders" | "place_tp_orders", payload: {
|
|
488
1294
|
symbol: string;
|
|
489
1295
|
entry: number;
|
|
@@ -492,44 +1298,277 @@ declare class ExchangeAccount$1 {
|
|
|
492
1298
|
risk: number;
|
|
493
1299
|
place?: boolean;
|
|
494
1300
|
update_db?: boolean;
|
|
1301
|
+
raw?: boolean;
|
|
1302
|
+
use_current?: boolean;
|
|
495
1303
|
}): Promise<any>;
|
|
1304
|
+
getOrCreatePositionConfig(payload: {
|
|
1305
|
+
symbol: string;
|
|
1306
|
+
kind: "long" | "short";
|
|
1307
|
+
risk?: number;
|
|
1308
|
+
risk_reward?: number;
|
|
1309
|
+
}): Promise<import("pocketbase").RecordModel | ScheduledTrade>;
|
|
496
1310
|
getPositionConfig(payload: {
|
|
497
1311
|
symbol: string;
|
|
498
1312
|
kind: "long" | "short";
|
|
499
1313
|
params?: {
|
|
500
|
-
entry
|
|
501
|
-
stop
|
|
502
|
-
risk_reward
|
|
503
|
-
risk
|
|
1314
|
+
entry?: number;
|
|
1315
|
+
stop?: number;
|
|
1316
|
+
risk_reward?: number;
|
|
1317
|
+
risk?: number;
|
|
504
1318
|
profit_percent?: number;
|
|
1319
|
+
place_tp?: boolean;
|
|
1320
|
+
profit?: number;
|
|
505
1321
|
};
|
|
506
|
-
}): Promise<import("pocketbase").RecordModel>;
|
|
1322
|
+
}): Promise<import("pocketbase").RecordModel | ScheduledTrade>;
|
|
507
1323
|
getCurrentPrice(symbol: string): Promise<any>;
|
|
508
|
-
getPositionStrategy(): Promise<
|
|
509
|
-
|
|
510
|
-
|
|
1324
|
+
getPositionStrategy(): Promise<AccountStrategy>;
|
|
1325
|
+
buildReduceConfig(payload: {
|
|
1326
|
+
symbol: string;
|
|
1327
|
+
kind?: "long" | "short";
|
|
1328
|
+
as_dict?: boolean;
|
|
1329
|
+
target_pnl?: number;
|
|
1330
|
+
trigger?: {
|
|
1331
|
+
long: boolean;
|
|
1332
|
+
short: boolean;
|
|
1333
|
+
};
|
|
1334
|
+
use_full?: boolean;
|
|
1335
|
+
}): Promise<{
|
|
1336
|
+
trigger_short: boolean;
|
|
1337
|
+
trigger_long: boolean;
|
|
1338
|
+
symbol: string;
|
|
1339
|
+
short_minimum_pnl: number;
|
|
1340
|
+
long_minimum_pnl: number;
|
|
1341
|
+
short_profit: any;
|
|
1342
|
+
long_profit: any;
|
|
1343
|
+
owner: string;
|
|
1344
|
+
exchange: string;
|
|
1345
|
+
not_reduce: boolean;
|
|
1346
|
+
reduce_ratio_long: any;
|
|
1347
|
+
reduce_ratio_short: any;
|
|
1348
|
+
use_full_long: any;
|
|
1349
|
+
use_full_short: any;
|
|
1350
|
+
} | {
|
|
1351
|
+
long: {
|
|
1352
|
+
minimum_pnl: number;
|
|
1353
|
+
max_size: number;
|
|
1354
|
+
profit: any;
|
|
1355
|
+
increase: boolean;
|
|
1356
|
+
not_reduce: boolean;
|
|
1357
|
+
ratio: any;
|
|
1358
|
+
use_full: boolean;
|
|
1359
|
+
sell_ratio: any;
|
|
1360
|
+
};
|
|
1361
|
+
short: {
|
|
1362
|
+
minimum_pnl: number;
|
|
1363
|
+
max_size: number;
|
|
1364
|
+
profit: any;
|
|
1365
|
+
increase: boolean;
|
|
1366
|
+
not_reduce: boolean;
|
|
1367
|
+
ratio: any;
|
|
1368
|
+
use_full: boolean;
|
|
1369
|
+
sell_ratio: any;
|
|
1370
|
+
};
|
|
1371
|
+
trigger: {
|
|
1372
|
+
long: boolean;
|
|
1373
|
+
short: boolean;
|
|
1374
|
+
};
|
|
511
1375
|
}>;
|
|
512
1376
|
getOriginalPlannedStop(payload: {
|
|
513
1377
|
symbol: string;
|
|
514
1378
|
kind: "long" | "short";
|
|
515
1379
|
}): Promise<any>;
|
|
516
|
-
syncReduceClosePosition(
|
|
1380
|
+
syncReduceClosePosition(payload?: {
|
|
1381
|
+
symbol: string;
|
|
517
1382
|
kind?: "long" | "short";
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
1383
|
+
trigger?: boolean;
|
|
1384
|
+
}): Promise<any>;
|
|
1385
|
+
reduceMajorPositionEntry(payload: {
|
|
1386
|
+
symbol: string;
|
|
1387
|
+
long: any;
|
|
1388
|
+
short: any;
|
|
1389
|
+
trigger: {
|
|
521
1390
|
long: boolean;
|
|
522
1391
|
short: boolean;
|
|
523
1392
|
};
|
|
524
1393
|
}): Promise<any>;
|
|
1394
|
+
placeProfitAndStop(payload: {
|
|
1395
|
+
symbol: string;
|
|
1396
|
+
trigger?: boolean;
|
|
1397
|
+
refresh?: boolean;
|
|
1398
|
+
kind?: "long" | "short";
|
|
1399
|
+
target_pnl?: number;
|
|
1400
|
+
}): Promise<any>;
|
|
1401
|
+
reEnterPositionOnEmpty(symbol: string): Promise<void>;
|
|
1402
|
+
generate_config_params(payload: {
|
|
1403
|
+
entry: number;
|
|
1404
|
+
stop: number;
|
|
1405
|
+
risk_reward: number;
|
|
1406
|
+
risk: number;
|
|
1407
|
+
symbol: string;
|
|
1408
|
+
with_trades?: boolean;
|
|
1409
|
+
}): Promise<any>;
|
|
1410
|
+
build_short_order(payload: {
|
|
1411
|
+
symbol: string;
|
|
1412
|
+
kind: "long" | "short";
|
|
1413
|
+
}): Promise<any>;
|
|
1414
|
+
extrapolateShortConfig(payload: {
|
|
1415
|
+
kind: "long" | "short";
|
|
1416
|
+
symbol: string;
|
|
1417
|
+
risk_reward?: number;
|
|
1418
|
+
risk?: number;
|
|
1419
|
+
}): Promise<any>;
|
|
1420
|
+
placeMarketOrder(payload: {
|
|
1421
|
+
symbol: string;
|
|
1422
|
+
kind: "long" | "short";
|
|
1423
|
+
quantity: number;
|
|
1424
|
+
}): Promise<void>;
|
|
1425
|
+
placeSingleOrder(payload: {
|
|
1426
|
+
symbol: string;
|
|
1427
|
+
kind: "long" | "short";
|
|
1428
|
+
}): Promise<string>;
|
|
1429
|
+
triggerTradeFromConfig(payload: {
|
|
1430
|
+
symbol: string;
|
|
1431
|
+
kind: "long" | "short";
|
|
1432
|
+
place?: boolean;
|
|
1433
|
+
raw?: boolean;
|
|
1434
|
+
tp?: boolean;
|
|
1435
|
+
stop?: boolean;
|
|
1436
|
+
use_current?: boolean;
|
|
1437
|
+
ignore_config?: boolean;
|
|
1438
|
+
}): Promise<any>;
|
|
1439
|
+
verifyStopLoss(payload: {
|
|
1440
|
+
symbol: string;
|
|
1441
|
+
kind: "long" | "short";
|
|
1442
|
+
revert?: boolean;
|
|
1443
|
+
}): Promise<void | Order[]>;
|
|
1444
|
+
windDownSymbol(payload: {
|
|
1445
|
+
symbol: string;
|
|
1446
|
+
risk_reward?: number;
|
|
1447
|
+
risk?: number;
|
|
1448
|
+
}): Promise<void>;
|
|
1449
|
+
updateTargetPnl(payload: {
|
|
1450
|
+
symbol: string;
|
|
1451
|
+
kind: "long" | "short";
|
|
1452
|
+
}): Promise<number>;
|
|
1453
|
+
runSimulation(payload: {
|
|
1454
|
+
symbol: string;
|
|
1455
|
+
kind: "long" | "short";
|
|
1456
|
+
iterations?: number;
|
|
1457
|
+
raw?: boolean;
|
|
1458
|
+
}): Promise<Strategy | {
|
|
1459
|
+
[x: string]: any;
|
|
1460
|
+
risk: number;
|
|
1461
|
+
risk_reward: number;
|
|
1462
|
+
last_entry: any;
|
|
1463
|
+
first_entry: any;
|
|
1464
|
+
threshold: any;
|
|
1465
|
+
}[]>;
|
|
1466
|
+
getCurrentRun(payload: {
|
|
1467
|
+
symbol: string;
|
|
1468
|
+
kind?: "long" | "short";
|
|
1469
|
+
pnl?: number;
|
|
1470
|
+
}): Promise<true | import("pocketbase").RecordModel>;
|
|
1471
|
+
recomputeSymbolConfig(payload: {
|
|
1472
|
+
symbol: string;
|
|
1473
|
+
refresh?: boolean;
|
|
1474
|
+
}): Promise<SymbolConfig>;
|
|
1475
|
+
/**
|
|
1476
|
+
* This function builds a config for a symbol
|
|
1477
|
+
* @param payload
|
|
1478
|
+
* @returns
|
|
1479
|
+
*/
|
|
1480
|
+
buildConfigForSymbol(payload: {
|
|
1481
|
+
symbol: string;
|
|
1482
|
+
risk: number;
|
|
1483
|
+
kind?: "long" | "short";
|
|
1484
|
+
risk_reward?: number;
|
|
1485
|
+
as_config?: boolean;
|
|
1486
|
+
with_trades?: boolean;
|
|
1487
|
+
}): Promise<any>;
|
|
1488
|
+
triggerBullishMarket(payload: {
|
|
1489
|
+
symbol: string;
|
|
1490
|
+
profit_percent?: number;
|
|
1491
|
+
risk_reward?: number;
|
|
1492
|
+
}): Promise<any>;
|
|
1493
|
+
updateAllActiveSymbols(payload: {
|
|
1494
|
+
interval?: number;
|
|
1495
|
+
}): Promise<void>;
|
|
1496
|
+
updateAllPositionsWithNoConfig(payload: {
|
|
1497
|
+
kind: "long" | "short";
|
|
1498
|
+
}): Promise<void>;
|
|
1499
|
+
getSymbolsForPositions(): Promise<any[]>;
|
|
1500
|
+
getNonEssentialSymbols(): Promise<any[]>;
|
|
1501
|
+
_terminatePositions(payload: {
|
|
1502
|
+
symbol: string;
|
|
1503
|
+
}): Promise<void>;
|
|
1504
|
+
getOrders(payload: {
|
|
1505
|
+
symbol: string;
|
|
1506
|
+
kind: "long" | "short";
|
|
1507
|
+
type: "limit" | "stop" | "tp";
|
|
1508
|
+
}): Promise<Order[]>;
|
|
1509
|
+
syncPositionConfigs(payload: {
|
|
1510
|
+
symbol: string;
|
|
1511
|
+
kind: "long" | "short";
|
|
1512
|
+
refresh?: boolean;
|
|
1513
|
+
}): Promise<void>;
|
|
1514
|
+
terminatePositions(payload: {
|
|
1515
|
+
symbol: string;
|
|
1516
|
+
}): Promise<void>;
|
|
1517
|
+
fetchAndUpdateTopMovers(): Promise<{
|
|
1518
|
+
updated_bullish: BullishMarket[];
|
|
1519
|
+
moved_to_winding: WindingDownMarket[];
|
|
1520
|
+
}>;
|
|
1521
|
+
computeTargetPnl(payload: {
|
|
1522
|
+
symbol: string;
|
|
1523
|
+
kind: "long" | "short";
|
|
1524
|
+
}): Promise<number>;
|
|
1525
|
+
placeTrade(payload: {
|
|
1526
|
+
symbol: string;
|
|
1527
|
+
kind: "long" | "short";
|
|
1528
|
+
place?: boolean;
|
|
1529
|
+
tp?: boolean;
|
|
1530
|
+
stop?: boolean;
|
|
1531
|
+
raw?: boolean;
|
|
1532
|
+
cancel?: boolean;
|
|
1533
|
+
ignore_config?: boolean;
|
|
1534
|
+
target_pnl?: number;
|
|
1535
|
+
}): Promise<any>;
|
|
1536
|
+
updateConfigPnl(payload: {
|
|
1537
|
+
symbol: string;
|
|
1538
|
+
kind: "long" | "short";
|
|
1539
|
+
}): Promise<void>;
|
|
525
1540
|
}
|
|
1541
|
+
declare function getExchangeAccount(payload: {
|
|
1542
|
+
account: ExchangeType;
|
|
1543
|
+
app_db: AppDatabase;
|
|
1544
|
+
getCredentials: (account: string, exchange: string) => {
|
|
1545
|
+
api_key: string;
|
|
1546
|
+
api_secret: string;
|
|
1547
|
+
email: string;
|
|
1548
|
+
};
|
|
1549
|
+
proxyOptions?: {
|
|
1550
|
+
proxy?: any;
|
|
1551
|
+
ignore_proxy?: boolean;
|
|
1552
|
+
};
|
|
1553
|
+
canWithdraw?: boolean;
|
|
1554
|
+
}): Promise<ExchangeAccount$1>;
|
|
526
1555
|
declare class App {
|
|
527
|
-
|
|
1556
|
+
app_db: AppDatabase;
|
|
1557
|
+
proxyOptions?: {
|
|
1558
|
+
proxy?: any;
|
|
1559
|
+
ignore_proxy?: boolean;
|
|
1560
|
+
canWithdraw?: boolean;
|
|
1561
|
+
};
|
|
528
1562
|
private getCredentials;
|
|
529
|
-
constructor(app_db: AppDatabase, getCredentials: (account: string, exchange: string) =>
|
|
1563
|
+
constructor(app_db: AppDatabase, getCredentials: (account: string, exchange: string) => {
|
|
530
1564
|
api_key: string;
|
|
531
1565
|
api_secret: string;
|
|
532
|
-
|
|
1566
|
+
email: string;
|
|
1567
|
+
}, proxyOptions?: {
|
|
1568
|
+
proxy?: any;
|
|
1569
|
+
ignore_proxy?: boolean;
|
|
1570
|
+
canWithdraw?: boolean;
|
|
1571
|
+
});
|
|
533
1572
|
getExchangeAccount(account: ExchangeType): Promise<ExchangeAccount$1>;
|
|
534
1573
|
syncAccount(payload: {
|
|
535
1574
|
account: ExchangeType;
|
|
@@ -537,13 +1576,10 @@ declare class App {
|
|
|
537
1576
|
kind?: "long" | "short";
|
|
538
1577
|
update?: boolean;
|
|
539
1578
|
as_view?: boolean;
|
|
540
|
-
}): Promise<(PositionsView & {
|
|
541
|
-
expand?: {
|
|
542
|
-
config: ScheduledTrade;
|
|
543
|
-
};
|
|
544
|
-
}) | (PositionsView & {
|
|
1579
|
+
}): Promise<PositionsView | (PositionsView & {
|
|
545
1580
|
expand?: {
|
|
546
1581
|
config: ScheduledTrade;
|
|
1582
|
+
account: ExchangeAccount;
|
|
547
1583
|
};
|
|
548
1584
|
})[]>;
|
|
549
1585
|
syncOrders(payload: {
|
|
@@ -558,7 +1594,7 @@ declare class App {
|
|
|
558
1594
|
price?: number;
|
|
559
1595
|
all?: boolean;
|
|
560
1596
|
stop?: boolean;
|
|
561
|
-
}): Promise<{
|
|
1597
|
+
}): Promise<void | {
|
|
562
1598
|
success: boolean;
|
|
563
1599
|
message: string;
|
|
564
1600
|
exchange_result?: undefined;
|
|
@@ -574,41 +1610,6 @@ declare class App {
|
|
|
574
1610
|
message?: undefined;
|
|
575
1611
|
exchange_result?: undefined;
|
|
576
1612
|
}>;
|
|
577
|
-
triggerTradeFromConfig(payload: {
|
|
578
|
-
account: ExchangeType;
|
|
579
|
-
symbol: string;
|
|
580
|
-
kind: "long" | "short";
|
|
581
|
-
}): Promise<any>;
|
|
582
|
-
toggleStopBuying(payload: {
|
|
583
|
-
account: ExchangeType;
|
|
584
|
-
symbol: string;
|
|
585
|
-
kind: "long" | "short";
|
|
586
|
-
should_stop?: boolean;
|
|
587
|
-
}): Promise<import("pocketbase").RecordModel>;
|
|
588
|
-
generate_config_params(exchange_account: ExchangeAccount$1, payload: {
|
|
589
|
-
entry: number;
|
|
590
|
-
stop: number;
|
|
591
|
-
risk_reward: number;
|
|
592
|
-
risk: number;
|
|
593
|
-
symbol: string;
|
|
594
|
-
}): Promise<{
|
|
595
|
-
place_stop: boolean;
|
|
596
|
-
profit_percent: number;
|
|
597
|
-
entry: number;
|
|
598
|
-
stop: number;
|
|
599
|
-
avg_size: any;
|
|
600
|
-
avg_entry: any;
|
|
601
|
-
risk_reward: number;
|
|
602
|
-
neg_pnl: any;
|
|
603
|
-
risk: number;
|
|
604
|
-
}>;
|
|
605
|
-
generateConfig(payload: {
|
|
606
|
-
account: ExchangeType;
|
|
607
|
-
symbol: string;
|
|
608
|
-
kind: "long" | "short";
|
|
609
|
-
update_orders?: boolean;
|
|
610
|
-
place_orders?: boolean;
|
|
611
|
-
}): Promise<any>;
|
|
612
1613
|
updateReduceRatio(payload: {
|
|
613
1614
|
account: ExchangeType;
|
|
614
1615
|
symbol: string;
|
|
@@ -619,38 +1620,6 @@ declare class App {
|
|
|
619
1620
|
short_db_position: any;
|
|
620
1621
|
balance: any;
|
|
621
1622
|
}>;
|
|
622
|
-
extrapolateShortConfig(payload: {
|
|
623
|
-
account: ExchangeType;
|
|
624
|
-
kind: "long" | "short";
|
|
625
|
-
symbol: string;
|
|
626
|
-
risk_reward?: number;
|
|
627
|
-
}): Promise<PositionsView | {
|
|
628
|
-
place_stop: boolean;
|
|
629
|
-
profit_percent: number;
|
|
630
|
-
entry: number;
|
|
631
|
-
stop: number;
|
|
632
|
-
avg_size: any;
|
|
633
|
-
avg_entry: any;
|
|
634
|
-
risk_reward: number;
|
|
635
|
-
neg_pnl: any;
|
|
636
|
-
risk: number;
|
|
637
|
-
}>;
|
|
638
|
-
verifyStopLoss(payload: {
|
|
639
|
-
account: ExchangeType;
|
|
640
|
-
symbol: string;
|
|
641
|
-
kind: "long" | "short";
|
|
642
|
-
revert?: boolean;
|
|
643
|
-
}): Promise<import("pocketbase").RecordModel[]>;
|
|
644
|
-
updateTopMovers(payload?: {
|
|
645
|
-
new_markets: {
|
|
646
|
-
symbol: string;
|
|
647
|
-
percent: number;
|
|
648
|
-
}[];
|
|
649
|
-
totalRisk: number;
|
|
650
|
-
}): Promise<{
|
|
651
|
-
updated_bullish: BullishMarket[];
|
|
652
|
-
moved_to_winding: WindingDownMarket[];
|
|
653
|
-
}>;
|
|
654
1623
|
getWindingDownMarkets(): Promise<WindingDownMarket[]>;
|
|
655
1624
|
updateSymbolConfigs(payload: {
|
|
656
1625
|
configs: {
|
|
@@ -662,10 +1631,41 @@ declare class App {
|
|
|
662
1631
|
price_places: string;
|
|
663
1632
|
decimal_places: string;
|
|
664
1633
|
}[];
|
|
665
|
-
}): Promise<{
|
|
1634
|
+
}): Promise<SymbolConfig[] | {
|
|
666
1635
|
updated: number;
|
|
667
1636
|
created: number;
|
|
668
|
-
}
|
|
1637
|
+
}>;
|
|
1638
|
+
updateAllAccountWithSymbols(with_positions?: boolean): Promise<void>;
|
|
1639
|
+
windDownSymbol(payload: {
|
|
1640
|
+
symbol: string;
|
|
1641
|
+
risk?: number;
|
|
1642
|
+
}): Promise<boolean>;
|
|
1643
|
+
getNonEssentialSymbols(): Promise<Set<any>>;
|
|
1644
|
+
refreshAllPositionsWithSymbol(payload: {
|
|
1645
|
+
symbol: string;
|
|
1646
|
+
}): Promise<void>;
|
|
1647
|
+
autoFollowPositions(): Promise<void>;
|
|
1648
|
+
getMoverExchangeInstances(): Promise<ExchangeAccount[]>;
|
|
1649
|
+
updateTpOnAllMarkets(): Promise<void>;
|
|
1650
|
+
triggerMoverTask(payload: {
|
|
1651
|
+
callback: (params: {
|
|
1652
|
+
symbol: string;
|
|
1653
|
+
account: ExchangeType;
|
|
1654
|
+
}) => Promise<any>;
|
|
1655
|
+
removeCallback?: (params: {
|
|
1656
|
+
symbol: string;
|
|
1657
|
+
account: ExchangeType;
|
|
1658
|
+
}) => Promise<any>;
|
|
1659
|
+
}): Promise<void>;
|
|
1660
|
+
placeTrade(payload: {
|
|
1661
|
+
account: ExchangeType;
|
|
1662
|
+
symbol: string;
|
|
1663
|
+
kind: "long" | "short";
|
|
1664
|
+
place?: boolean;
|
|
1665
|
+
tp?: boolean;
|
|
1666
|
+
cancel?: boolean;
|
|
1667
|
+
raw?: boolean;
|
|
1668
|
+
}): Promise<any>;
|
|
669
1669
|
}
|
|
670
1670
|
export declare function initApp(payload: {
|
|
671
1671
|
db: {
|
|
@@ -673,14 +1673,44 @@ export declare function initApp(payload: {
|
|
|
673
1673
|
email: string;
|
|
674
1674
|
password: string;
|
|
675
1675
|
};
|
|
676
|
-
|
|
1676
|
+
password?: string;
|
|
1677
|
+
getCredentials: (account: string, exchange: string) => {
|
|
677
1678
|
api_key: string;
|
|
678
1679
|
api_secret: string;
|
|
679
|
-
|
|
1680
|
+
email: string;
|
|
1681
|
+
};
|
|
1682
|
+
proxy?: any;
|
|
1683
|
+
ignore_proxy?: boolean;
|
|
1684
|
+
canWithdraw?: boolean;
|
|
1685
|
+
triggerToken?: string;
|
|
1686
|
+
}): Promise<App>;
|
|
1687
|
+
declare function getCredentials(account: string, exchange: string): {
|
|
1688
|
+
api_key: string;
|
|
1689
|
+
api_secret: string;
|
|
1690
|
+
email: string;
|
|
1691
|
+
};
|
|
1692
|
+
export declare function initialize(payload: {
|
|
1693
|
+
password?: string;
|
|
1694
|
+
proxy?: any;
|
|
1695
|
+
ignore_proxy?: boolean;
|
|
1696
|
+
canWithdraw?: boolean;
|
|
680
1697
|
}): Promise<App>;
|
|
681
1698
|
|
|
1699
|
+
declare namespace database {
|
|
1700
|
+
export { AppDatabase, ExchangeType, initPocketBaseClient };
|
|
1701
|
+
}
|
|
1702
|
+
declare namespace exchange_account {
|
|
1703
|
+
export { ExchangeAccount$1 as ExchangeAccount, getExchangeAccount };
|
|
1704
|
+
}
|
|
1705
|
+
declare namespace app {
|
|
1706
|
+
export { App, getCredentials, initApp, initialize };
|
|
1707
|
+
}
|
|
1708
|
+
|
|
682
1709
|
export {
|
|
683
1710
|
ExchangeAccount$1 as ExchangeAccount,
|
|
1711
|
+
app,
|
|
1712
|
+
database,
|
|
1713
|
+
exchange_account,
|
|
684
1714
|
};
|
|
685
1715
|
|
|
686
1716
|
export {};
|