@stryke-xyz/premarket-sdk 1.2.7 → 1.2.9
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/cjs/package.json +1 -1
- package/dist/cjs/sync/clients/activity-client.js +33 -4
- package/dist/cjs/sync/clients/order-client.js +58 -8
- package/dist/esm/package.json +1 -1
- package/dist/esm/sync/clients/activity-client.js +33 -4
- package/dist/esm/sync/clients/order-client.js +58 -8
- package/dist/types/sync/clients/activity-client.d.ts +1 -0
- package/dist/types/sync/clients/order-client.d.ts +8 -0
- package/package.json +1 -1
package/dist/cjs/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@stryke-xyz/premarket-sdk","version":"1.2.
|
|
1
|
+
{"name":"@stryke-xyz/premarket-sdk","version":"1.2.8","type":"commonjs"}
|
|
@@ -315,12 +315,41 @@ function _object_spread(target) {
|
|
|
315
315
|
{
|
|
316
316
|
key: "handleMessage",
|
|
317
317
|
value: function handleMessage(ev) {
|
|
318
|
-
var
|
|
318
|
+
var parsed;
|
|
319
319
|
try {
|
|
320
|
-
|
|
320
|
+
parsed = JSON.parse(ev.data);
|
|
321
321
|
} catch (unused) {
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
|
+
// Support both single object and batched array (from the 5ms WS batcher).
|
|
325
|
+
var messages = Array.isArray(parsed) ? parsed : [
|
|
326
|
+
parsed
|
|
327
|
+
];
|
|
328
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
329
|
+
try {
|
|
330
|
+
for(var _iterator = messages[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
331
|
+
var msg = _step.value;
|
|
332
|
+
this.dispatchMessage(msg);
|
|
333
|
+
}
|
|
334
|
+
} catch (err) {
|
|
335
|
+
_didIteratorError = true;
|
|
336
|
+
_iteratorError = err;
|
|
337
|
+
} finally{
|
|
338
|
+
try {
|
|
339
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
340
|
+
_iterator.return();
|
|
341
|
+
}
|
|
342
|
+
} finally{
|
|
343
|
+
if (_didIteratorError) {
|
|
344
|
+
throw _iteratorError;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
key: "dispatchMessage",
|
|
352
|
+
value: function dispatchMessage(msg) {
|
|
324
353
|
var type = msg.type;
|
|
325
354
|
if (type === "pong") {
|
|
326
355
|
this.clearHeartbeatTimeout();
|
|
@@ -345,7 +374,7 @@ function _object_spread(target) {
|
|
|
345
374
|
/* noop */ return;
|
|
346
375
|
}
|
|
347
376
|
if (type === "fill" || type === "order_update") {
|
|
348
|
-
var
|
|
377
|
+
var ev = _object_spread({
|
|
349
378
|
type: type,
|
|
350
379
|
orderHash: msg.orderHash,
|
|
351
380
|
marketId: msg.marketId,
|
|
@@ -359,7 +388,7 @@ function _object_spread(target) {
|
|
|
359
388
|
var cbs = _step.value;
|
|
360
389
|
cbs.forEach(function(cb) {
|
|
361
390
|
try {
|
|
362
|
-
cb(
|
|
391
|
+
cb(ev);
|
|
363
392
|
} catch (unused) {}
|
|
364
393
|
});
|
|
365
394
|
}
|
|
@@ -257,7 +257,7 @@ function normalizePrice(price) {
|
|
|
257
257
|
if (isNaN(num)) return price;
|
|
258
258
|
return num.toString();
|
|
259
259
|
}
|
|
260
|
-
/** A market + its token IDs to subscribe to. */ /** Current depth state for a token within a market subscription. */ /** One bid or ask level change in the normalized SDK format. */ /** Raw level shape inside the wire `depth_update.levels[]` array. */ /** Raw `depth_update` frame as published by the depth projector. */ /** Consolidated depth update emitted to SDK listeners after normalization. */ /** Last applied executor sequenceId for this token (== endSeq of the frame). */ /** Range covered by this frame; clients can detect gaps via startSeq != prevSeq + 1. */ /**
|
|
260
|
+
/** A market + its token IDs to subscribe to. */ /** Current depth state for a token within a market subscription. */ /** ms epoch when lastPrice was set on the server, or null if unknown. */ /** One bid or ask level change in the normalized SDK format. */ /** Raw level shape inside the wire `depth_update.levels[]` array. */ /** Raw `depth_update` frame as published by the depth projector. */ /** Consolidated depth update emitted to SDK listeners after normalization. */ /** ms epoch when lastPrice was set on the server, or null if unknown. */ /** Last applied executor sequenceId for this token (== endSeq of the frame). */ /** Range covered by this frame; clients can detect gaps via startSeq != prevSeq + 1. */ /**
|
|
261
261
|
* Configuration for the market depth websocket client.
|
|
262
262
|
*
|
|
263
263
|
* Supports multiple markets over a single WebSocket connection.
|
|
@@ -756,12 +756,16 @@ function normalizePrice(price) {
|
|
|
756
756
|
try {
|
|
757
757
|
for(var _iterator = snapshots[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
758
758
|
var snapshot = _step.value;
|
|
759
|
+
var _snapshot_bestBidAt, _snapshot_bestAskAt, _snapshot_lastPriceAt;
|
|
759
760
|
var state = {
|
|
760
761
|
bids: new Map(),
|
|
761
762
|
asks: new Map(),
|
|
762
763
|
bestBid: snapshot.bestBid,
|
|
763
764
|
bestAsk: snapshot.bestAsk,
|
|
765
|
+
bestBidAt: (_snapshot_bestBidAt = snapshot.bestBidAt) !== null && _snapshot_bestBidAt !== void 0 ? _snapshot_bestBidAt : null,
|
|
766
|
+
bestAskAt: (_snapshot_bestAskAt = snapshot.bestAskAt) !== null && _snapshot_bestAskAt !== void 0 ? _snapshot_bestAskAt : null,
|
|
764
767
|
lastPrice: snapshot.lastPrice,
|
|
768
|
+
lastPriceAt: (_snapshot_lastPriceAt = snapshot.lastPriceAt) !== null && _snapshot_lastPriceAt !== void 0 ? _snapshot_lastPriceAt : null,
|
|
765
769
|
seq: snapshot.seq
|
|
766
770
|
};
|
|
767
771
|
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
@@ -857,24 +861,64 @@ function normalizePrice(price) {
|
|
|
857
861
|
{
|
|
858
862
|
key: "handleMarketStateUpdate",
|
|
859
863
|
value: function handleMarketStateUpdate(msg) {
|
|
860
|
-
var _msg_bestBid, _msg_bestAsk, _msg_lastPrice;
|
|
861
864
|
var state = this.tokenStates.get(String(msg.tokenId));
|
|
862
865
|
if (!state) return;
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
+
if (msg.bestBid != null) {
|
|
867
|
+
var _msg_bestBidAt;
|
|
868
|
+
state.bestBid = msg.bestBid;
|
|
869
|
+
state.bestBidAt = (_msg_bestBidAt = msg.bestBidAt) !== null && _msg_bestBidAt !== void 0 ? _msg_bestBidAt : state.bestBidAt;
|
|
870
|
+
}
|
|
871
|
+
if (msg.bestAsk != null) {
|
|
872
|
+
var _msg_bestAskAt;
|
|
873
|
+
state.bestAsk = msg.bestAsk;
|
|
874
|
+
state.bestAskAt = (_msg_bestAskAt = msg.bestAskAt) !== null && _msg_bestAskAt !== void 0 ? _msg_bestAskAt : state.bestAskAt;
|
|
875
|
+
}
|
|
876
|
+
if (msg.lastPrice != null) {
|
|
877
|
+
var _msg_lastPriceAt;
|
|
878
|
+
state.lastPrice = msg.lastPrice;
|
|
879
|
+
state.lastPriceAt = (_msg_lastPriceAt = msg.lastPriceAt) !== null && _msg_lastPriceAt !== void 0 ? _msg_lastPriceAt : state.lastPriceAt;
|
|
880
|
+
}
|
|
866
881
|
this.emitOutOfBandUpdate(msg.marketId, msg.tokenId, state);
|
|
867
882
|
}
|
|
868
883
|
},
|
|
869
884
|
{
|
|
870
885
|
key: "handleLastPriceUpdate",
|
|
871
|
-
value: function handleLastPriceUpdate(msg) {
|
|
886
|
+
value: function handleLastPriceUpdate(msg) /** New batched format: all fill prices in this flush window. */ /** Legacy single-price format. */ {
|
|
872
887
|
var _ref, _msg_marketId;
|
|
873
888
|
var state = this.tokenStates.get(String(msg.tokenId));
|
|
874
889
|
if (!state) return;
|
|
875
|
-
state.lastPrice = msg.lastPrice;
|
|
876
890
|
var marketId = (_ref = (_msg_marketId = msg.marketId) !== null && _msg_marketId !== void 0 ? _msg_marketId : this.tokenToMarket.get(msg.tokenId)) !== null && _ref !== void 0 ? _ref : "";
|
|
877
|
-
|
|
891
|
+
if (msg.prices && msg.prices.length > 0) {
|
|
892
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
893
|
+
try {
|
|
894
|
+
// Emit one DepthUpdate per price so listeners see every fill price.
|
|
895
|
+
for(var _iterator = msg.prices[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
896
|
+
var entry = _step.value;
|
|
897
|
+
state.lastPrice = entry.price;
|
|
898
|
+
state.lastPriceAt = entry.at;
|
|
899
|
+
this.emitOutOfBandUpdate(marketId, msg.tokenId, state);
|
|
900
|
+
}
|
|
901
|
+
} catch (err) {
|
|
902
|
+
_didIteratorError = true;
|
|
903
|
+
_iteratorError = err;
|
|
904
|
+
} finally{
|
|
905
|
+
try {
|
|
906
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
907
|
+
_iterator.return();
|
|
908
|
+
}
|
|
909
|
+
} finally{
|
|
910
|
+
if (_didIteratorError) {
|
|
911
|
+
throw _iteratorError;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
} else if (msg.lastPrice != null) {
|
|
916
|
+
var _msg_lastPriceAt;
|
|
917
|
+
// Legacy single-price fallback.
|
|
918
|
+
state.lastPrice = msg.lastPrice;
|
|
919
|
+
state.lastPriceAt = (_msg_lastPriceAt = msg.lastPriceAt) !== null && _msg_lastPriceAt !== void 0 ? _msg_lastPriceAt : state.lastPriceAt;
|
|
920
|
+
this.emitOutOfBandUpdate(marketId, msg.tokenId, state);
|
|
921
|
+
}
|
|
878
922
|
}
|
|
879
923
|
},
|
|
880
924
|
{
|
|
@@ -885,7 +929,10 @@ function normalizePrice(price) {
|
|
|
885
929
|
levels: [],
|
|
886
930
|
bestBid: state.bestBid,
|
|
887
931
|
bestAsk: state.bestAsk,
|
|
932
|
+
bestBidAt: state.bestBidAt,
|
|
933
|
+
bestAskAt: state.bestAskAt,
|
|
888
934
|
lastPrice: state.lastPrice,
|
|
935
|
+
lastPriceAt: state.lastPriceAt,
|
|
889
936
|
seq: state.seq,
|
|
890
937
|
startSeq: state.seq,
|
|
891
938
|
endSeq: state.seq
|
|
@@ -970,7 +1017,10 @@ function normalizePrice(price) {
|
|
|
970
1017
|
levels: emittedLevels,
|
|
971
1018
|
bestBid: state.bestBid,
|
|
972
1019
|
bestAsk: state.bestAsk,
|
|
1020
|
+
bestBidAt: state.bestBidAt,
|
|
1021
|
+
bestAskAt: state.bestAskAt,
|
|
973
1022
|
lastPrice: state.lastPrice,
|
|
1023
|
+
lastPriceAt: state.lastPriceAt,
|
|
974
1024
|
seq: state.seq,
|
|
975
1025
|
startSeq: startSeq,
|
|
976
1026
|
endSeq: endSeq
|
package/dist/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@stryke-xyz/premarket-sdk","version":"1.2.
|
|
1
|
+
{"name":"@stryke-xyz/premarket-sdk","version":"1.2.8","type":"module"}
|
|
@@ -305,12 +305,41 @@ function _object_spread(target) {
|
|
|
305
305
|
{
|
|
306
306
|
key: "handleMessage",
|
|
307
307
|
value: function handleMessage(ev) {
|
|
308
|
-
var
|
|
308
|
+
var parsed;
|
|
309
309
|
try {
|
|
310
|
-
|
|
310
|
+
parsed = JSON.parse(ev.data);
|
|
311
311
|
} catch (unused) {
|
|
312
312
|
return;
|
|
313
313
|
}
|
|
314
|
+
// Support both single object and batched array (from the 5ms WS batcher).
|
|
315
|
+
var messages = Array.isArray(parsed) ? parsed : [
|
|
316
|
+
parsed
|
|
317
|
+
];
|
|
318
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
319
|
+
try {
|
|
320
|
+
for(var _iterator = messages[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
321
|
+
var msg = _step.value;
|
|
322
|
+
this.dispatchMessage(msg);
|
|
323
|
+
}
|
|
324
|
+
} catch (err) {
|
|
325
|
+
_didIteratorError = true;
|
|
326
|
+
_iteratorError = err;
|
|
327
|
+
} finally{
|
|
328
|
+
try {
|
|
329
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
330
|
+
_iterator.return();
|
|
331
|
+
}
|
|
332
|
+
} finally{
|
|
333
|
+
if (_didIteratorError) {
|
|
334
|
+
throw _iteratorError;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
key: "dispatchMessage",
|
|
342
|
+
value: function dispatchMessage(msg) {
|
|
314
343
|
var type = msg.type;
|
|
315
344
|
if (type === "pong") {
|
|
316
345
|
this.clearHeartbeatTimeout();
|
|
@@ -335,7 +364,7 @@ function _object_spread(target) {
|
|
|
335
364
|
/* noop */ return;
|
|
336
365
|
}
|
|
337
366
|
if (type === "fill" || type === "order_update") {
|
|
338
|
-
var
|
|
367
|
+
var ev = _object_spread({
|
|
339
368
|
type: type,
|
|
340
369
|
orderHash: msg.orderHash,
|
|
341
370
|
marketId: msg.marketId,
|
|
@@ -349,7 +378,7 @@ function _object_spread(target) {
|
|
|
349
378
|
var cbs = _step.value;
|
|
350
379
|
cbs.forEach(function(cb) {
|
|
351
380
|
try {
|
|
352
|
-
cb(
|
|
381
|
+
cb(ev);
|
|
353
382
|
} catch (unused) {}
|
|
354
383
|
});
|
|
355
384
|
}
|
|
@@ -247,7 +247,7 @@ function normalizePrice(price) {
|
|
|
247
247
|
if (isNaN(num)) return price;
|
|
248
248
|
return num.toString();
|
|
249
249
|
}
|
|
250
|
-
/** A market + its token IDs to subscribe to. */ /** Current depth state for a token within a market subscription. */ /** One bid or ask level change in the normalized SDK format. */ /** Raw level shape inside the wire `depth_update.levels[]` array. */ /** Raw `depth_update` frame as published by the depth projector. */ /** Consolidated depth update emitted to SDK listeners after normalization. */ /** Last applied executor sequenceId for this token (== endSeq of the frame). */ /** Range covered by this frame; clients can detect gaps via startSeq != prevSeq + 1. */ /**
|
|
250
|
+
/** A market + its token IDs to subscribe to. */ /** Current depth state for a token within a market subscription. */ /** ms epoch when lastPrice was set on the server, or null if unknown. */ /** One bid or ask level change in the normalized SDK format. */ /** Raw level shape inside the wire `depth_update.levels[]` array. */ /** Raw `depth_update` frame as published by the depth projector. */ /** Consolidated depth update emitted to SDK listeners after normalization. */ /** ms epoch when lastPrice was set on the server, or null if unknown. */ /** Last applied executor sequenceId for this token (== endSeq of the frame). */ /** Range covered by this frame; clients can detect gaps via startSeq != prevSeq + 1. */ /**
|
|
251
251
|
* Configuration for the market depth websocket client.
|
|
252
252
|
*
|
|
253
253
|
* Supports multiple markets over a single WebSocket connection.
|
|
@@ -746,12 +746,16 @@ function normalizePrice(price) {
|
|
|
746
746
|
try {
|
|
747
747
|
for(var _iterator = snapshots[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
748
748
|
var snapshot = _step.value;
|
|
749
|
+
var _snapshot_bestBidAt, _snapshot_bestAskAt, _snapshot_lastPriceAt;
|
|
749
750
|
var state = {
|
|
750
751
|
bids: new Map(),
|
|
751
752
|
asks: new Map(),
|
|
752
753
|
bestBid: snapshot.bestBid,
|
|
753
754
|
bestAsk: snapshot.bestAsk,
|
|
755
|
+
bestBidAt: (_snapshot_bestBidAt = snapshot.bestBidAt) !== null && _snapshot_bestBidAt !== void 0 ? _snapshot_bestBidAt : null,
|
|
756
|
+
bestAskAt: (_snapshot_bestAskAt = snapshot.bestAskAt) !== null && _snapshot_bestAskAt !== void 0 ? _snapshot_bestAskAt : null,
|
|
754
757
|
lastPrice: snapshot.lastPrice,
|
|
758
|
+
lastPriceAt: (_snapshot_lastPriceAt = snapshot.lastPriceAt) !== null && _snapshot_lastPriceAt !== void 0 ? _snapshot_lastPriceAt : null,
|
|
755
759
|
seq: snapshot.seq
|
|
756
760
|
};
|
|
757
761
|
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
@@ -847,24 +851,64 @@ function normalizePrice(price) {
|
|
|
847
851
|
{
|
|
848
852
|
key: "handleMarketStateUpdate",
|
|
849
853
|
value: function handleMarketStateUpdate(msg) {
|
|
850
|
-
var _msg_bestBid, _msg_bestAsk, _msg_lastPrice;
|
|
851
854
|
var state = this.tokenStates.get(String(msg.tokenId));
|
|
852
855
|
if (!state) return;
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
+
if (msg.bestBid != null) {
|
|
857
|
+
var _msg_bestBidAt;
|
|
858
|
+
state.bestBid = msg.bestBid;
|
|
859
|
+
state.bestBidAt = (_msg_bestBidAt = msg.bestBidAt) !== null && _msg_bestBidAt !== void 0 ? _msg_bestBidAt : state.bestBidAt;
|
|
860
|
+
}
|
|
861
|
+
if (msg.bestAsk != null) {
|
|
862
|
+
var _msg_bestAskAt;
|
|
863
|
+
state.bestAsk = msg.bestAsk;
|
|
864
|
+
state.bestAskAt = (_msg_bestAskAt = msg.bestAskAt) !== null && _msg_bestAskAt !== void 0 ? _msg_bestAskAt : state.bestAskAt;
|
|
865
|
+
}
|
|
866
|
+
if (msg.lastPrice != null) {
|
|
867
|
+
var _msg_lastPriceAt;
|
|
868
|
+
state.lastPrice = msg.lastPrice;
|
|
869
|
+
state.lastPriceAt = (_msg_lastPriceAt = msg.lastPriceAt) !== null && _msg_lastPriceAt !== void 0 ? _msg_lastPriceAt : state.lastPriceAt;
|
|
870
|
+
}
|
|
856
871
|
this.emitOutOfBandUpdate(msg.marketId, msg.tokenId, state);
|
|
857
872
|
}
|
|
858
873
|
},
|
|
859
874
|
{
|
|
860
875
|
key: "handleLastPriceUpdate",
|
|
861
|
-
value: function handleLastPriceUpdate(msg) {
|
|
876
|
+
value: function handleLastPriceUpdate(msg) /** New batched format: all fill prices in this flush window. */ /** Legacy single-price format. */ {
|
|
862
877
|
var _ref, _msg_marketId;
|
|
863
878
|
var state = this.tokenStates.get(String(msg.tokenId));
|
|
864
879
|
if (!state) return;
|
|
865
|
-
state.lastPrice = msg.lastPrice;
|
|
866
880
|
var marketId = (_ref = (_msg_marketId = msg.marketId) !== null && _msg_marketId !== void 0 ? _msg_marketId : this.tokenToMarket.get(msg.tokenId)) !== null && _ref !== void 0 ? _ref : "";
|
|
867
|
-
|
|
881
|
+
if (msg.prices && msg.prices.length > 0) {
|
|
882
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
883
|
+
try {
|
|
884
|
+
// Emit one DepthUpdate per price so listeners see every fill price.
|
|
885
|
+
for(var _iterator = msg.prices[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
886
|
+
var entry = _step.value;
|
|
887
|
+
state.lastPrice = entry.price;
|
|
888
|
+
state.lastPriceAt = entry.at;
|
|
889
|
+
this.emitOutOfBandUpdate(marketId, msg.tokenId, state);
|
|
890
|
+
}
|
|
891
|
+
} catch (err) {
|
|
892
|
+
_didIteratorError = true;
|
|
893
|
+
_iteratorError = err;
|
|
894
|
+
} finally{
|
|
895
|
+
try {
|
|
896
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
897
|
+
_iterator.return();
|
|
898
|
+
}
|
|
899
|
+
} finally{
|
|
900
|
+
if (_didIteratorError) {
|
|
901
|
+
throw _iteratorError;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
} else if (msg.lastPrice != null) {
|
|
906
|
+
var _msg_lastPriceAt;
|
|
907
|
+
// Legacy single-price fallback.
|
|
908
|
+
state.lastPrice = msg.lastPrice;
|
|
909
|
+
state.lastPriceAt = (_msg_lastPriceAt = msg.lastPriceAt) !== null && _msg_lastPriceAt !== void 0 ? _msg_lastPriceAt : state.lastPriceAt;
|
|
910
|
+
this.emitOutOfBandUpdate(marketId, msg.tokenId, state);
|
|
911
|
+
}
|
|
868
912
|
}
|
|
869
913
|
},
|
|
870
914
|
{
|
|
@@ -875,7 +919,10 @@ function normalizePrice(price) {
|
|
|
875
919
|
levels: [],
|
|
876
920
|
bestBid: state.bestBid,
|
|
877
921
|
bestAsk: state.bestAsk,
|
|
922
|
+
bestBidAt: state.bestBidAt,
|
|
923
|
+
bestAskAt: state.bestAskAt,
|
|
878
924
|
lastPrice: state.lastPrice,
|
|
925
|
+
lastPriceAt: state.lastPriceAt,
|
|
879
926
|
seq: state.seq,
|
|
880
927
|
startSeq: state.seq,
|
|
881
928
|
endSeq: state.seq
|
|
@@ -960,7 +1007,10 @@ function normalizePrice(price) {
|
|
|
960
1007
|
levels: emittedLevels,
|
|
961
1008
|
bestBid: state.bestBid,
|
|
962
1009
|
bestAsk: state.bestAsk,
|
|
1010
|
+
bestBidAt: state.bestBidAt,
|
|
1011
|
+
bestAskAt: state.bestAskAt,
|
|
963
1012
|
lastPrice: state.lastPrice,
|
|
1013
|
+
lastPriceAt: state.lastPriceAt,
|
|
964
1014
|
seq: state.seq,
|
|
965
1015
|
startSeq: startSeq,
|
|
966
1016
|
endSeq: endSeq
|
|
@@ -15,7 +15,11 @@ export interface TokenDepthSnapshot {
|
|
|
15
15
|
asks: DepthLevel[];
|
|
16
16
|
bestBid: string | null;
|
|
17
17
|
bestAsk: string | null;
|
|
18
|
+
bestBidAt: number | null;
|
|
19
|
+
bestAskAt: number | null;
|
|
18
20
|
lastPrice: string | null;
|
|
21
|
+
/** ms epoch when lastPrice was set on the server, or null if unknown. */
|
|
22
|
+
lastPriceAt: number | null;
|
|
19
23
|
seq: number;
|
|
20
24
|
}
|
|
21
25
|
/** One bid or ask level change in the normalized SDK format. */
|
|
@@ -30,7 +34,11 @@ export interface DepthUpdate {
|
|
|
30
34
|
levels: DepthLevelUpdate[];
|
|
31
35
|
bestBid: string | null;
|
|
32
36
|
bestAsk: string | null;
|
|
37
|
+
bestBidAt: number | null;
|
|
38
|
+
bestAskAt: number | null;
|
|
33
39
|
lastPrice: string | null;
|
|
40
|
+
/** ms epoch when lastPrice was set on the server, or null if unknown. */
|
|
41
|
+
lastPriceAt: number | null;
|
|
34
42
|
/** Last applied executor sequenceId for this token (== endSeq of the frame). */
|
|
35
43
|
seq: number;
|
|
36
44
|
/** Range covered by this frame; clients can detect gaps via startSeq != prevSeq + 1. */
|