From cfc6be13dd61c8f9827647fb51a146dd028ed24e Mon Sep 17 00:00:00 2001 From: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 14 Jun 2025 20:04:47 +0000 Subject: [PATCH 1/3] Bumping drift-common to 8b7c08399884187bb1f26f8677c8d3f79e2aabef --- drift-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drift-common b/drift-common index 07742d4..8b7c083 160000 --- a/drift-common +++ b/drift-common @@ -1 +1 @@ -Subproject commit 07742d4316758dcfbfe033a376824ac764cf41b8 +Subproject commit 8b7c08399884187bb1f26f8677c8d3f79e2aabef From 48c0b3ba75a64353d63f16ba58a76ebc7b5d0101 Mon Sep 17 00:00:00 2001 From: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 15 Jun 2025 00:08:22 +0000 Subject: [PATCH 2/3] Bumping drift-common to 1320cf2211259c210e2ee0b71b39d246238d4e8b --- drift-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drift-common b/drift-common index 8b7c083..1320cf2 160000 --- a/drift-common +++ b/drift-common @@ -1 +1 @@ -Subproject commit 8b7c08399884187bb1f26f8677c8d3f79e2aabef +Subproject commit 1320cf2211259c210e2ee0b71b39d246238d4e8b From c6c1ef2838eacf9386c8eceb7dab79f8ea7da06b Mon Sep 17 00:00:00 2001 From: Nick Caradonna Date: Sun, 15 Jun 2025 10:53:19 -0400 Subject: [PATCH 3/3] try catch in mmQuotes loop --- src/dlob-subscriber/DLOBSubscriberIO.ts | 162 ++++++++++++------------ 1 file changed, 83 insertions(+), 79 deletions(-) diff --git a/src/dlob-subscriber/DLOBSubscriberIO.ts b/src/dlob-subscriber/DLOBSubscriberIO.ts index 5acbc7a..b023028 100644 --- a/src/dlob-subscriber/DLOBSubscriberIO.ts +++ b/src/dlob-subscriber/DLOBSubscriberIO.ts @@ -155,88 +155,92 @@ export class DLOBSubscriberIO extends DLOBSubscriber { const nowMinus1000Ms = Date.now() - 1000; for (const quote of mmQuotes) { - if (Number(quote['ts']) > nowMinus1000Ms) { - const indicativeBaseOrder: Order = { - status: OrderStatus.OPEN, - orderType: OrderType.LIMIT, - orderId: 0, - slot: new BN(this.slotSource.getSlot()), - marketIndex: marketArgs.marketIndex, - marketType: marketArgs.marketType, - baseAssetAmount: ZERO, - immediateOrCancel: false, - direction: PositionDirection.LONG, - oraclePriceOffset: 0, - maxTs: new BN(quote['ts'] + 1000), - reduceOnly: false, - triggerCondition: OrderTriggerCondition.ABOVE, - price: ZERO, - userOrderId: 0, - postOnly: true, - auctionDuration: 0, - auctionStartPrice: ZERO, - auctionEndPrice: ZERO, - // Rest are not necessary and set for type conforming - existingPositionDirection: PositionDirection.LONG, - triggerPrice: ZERO, - baseAssetAmountFilled: ZERO, - quoteAssetAmountFilled: ZERO, - quoteAssetAmount: ZERO, - bitFlags: 0, - postedSlotTail: 0, - }; + try { + if (Number(quote['ts']) > nowMinus1000Ms) { + const indicativeBaseOrder: Order = { + status: OrderStatus.OPEN, + orderType: OrderType.LIMIT, + orderId: 0, + slot: new BN(this.slotSource.getSlot()), + marketIndex: marketArgs.marketIndex, + marketType: marketArgs.marketType, + baseAssetAmount: ZERO, + immediateOrCancel: false, + direction: PositionDirection.LONG, + oraclePriceOffset: 0, + maxTs: new BN(quote['ts'] + 1000), + reduceOnly: false, + triggerCondition: OrderTriggerCondition.ABOVE, + price: ZERO, + userOrderId: 0, + postOnly: true, + auctionDuration: 0, + auctionStartPrice: ZERO, + auctionEndPrice: ZERO, + // Rest are not necessary and set for type conforming + existingPositionDirection: PositionDirection.LONG, + triggerPrice: ZERO, + baseAssetAmountFilled: ZERO, + quoteAssetAmountFilled: ZERO, + quoteAssetAmount: ZERO, + bitFlags: 0, + postedSlotTail: 0, + }; - if (quote['bid_size'] && quote['bid_price'] != null) { - // Sanity check bid price and size + if (quote['bid_size'] && quote['bid_price'] != null) { + // Sanity check bid price and size - const indicativeBid: Order = Object.assign( - {}, - indicativeBaseOrder, - { - orderId: indicativeOrderId, - oraclePriceOffset: quote['is_oracle_offset'] - ? quote['bid_price'] - : 0, - price: quote['is_oracle_offset'] - ? 0 - : new BN(quote['bid_price']), - baseAssetAmount: new BN(quote['bid_size']), - direction: PositionDirection.LONG, - } - ); - this.dlob.insertOrder( - indicativeBid, - INDICATIVE_QUOTES_PUBKEY, - this.slotSource.getSlot(), - false - ); - indicativeOrderId += 1; - } - - if (quote['ask_size'] && quote['ask_price'] != null) { - const indicativeAsk: Order = Object.assign( - {}, - indicativeBaseOrder, - { - orderId: indicativeOrderId, - oraclePriceOffset: quote['is_oracle_offset'] - ? quote['ask_price'] - : 0, - price: quote['is_oracle_offset'] - ? 0 - : new BN(quote['ask_price']), - baseAssetAmount: new BN(quote['ask_size']), - direction: PositionDirection.SHORT, - } - ); - this.dlob.insertOrder( - indicativeAsk, - INDICATIVE_QUOTES_PUBKEY, - this.slotSource.getSlot(), - false - ); - indicativeOrderId += 1; + const indicativeBid: Order = Object.assign( + {}, + indicativeBaseOrder, + { + orderId: indicativeOrderId, + oraclePriceOffset: quote['is_oracle_offset'] + ? quote['bid_price'] + : 0, + price: quote['is_oracle_offset'] + ? 0 + : new BN(quote['bid_price']), + baseAssetAmount: new BN(quote['bid_size']), + direction: PositionDirection.LONG, + } + ); + this.dlob.insertOrder( + indicativeBid, + INDICATIVE_QUOTES_PUBKEY, + this.slotSource.getSlot(), + false + ); + indicativeOrderId += 1; + } + + if (quote['ask_size'] && quote['ask_price'] != null) { + const indicativeAsk: Order = Object.assign( + {}, + indicativeBaseOrder, + { + orderId: indicativeOrderId, + oraclePriceOffset: quote['is_oracle_offset'] + ? quote['ask_price'] + : 0, + price: quote['is_oracle_offset'] + ? 0 + : new BN(quote['ask_price']), + baseAssetAmount: new BN(quote['ask_size']), + direction: PositionDirection.SHORT, + } + ); + this.dlob.insertOrder( + indicativeAsk, + INDICATIVE_QUOTES_PUBKEY, + this.slotSource.getSlot(), + false + ); + indicativeOrderId += 1; + } } + } catch (error) { + console.log('skipping mmQuote: ', error); } } }