@grvt/client 1.4.10 → 1.4.12-fix.0
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/package.json +1 -1
- package/ws/ws.js +14 -13
package/package.json
CHANGED
package/ws/ws.js
CHANGED
|
@@ -24,6 +24,7 @@ exports.WS = void 0;
|
|
|
24
24
|
const interfaces_1 = require("../interfaces");
|
|
25
25
|
const utils_1 = require("../utils");
|
|
26
26
|
const interfaces_2 = require("./interfaces");
|
|
27
|
+
const omitZeroStr = (str) => str === '0' ? '' : str;
|
|
27
28
|
class WS {
|
|
28
29
|
get _ws() {
|
|
29
30
|
if (!this.__ws) {
|
|
@@ -213,16 +214,16 @@ class WS {
|
|
|
213
214
|
if (!key.startsWith(`${stream}__`)) {
|
|
214
215
|
return acc;
|
|
215
216
|
}
|
|
216
|
-
const depositDestinationAccountId = result.to_account_id;
|
|
217
|
+
const depositDestinationAccountId = omitZeroStr(result.to_account_id);
|
|
217
218
|
const transferSourceKey = [
|
|
218
|
-
result.from_account_id,
|
|
219
|
-
result.from_sub_account_id ? result.from_sub_account_id : 0
|
|
219
|
+
omitZeroStr(result.from_account_id),
|
|
220
|
+
omitZeroStr(result.from_sub_account_id) ? result.from_sub_account_id : 0
|
|
220
221
|
].filter(Boolean).join('-');
|
|
221
222
|
const transferDestinationKey = [
|
|
222
|
-
result.to_account_id,
|
|
223
|
-
result.to_sub_account_id ? result.to_sub_account_id : 0
|
|
223
|
+
omitZeroStr(result.to_account_id),
|
|
224
|
+
omitZeroStr(result.to_sub_account_id) ? result.to_sub_account_id : 0
|
|
224
225
|
].filter(Boolean).join('-');
|
|
225
|
-
const withdrawalFromAccountId = result.from_account_id;
|
|
226
|
+
const withdrawalFromAccountId = omitZeroStr(result.from_account_id);
|
|
226
227
|
switch (stream) {
|
|
227
228
|
case interfaces_2.EStream.GROUP:
|
|
228
229
|
return [...acc, ...Object.values(value)];
|
|
@@ -253,7 +254,7 @@ class WS {
|
|
|
253
254
|
*/
|
|
254
255
|
_getInstrumentConsumers({ result, stream, instrument }) {
|
|
255
256
|
return Object.entries(this._pairs).reduce((acc, [key, value]) => {
|
|
256
|
-
var _a, _b, _c;
|
|
257
|
+
var _a, _b, _c, _d;
|
|
257
258
|
if (!key.startsWith(`${stream}__`)) {
|
|
258
259
|
return acc;
|
|
259
260
|
}
|
|
@@ -268,22 +269,22 @@ class WS {
|
|
|
268
269
|
].includes(stream);
|
|
269
270
|
// no sub account id handling
|
|
270
271
|
if (!hasSubAccountId) {
|
|
271
|
-
return key.
|
|
272
|
+
return key.startsWith(`${stream}__${instrument}`)
|
|
272
273
|
? [...acc, ...Object.values(value)]
|
|
273
274
|
: acc;
|
|
274
275
|
}
|
|
275
276
|
// has sub account id handling
|
|
276
|
-
const subAccountId = String(result.sub_account_id);
|
|
277
|
+
const subAccountId = String((_a = result.sub_account_id) !== null && _a !== void 0 ? _a : '');
|
|
277
278
|
// const subAccountId = String((result as IPositions).sub_account_id)
|
|
278
279
|
// const subAccountId = String((result as IFill).sub_account_id)
|
|
279
|
-
const feed = (
|
|
280
|
+
const feed = (_b = this._parseStream({
|
|
280
281
|
stream: stream,
|
|
281
282
|
params: {
|
|
282
|
-
sub_account_id: subAccountId,
|
|
283
|
+
sub_account_id: omitZeroStr(subAccountId),
|
|
283
284
|
instrument
|
|
284
285
|
}
|
|
285
|
-
})) === null ||
|
|
286
|
-
const tdgFeedPrefix = (
|
|
286
|
+
})) === null || _b === void 0 ? void 0 : _b.feed;
|
|
287
|
+
const tdgFeedPrefix = (_d = (_c = feed === null || feed === void 0 ? void 0 : feed[0]) === null || _c === void 0 ? void 0 : _c.split('@')) === null || _d === void 0 ? void 0 : _d[0];
|
|
287
288
|
if (tdgFeedPrefix && key.startsWith(`${stream}__${tdgFeedPrefix}`)) {
|
|
288
289
|
return [...acc, ...Object.values(value)];
|
|
289
290
|
}
|