@arcaresearch/sdk 0.1.60 → 0.1.62
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/arca.d.ts +27 -17
- package/dist/arca.d.ts.map +1 -1
- package/dist/arca.js +41 -37
- package/dist/arca.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/streams.d.ts +10 -17
- package/dist/streams.d.ts.map +1 -1
- package/dist/streams.js +84 -86
- package/dist/streams.js.map +1 -1
- package/dist/types.d.ts +14 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/websocket.d.ts +14 -29
- package/dist/websocket.d.ts.map +1 -1
- package/dist/websocket.js +109 -131
- package/dist/websocket.js.map +1 -1
- package/package.json +1 -1
package/dist/streams.d.ts
CHANGED
|
@@ -51,12 +51,12 @@ export interface OperationUpdate {
|
|
|
51
51
|
}
|
|
52
52
|
export declare class OperationWatchStream extends WatchStream<OperationUpdate> {
|
|
53
53
|
private readonly ws;
|
|
54
|
-
private readonly
|
|
54
|
+
private readonly path;
|
|
55
55
|
private readonly refetchOperations?;
|
|
56
56
|
readonly operations: Operation[];
|
|
57
57
|
private readonly unsubs;
|
|
58
58
|
private gapRefetchInFlight;
|
|
59
|
-
constructor(ws: WebSocketManager,
|
|
59
|
+
constructor(ws: WebSocketManager, path: string, refetchOperations?: (() => Promise<Operation[]>) | undefined);
|
|
60
60
|
private handleGap;
|
|
61
61
|
/**
|
|
62
62
|
* Track an operation from the moment it is submitted (before HTTP completes).
|
|
@@ -85,14 +85,13 @@ export interface BalanceUpdate {
|
|
|
85
85
|
}
|
|
86
86
|
export declare class BalanceWatchStream extends WatchStream<BalanceUpdate> {
|
|
87
87
|
private readonly ws;
|
|
88
|
-
private readonly
|
|
88
|
+
private readonly path;
|
|
89
89
|
private readonly refetchEntityBalances?;
|
|
90
90
|
readonly balances: Map<string, BalanceSnapshot>;
|
|
91
91
|
private readonly unsubs;
|
|
92
|
-
private readonly pathFilter?;
|
|
93
92
|
private readonly activePredictions;
|
|
94
93
|
private gapRefetchInFlight;
|
|
95
|
-
constructor(ws: WebSocketManager,
|
|
94
|
+
constructor(ws: WebSocketManager, path: string, refetchEntityBalances?: ((entityId: string) => Promise<ArcaBalance[]>) | undefined);
|
|
96
95
|
/**
|
|
97
96
|
* Optimistically apply predicted balance effects from an operation handle.
|
|
98
97
|
* Immediately emits a balance update with the predicted `departing`/`arriving`
|
|
@@ -113,17 +112,10 @@ export declare class ObjectWatchStream extends WatchStream<ObjectValuation> {
|
|
|
113
112
|
private readonly path;
|
|
114
113
|
private readonly exchange;
|
|
115
114
|
valuation?: ObjectValuation;
|
|
116
|
-
private watchId?;
|
|
117
115
|
private readonly unsubs;
|
|
118
116
|
private latestMids;
|
|
119
117
|
private structuralValuation?;
|
|
120
|
-
private retryTimer;
|
|
121
|
-
private retryAttempt;
|
|
122
|
-
private static readonly MAX_RETRY_DELAY_MS;
|
|
123
|
-
private static readonly INITIAL_RETRY_DELAY_MS;
|
|
124
118
|
constructor(ws: WebSocketManager, path: string, exchange?: string);
|
|
125
|
-
private scheduleRetry;
|
|
126
|
-
private cancelRetry;
|
|
127
119
|
protected doClose(): void;
|
|
128
120
|
}
|
|
129
121
|
export declare class AggregationWatchStream extends WatchStream<PathAggregation> {
|
|
@@ -253,12 +245,13 @@ export interface ExchangeStateUpdate {
|
|
|
253
245
|
*/
|
|
254
246
|
export declare class ExchangeWatchStream extends WatchStream<ExchangeStateUpdate> {
|
|
255
247
|
private readonly ws;
|
|
248
|
+
private readonly objectPath;
|
|
256
249
|
private readonly objectId;
|
|
257
250
|
private readonly fetchState;
|
|
258
251
|
private _exchangeState;
|
|
259
252
|
private readonly unsubs;
|
|
260
253
|
private fetchInFlight;
|
|
261
|
-
constructor(ws: WebSocketManager, objectId: string, fetchState: (objectId: string) => Promise<ExchangeState>);
|
|
254
|
+
constructor(ws: WebSocketManager, objectPath: string, objectId: string, fetchState: (objectId: string) => Promise<ExchangeState>);
|
|
262
255
|
get exchangeState(): ExchangeState | undefined;
|
|
263
256
|
get pendingIntents(): ExchangeIntent[];
|
|
264
257
|
private refetch;
|
|
@@ -284,7 +277,7 @@ export declare class FillWatchStream extends WatchStream<FillUpdate> {
|
|
|
284
277
|
private readonly ws;
|
|
285
278
|
private readonly fetchFills;
|
|
286
279
|
private readonly objectId;
|
|
287
|
-
private readonly objectPath
|
|
280
|
+
private readonly objectPath;
|
|
288
281
|
readonly fills: Fill[];
|
|
289
282
|
private readonly unsubs;
|
|
290
283
|
private fetchInFlight;
|
|
@@ -293,7 +286,7 @@ export declare class FillWatchStream extends WatchStream<FillUpdate> {
|
|
|
293
286
|
private readonly resolvedCorrelations;
|
|
294
287
|
private convergenceCallbacks;
|
|
295
288
|
static readonly CONVERGENCE_TIMEOUT_MS = 10000;
|
|
296
|
-
constructor(ws: WebSocketManager, fetchFills: () => Promise<FillListResponse>, objectId: string, objectPath
|
|
289
|
+
constructor(ws: WebSocketManager, fetchFills: () => Promise<FillListResponse>, objectId: string, objectPath: string);
|
|
297
290
|
/**
|
|
298
291
|
* Register a callback for convergence timeouts. Fires when a preview
|
|
299
292
|
* (exchange.fill) doesn't receive its authoritative update (fill.recorded)
|
|
@@ -316,9 +309,9 @@ export interface FundingUpdate {
|
|
|
316
309
|
export declare class FundingWatchStream extends WatchStream<FundingUpdate> {
|
|
317
310
|
private readonly ws;
|
|
318
311
|
private readonly objectId;
|
|
319
|
-
private readonly objectPath
|
|
312
|
+
private readonly objectPath;
|
|
320
313
|
private readonly unsubs;
|
|
321
|
-
constructor(ws: WebSocketManager, objectId: string, objectPath
|
|
314
|
+
constructor(ws: WebSocketManager, objectId: string, objectPath: string);
|
|
322
315
|
protected doClose(): void;
|
|
323
316
|
}
|
|
324
317
|
export {};
|
package/dist/streams.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../src/streams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EAEX,aAAa,EACb,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EAGf,IAAI,EACJ,gBAAgB,EAChB,cAAc,EACd,aAAa,EAEb,cAAc,EACd,WAAW,EACX,UAAU,EAEV,WAAW,EACX,QAAQ,EACR,iBAAiB,
|
|
1
|
+
{"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../src/streams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EAEX,aAAa,EACb,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EAGf,IAAI,EACJ,gBAAgB,EAChB,cAAc,EACd,aAAa,EAEb,cAAc,EACd,WAAW,EACX,UAAU,EAEV,WAAW,EACX,QAAQ,EACR,iBAAiB,EAElB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,WAAW,GAAG,cAAc,CAAC;AAExE,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;AAC3C,KAAK,aAAa,GAAG,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;AAEvD;;;;;;;GAOG;AACH,uBAAe,WAAW,CAAC,CAAC;IAC1B,SAAS,CAAC,QAAQ,CAAC,eAAe,yBAAgC;IAClE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA4B;IAC3D,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,YAAY,CAAC,CAAa;IAClC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAgB;;IAQ7C,6CAA6C;IAC7C,IAAI,KAAK,IAAI,gBAAgB,CAE5B;IAED;;;OAGG;IACH,KAA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sB,SAAU;gBAG7B,EAAE,EAAE,gBAAgB,EACpB,UAAU,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,EAC3C,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM;IAkErC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,IAAI;IAKrE,OAAO,CAAC,cAAc;IAgBtB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,OAAO;IAwBf,SAAS,CAAC,OAAO,IAAI,IAAI;CAK1B;AAID,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,aAAa,CAAC;CACzB;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,WAAW,CAAC,aAAa,CAAC;IAI9D,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAL7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyB;gBAG7B,EAAE,EAAE,gBAAgB,EACpB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM;IAkCrC,SAAS,CAAC,OAAO,IAAI,IAAI;CAI1B"}
|
package/dist/streams.js
CHANGED
|
@@ -124,25 +124,23 @@ class WatchStream {
|
|
|
124
124
|
}
|
|
125
125
|
class OperationWatchStream extends WatchStream {
|
|
126
126
|
ws;
|
|
127
|
-
|
|
127
|
+
path;
|
|
128
128
|
refetchOperations;
|
|
129
129
|
operations = [];
|
|
130
130
|
unsubs = [];
|
|
131
131
|
gapRefetchInFlight = false;
|
|
132
|
-
constructor(ws,
|
|
132
|
+
constructor(ws, path, refetchOperations) {
|
|
133
133
|
super();
|
|
134
134
|
this.ws = ws;
|
|
135
|
-
this.
|
|
135
|
+
this.path = path;
|
|
136
136
|
this.refetchOperations = refetchOperations;
|
|
137
|
-
this.unsubs.push(this.ws.
|
|
138
|
-
this.operations.length = 0;
|
|
139
|
-
this.operations.push(...data);
|
|
140
|
-
this.setState('connected');
|
|
141
|
-
}), this.ws.onStatus((status) => {
|
|
137
|
+
this.unsubs.push(this.ws.onStatus((status) => {
|
|
142
138
|
if (status === 'disconnected' && this.state !== 'loading') {
|
|
143
139
|
this.setState('reconnecting');
|
|
144
140
|
}
|
|
145
141
|
}), this.ws.onOperationCreated((op, event) => {
|
|
142
|
+
if (this.path !== '/' && event.entityPath && !event.entityPath.startsWith(this.path))
|
|
143
|
+
return;
|
|
146
144
|
const synthIdx = this.operations.findIndex(o => o.id === op.path && o.state === 'submitting');
|
|
147
145
|
if (synthIdx >= 0) {
|
|
148
146
|
this.operations[synthIdx] = op;
|
|
@@ -152,12 +150,31 @@ class OperationWatchStream extends WatchStream {
|
|
|
152
150
|
}
|
|
153
151
|
this.emit({ operation: op, event });
|
|
154
152
|
}), this.ws.onOperationUpdated((op, event) => {
|
|
153
|
+
if (this.path !== '/' && event.entityPath && !event.entityPath.startsWith(this.path))
|
|
154
|
+
return;
|
|
155
155
|
const idx = this.operations.findIndex(o => o.id === op.id);
|
|
156
156
|
if (idx >= 0)
|
|
157
157
|
this.operations[idx] = op;
|
|
158
158
|
this.emit({ operation: op, event });
|
|
159
159
|
}), this.ws.onGap(() => { this.handleGap(); }));
|
|
160
|
-
this.ws.
|
|
160
|
+
this.ws.watchPath(path).then((snapshot) => {
|
|
161
|
+
this.operations.length = 0;
|
|
162
|
+
if (snapshot.operations) {
|
|
163
|
+
this.operations.push(...snapshot.operations);
|
|
164
|
+
}
|
|
165
|
+
if (snapshot.bufferedOperations) {
|
|
166
|
+
for (const op of snapshot.bufferedOperations) {
|
|
167
|
+
const idx = this.operations.findIndex(o => o.id === op.id);
|
|
168
|
+
if (idx >= 0) {
|
|
169
|
+
this.operations[idx] = op;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
this.operations.unshift(op);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
this.setState('connected');
|
|
177
|
+
}).catch(() => { });
|
|
161
178
|
}
|
|
162
179
|
handleGap() {
|
|
163
180
|
if (!this.refetchOperations || this.gapRefetchInFlight || this.isClosed)
|
|
@@ -221,41 +238,32 @@ class OperationWatchStream extends WatchStream {
|
|
|
221
238
|
}
|
|
222
239
|
doClose() {
|
|
223
240
|
this.unsubs.forEach(u => u());
|
|
224
|
-
this.ws.
|
|
241
|
+
this.ws.unwatchPath(this.path);
|
|
225
242
|
}
|
|
226
243
|
}
|
|
227
244
|
exports.OperationWatchStream = OperationWatchStream;
|
|
228
245
|
class BalanceWatchStream extends WatchStream {
|
|
229
246
|
ws;
|
|
230
|
-
|
|
247
|
+
path;
|
|
231
248
|
refetchEntityBalances;
|
|
232
249
|
balances = new Map();
|
|
233
250
|
unsubs = [];
|
|
234
|
-
pathFilter;
|
|
235
251
|
activePredictions = new Map();
|
|
236
252
|
gapRefetchInFlight = false;
|
|
237
|
-
constructor(ws,
|
|
253
|
+
constructor(ws, path, refetchEntityBalances) {
|
|
238
254
|
super();
|
|
239
255
|
this.ws = ws;
|
|
240
|
-
this.
|
|
256
|
+
this.path = path;
|
|
241
257
|
this.refetchEntityBalances = refetchEntityBalances;
|
|
242
|
-
this.
|
|
243
|
-
this.unsubs.push(this.ws.onSnapshot(channel, (data) => {
|
|
244
|
-
this.balances.clear();
|
|
245
|
-
for (const entry of data) {
|
|
246
|
-
this.balances.set(entry.entityId, entry);
|
|
247
|
-
}
|
|
248
|
-
this.setState('connected');
|
|
249
|
-
}), this.ws.onStatus((status) => {
|
|
258
|
+
this.unsubs.push(this.ws.onStatus((status) => {
|
|
250
259
|
if (status === 'disconnected' && this.state !== 'loading') {
|
|
251
260
|
this.setState('reconnecting');
|
|
252
261
|
}
|
|
253
262
|
}), this.ws.onGap(() => { this.handleGap(); }), this.ws.onBalanceUpdated((entityId, event) => {
|
|
254
|
-
if (this.
|
|
263
|
+
if (this.path !== '/' && event.entityPath && !event.entityPath.startsWith(this.path)) {
|
|
255
264
|
return;
|
|
256
265
|
}
|
|
257
266
|
const rawBalances = event.balances;
|
|
258
|
-
// Reconcile: server state arrived, clear matching predictions
|
|
259
267
|
if (event.entityPath) {
|
|
260
268
|
this.activePredictions.delete(event.entityPath);
|
|
261
269
|
}
|
|
@@ -274,7 +282,19 @@ class BalanceWatchStream extends WatchStream {
|
|
|
274
282
|
}
|
|
275
283
|
this.emit(update);
|
|
276
284
|
}));
|
|
277
|
-
this.ws.
|
|
285
|
+
this.ws.watchPath(path).then((snapshot) => {
|
|
286
|
+
this.balances.clear();
|
|
287
|
+
if (snapshot.balances) {
|
|
288
|
+
for (const entry of snapshot.balances) {
|
|
289
|
+
this.balances.set(entry.entityId, {
|
|
290
|
+
entityId: entry.entityId,
|
|
291
|
+
entityPath: entry.entityPath,
|
|
292
|
+
balances: entry.balances,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
this.setState('connected');
|
|
297
|
+
}).catch(() => { });
|
|
278
298
|
}
|
|
279
299
|
/**
|
|
280
300
|
* Optimistically apply predicted balance effects from an operation handle.
|
|
@@ -347,7 +367,7 @@ class BalanceWatchStream extends WatchStream {
|
|
|
347
367
|
}
|
|
348
368
|
doClose() {
|
|
349
369
|
this.unsubs.forEach(u => u());
|
|
350
|
-
this.ws.
|
|
370
|
+
this.ws.unwatchPath(this.path);
|
|
351
371
|
}
|
|
352
372
|
}
|
|
353
373
|
exports.BalanceWatchStream = BalanceWatchStream;
|
|
@@ -356,14 +376,9 @@ class ObjectWatchStream extends WatchStream {
|
|
|
356
376
|
path;
|
|
357
377
|
exchange;
|
|
358
378
|
valuation;
|
|
359
|
-
watchId;
|
|
360
379
|
unsubs = [];
|
|
361
380
|
latestMids = {};
|
|
362
381
|
structuralValuation;
|
|
363
|
-
retryTimer = null;
|
|
364
|
-
retryAttempt = 0;
|
|
365
|
-
static MAX_RETRY_DELAY_MS = 30_000;
|
|
366
|
-
static INITIAL_RETRY_DELAY_MS = 1000;
|
|
367
382
|
constructor(ws, path, exchange = 'sim') {
|
|
368
383
|
super();
|
|
369
384
|
this.ws = ws;
|
|
@@ -373,21 +388,12 @@ class ObjectWatchStream extends WatchStream {
|
|
|
373
388
|
this.unsubs.push(this.ws.onStatus((status) => {
|
|
374
389
|
if (status === 'disconnected' && this.state !== 'loading') {
|
|
375
390
|
this.setState('reconnecting');
|
|
376
|
-
this.cancelRetry();
|
|
377
|
-
this.retryAttempt = 0;
|
|
378
391
|
}
|
|
379
|
-
}), this.ws.onObjectValuation((eventPath, valuation
|
|
392
|
+
}), this.ws.onObjectValuation((eventPath, valuation) => {
|
|
380
393
|
if (eventPath !== this.path)
|
|
381
394
|
return;
|
|
382
|
-
this.watchId = watchId;
|
|
383
|
-
this.ws.trackObjectWatch(watchId, this.path);
|
|
384
395
|
if (valuation.computed === false) {
|
|
385
|
-
// Don't yield uncomputed valuations (valueUsd:"0") to consumers —
|
|
386
|
-
// hold the last-known-good value and retry silently. Yielding $0
|
|
387
|
-
// causes phantom P&L swings.
|
|
388
396
|
if (!this.structuralValuation) {
|
|
389
|
-
// First event ever — yield even if uncomputed so the stream
|
|
390
|
-
// transitions out of loading.
|
|
391
397
|
this.structuralValuation = valuation;
|
|
392
398
|
const hasPrice = Object.keys(this.latestMids).length > 0;
|
|
393
399
|
const revalued = hasPrice ? (0, revalue_1.revalueObject)(valuation, this.latestMids) : valuation;
|
|
@@ -395,11 +401,8 @@ class ObjectWatchStream extends WatchStream {
|
|
|
395
401
|
this.setState('connected');
|
|
396
402
|
this.emit(revalued);
|
|
397
403
|
}
|
|
398
|
-
this.scheduleRetry();
|
|
399
404
|
return;
|
|
400
405
|
}
|
|
401
|
-
this.cancelRetry();
|
|
402
|
-
this.retryAttempt = 0;
|
|
403
406
|
this.structuralValuation = valuation;
|
|
404
407
|
const hasPrice = Object.keys(this.latestMids).length > 0;
|
|
405
408
|
const revalued = hasPrice ? (0, revalue_1.revalueObject)(valuation, this.latestMids) : valuation;
|
|
@@ -414,34 +417,21 @@ class ObjectWatchStream extends WatchStream {
|
|
|
414
417
|
this.valuation = revalued;
|
|
415
418
|
this.emit(revalued);
|
|
416
419
|
}));
|
|
417
|
-
this.ws.
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
this.retryTimer = null;
|
|
426
|
-
this.retryAttempt++;
|
|
427
|
-
if (!this.isClosed) {
|
|
428
|
-
this.ws.sendWatchObject(this.path);
|
|
420
|
+
this.ws.watchPath(path).then((snapshot) => {
|
|
421
|
+
if (snapshot.valuation && !this.structuralValuation) {
|
|
422
|
+
this.structuralValuation = snapshot.valuation;
|
|
423
|
+
const hasPrice = Object.keys(this.latestMids).length > 0;
|
|
424
|
+
const revalued = hasPrice ? (0, revalue_1.revalueObject)(snapshot.valuation, this.latestMids) : snapshot.valuation;
|
|
425
|
+
this.valuation = revalued;
|
|
426
|
+
this.setState('connected');
|
|
427
|
+
this.emit(revalued);
|
|
429
428
|
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
cancelRetry() {
|
|
433
|
-
if (this.retryTimer) {
|
|
434
|
-
clearTimeout(this.retryTimer);
|
|
435
|
-
this.retryTimer = null;
|
|
436
|
-
}
|
|
429
|
+
}).catch(() => { });
|
|
437
430
|
}
|
|
438
431
|
doClose() {
|
|
439
|
-
this.cancelRetry();
|
|
440
432
|
this.unsubs.forEach(u => u());
|
|
441
433
|
this.ws.releaseMids();
|
|
442
|
-
|
|
443
|
-
this.ws.sendUnwatchObject(this.watchId);
|
|
444
|
-
}
|
|
434
|
+
this.ws.unwatchPath(this.path);
|
|
445
435
|
}
|
|
446
436
|
}
|
|
447
437
|
exports.ObjectWatchStream = ObjectWatchStream;
|
|
@@ -465,7 +455,6 @@ class AggregationWatchStream extends WatchStream {
|
|
|
465
455
|
this.aggregation = initialAggregation;
|
|
466
456
|
this.destroyWatch = destroyWatch;
|
|
467
457
|
this.ws.acquireMids(exchange);
|
|
468
|
-
this.ws.acquireChannel('aggregation');
|
|
469
458
|
this.unsubs.push(this.ws.onStatus((status) => {
|
|
470
459
|
if (status === 'disconnected' && this.state !== 'loading') {
|
|
471
460
|
this.setState('reconnecting');
|
|
@@ -519,7 +508,6 @@ class AggregationWatchStream extends WatchStream {
|
|
|
519
508
|
doClose() {
|
|
520
509
|
this.unsubs.forEach(u => u());
|
|
521
510
|
this.ws.releaseMids();
|
|
522
|
-
this.ws.releaseChannel('aggregation');
|
|
523
511
|
this.destroyWatch?.().catch(() => { });
|
|
524
512
|
}
|
|
525
513
|
}
|
|
@@ -598,7 +586,6 @@ class PnlChartStream extends WatchStream {
|
|
|
598
586
|
constructor(initialPnlPoints, initialFlows, startingEquityUsd, midPrices, prefix, aggStream, ws, resolution) {
|
|
599
587
|
super();
|
|
600
588
|
this.opEventsWs = ws;
|
|
601
|
-
ws.acquireChannel('operations');
|
|
602
589
|
this.historicalPnlPoints = [...initialPnlPoints];
|
|
603
590
|
this.externalFlows = [...initialFlows];
|
|
604
591
|
this.startingEquityUsd = startingEquityUsd;
|
|
@@ -724,7 +711,6 @@ class PnlChartStream extends WatchStream {
|
|
|
724
711
|
doClose() {
|
|
725
712
|
this.aggUnsub?.();
|
|
726
713
|
this.opUnsub?.();
|
|
727
|
-
this.opEventsWs.releaseChannel('operations');
|
|
728
714
|
this.aggStream.close();
|
|
729
715
|
}
|
|
730
716
|
}
|
|
@@ -867,15 +853,16 @@ class PriceWatchStream extends WatchStream {
|
|
|
867
853
|
super();
|
|
868
854
|
this.ws = ws;
|
|
869
855
|
this.exchange = exchange;
|
|
870
|
-
this.unsubs.push(this.ws.
|
|
871
|
-
this._prices = { ...data };
|
|
872
|
-
this.setState('connected');
|
|
873
|
-
}), this.ws.onStatus((status) => {
|
|
856
|
+
this.unsubs.push(this.ws.onStatus((status) => {
|
|
874
857
|
if (status === 'disconnected' && this.state !== 'loading') {
|
|
875
858
|
this.setState('reconnecting');
|
|
876
859
|
}
|
|
860
|
+
else if (status === 'connected') {
|
|
861
|
+
this.setState('connected');
|
|
862
|
+
}
|
|
877
863
|
}), this.ws.onMidsUpdated((mids) => {
|
|
878
864
|
Object.assign(this._prices, mids);
|
|
865
|
+
this.setState('connected');
|
|
879
866
|
this.emit(this._prices);
|
|
880
867
|
}));
|
|
881
868
|
this.ws.acquireMids(exchange);
|
|
@@ -931,14 +918,16 @@ exports.CandleWatchStream = CandleWatchStream;
|
|
|
931
918
|
*/
|
|
932
919
|
class ExchangeWatchStream extends WatchStream {
|
|
933
920
|
ws;
|
|
921
|
+
objectPath;
|
|
934
922
|
objectId;
|
|
935
923
|
fetchState;
|
|
936
924
|
_exchangeState;
|
|
937
925
|
unsubs = [];
|
|
938
926
|
fetchInFlight = false;
|
|
939
|
-
constructor(ws, objectId, fetchState) {
|
|
927
|
+
constructor(ws, objectPath, objectId, fetchState) {
|
|
940
928
|
super();
|
|
941
929
|
this.ws = ws;
|
|
930
|
+
this.objectPath = objectPath;
|
|
942
931
|
this.objectId = objectId;
|
|
943
932
|
this.fetchState = fetchState;
|
|
944
933
|
this.unsubs.push(this.ws.onStatus((status) => {
|
|
@@ -949,7 +938,7 @@ class ExchangeWatchStream extends WatchStream {
|
|
|
949
938
|
this.refetch();
|
|
950
939
|
}
|
|
951
940
|
}), this.ws.onExchangeUpdated((exchangeState, event) => {
|
|
952
|
-
if (event.entityId !== this.objectId && event.entityPath !== this.
|
|
941
|
+
if (event.entityId !== this.objectId && event.entityPath !== this.objectPath) {
|
|
953
942
|
return;
|
|
954
943
|
}
|
|
955
944
|
if (exchangeState.pendingIntents) {
|
|
@@ -961,9 +950,18 @@ class ExchangeWatchStream extends WatchStream {
|
|
|
961
950
|
this.refetch(event);
|
|
962
951
|
}
|
|
963
952
|
}));
|
|
964
|
-
this.ws.
|
|
965
|
-
|
|
966
|
-
|
|
953
|
+
this.ws.watchPath(this.objectPath).then((snapshot) => {
|
|
954
|
+
if (snapshot.exchange && !this._exchangeState) {
|
|
955
|
+
this._exchangeState = snapshot.exchange;
|
|
956
|
+
this.setState('connected');
|
|
957
|
+
this.emit({ state: snapshot.exchange });
|
|
958
|
+
}
|
|
959
|
+
else {
|
|
960
|
+
this.refetch();
|
|
961
|
+
}
|
|
962
|
+
}).catch(() => {
|
|
963
|
+
this.refetch();
|
|
964
|
+
});
|
|
967
965
|
}
|
|
968
966
|
get exchangeState() {
|
|
969
967
|
return this._exchangeState;
|
|
@@ -988,6 +986,7 @@ class ExchangeWatchStream extends WatchStream {
|
|
|
988
986
|
}
|
|
989
987
|
doClose() {
|
|
990
988
|
this.unsubs.forEach(u => u());
|
|
989
|
+
this.ws.unwatchPath(this.objectPath);
|
|
991
990
|
}
|
|
992
991
|
}
|
|
993
992
|
exports.ExchangeWatchStream = ExchangeWatchStream;
|
|
@@ -1078,8 +1077,7 @@ class FillWatchStream extends WatchStream {
|
|
|
1078
1077
|
}
|
|
1079
1078
|
this.emit({ fill, event });
|
|
1080
1079
|
}), this.ws.onGap(() => { this.refetch(); }));
|
|
1081
|
-
this.ws.
|
|
1082
|
-
this.ws.subscribe(['exchange']);
|
|
1080
|
+
this.ws.watchPath(this.objectPath).catch(() => { });
|
|
1083
1081
|
this.refetch();
|
|
1084
1082
|
}
|
|
1085
1083
|
/**
|
|
@@ -1143,6 +1141,7 @@ class FillWatchStream extends WatchStream {
|
|
|
1143
1141
|
for (const [, entry] of this.previewCorrelations)
|
|
1144
1142
|
clearTimeout(entry.timer);
|
|
1145
1143
|
this.unsubs.forEach(u => u());
|
|
1144
|
+
this.ws.unwatchPath(this.objectPath);
|
|
1146
1145
|
}
|
|
1147
1146
|
}
|
|
1148
1147
|
exports.FillWatchStream = FillWatchStream;
|
|
@@ -1168,8 +1167,7 @@ class FundingWatchStream extends WatchStream {
|
|
|
1168
1167
|
this.setState('connected');
|
|
1169
1168
|
}
|
|
1170
1169
|
}), this.ws.onExchangeFunding((payment, event) => {
|
|
1171
|
-
if (event.entityId !== this.objectId &&
|
|
1172
|
-
!(this.objectPath && event.entityPath === this.objectPath)) {
|
|
1170
|
+
if (event.entityId !== this.objectId && event.entityPath !== this.objectPath) {
|
|
1173
1171
|
return;
|
|
1174
1172
|
}
|
|
1175
1173
|
const envelope = {
|
|
@@ -1184,12 +1182,12 @@ class FundingWatchStream extends WatchStream {
|
|
|
1184
1182
|
};
|
|
1185
1183
|
this.emit({ payment, envelope });
|
|
1186
1184
|
}));
|
|
1187
|
-
this.ws.
|
|
1188
|
-
this.ws.subscribe(['exchange']);
|
|
1185
|
+
this.ws.watchPath(this.objectPath).catch(() => { });
|
|
1189
1186
|
this.setState('connected');
|
|
1190
1187
|
}
|
|
1191
1188
|
doClose() {
|
|
1192
1189
|
this.unsubs.forEach(u => u());
|
|
1190
|
+
this.ws.unwatchPath(this.objectPath);
|
|
1193
1191
|
}
|
|
1194
1192
|
}
|
|
1195
1193
|
exports.FundingWatchStream = FundingWatchStream;
|