Merge pull request #51 from drift-labs/phoenix-fix

phoenix fix
This commit is contained in:
Nour Alharithi
2023-12-12 14:53:46 -08:00
committed by GitHub
2 changed files with 38 additions and 4 deletions

View File

@@ -168,7 +168,16 @@ const initializeAllMarketSubscribers = async (driftClient: DriftClient) => {
sdkConfig sdkConfig
); );
await phoenixSubscriber.subscribe(); await phoenixSubscriber.subscribe();
// Test get L2 to know if we should add
try {
phoenixSubscriber.getL2Asks();
phoenixSubscriber.getL2Bids();
markets[market.marketIndex].phoenix = phoenixSubscriber; markets[market.marketIndex].phoenix = phoenixSubscriber;
} catch (e) {
logger.info(
`Excluding phoenix for ${market.marketIndex}, error: ${e}`
);
}
} }
} }
@@ -183,7 +192,15 @@ const initializeAllMarketSubscribers = async (driftClient: DriftClient) => {
sdkConfig sdkConfig
); );
await serumSubscriber.subscribe(); await serumSubscriber.subscribe();
try {
serumSubscriber.getL2Asks();
serumSubscriber.getL2Bids();
markets[market.marketIndex].serum = serumSubscriber; markets[market.marketIndex].serum = serumSubscriber;
} catch (e) {
logger.info(
`Excluding phoenix for ${market.marketIndex}, error: ${e}`
);
}
} }
} }
} }

View File

@@ -89,7 +89,16 @@ const initializeAllMarketSubscribers = async (driftClient: DriftClient) => {
sdkConfig sdkConfig
); );
await phoenixSubscriber.subscribe(); await phoenixSubscriber.subscribe();
// Test get L2 to know if we should add
try {
phoenixSubscriber.getL2Asks();
phoenixSubscriber.getL2Bids();
markets[market.marketIndex].phoenix = phoenixSubscriber; markets[market.marketIndex].phoenix = phoenixSubscriber;
} catch (e) {
logger.info(
`Excluding phoenix for ${market.marketIndex}, error: ${e}`
);
}
} }
} }
@@ -104,7 +113,15 @@ const initializeAllMarketSubscribers = async (driftClient: DriftClient) => {
sdkConfig sdkConfig
); );
await serumSubscriber.subscribe(); await serumSubscriber.subscribe();
try {
serumSubscriber.getL2Asks();
serumSubscriber.getL2Bids();
markets[market.marketIndex].serum = serumSubscriber; markets[market.marketIndex].serum = serumSubscriber;
} catch (e) {
logger.info(
`Excluding phoenix for ${market.marketIndex}, error: ${e}`
);
}
} }
} }
} }