new market staleness
This commit is contained in:
@@ -27,7 +27,8 @@ type wsMarketL2Args = {
|
|||||||
updateOnChange?: boolean;
|
updateOnChange?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const MAKRET_STALENESS_THRESHOLD = 10 * 60 * 1000;
|
const PERP_MAKRET_STALENESS_THRESHOLD = 10 * 60 * 1000;
|
||||||
|
const SPOT_MAKRET_STALENESS_THRESHOLD = 20 * 60 * 1000;
|
||||||
|
|
||||||
export type wsMarketInfo = {
|
export type wsMarketInfo = {
|
||||||
marketIndex: number;
|
marketIndex: number;
|
||||||
@@ -180,6 +181,10 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if times and slots are too different for market
|
// Check if times and slots are too different for market
|
||||||
|
const MAKRET_STALENESS_THRESHOLD =
|
||||||
|
marketType === 'perp'
|
||||||
|
? PERP_MAKRET_STALENESS_THRESHOLD
|
||||||
|
: SPOT_MAKRET_STALENESS_THRESHOLD;
|
||||||
if (
|
if (
|
||||||
lastMarketSlotAndTime &&
|
lastMarketSlotAndTime &&
|
||||||
l2Formatted['marketSlot'] === lastMarketSlotAndTime.slot &&
|
l2Formatted['marketSlot'] === lastMarketSlotAndTime.slot &&
|
||||||
@@ -197,9 +202,7 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
|
|||||||
console.log(
|
console.log(
|
||||||
`Updating market slot for ${l2Args.marketName} with slot ${l2Formatted['marketSlot']}`
|
`Updating market slot for ${l2Args.marketName} with slot ${l2Formatted['marketSlot']}`
|
||||||
);
|
);
|
||||||
this.lastMarketSlotMap
|
this.lastMarketSlotMap.get(l2Args.marketType).set(l2Args.marketIndex, {
|
||||||
.get(l2Args.marketType)
|
|
||||||
.set(l2Args.marketIndex, {
|
|
||||||
slot: l2Formatted['marketSlot'],
|
slot: l2Formatted['marketSlot'],
|
||||||
ts: Date.now(),
|
ts: Date.now(),
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user