use paused operation (#239)
* update non-cached to use safeguards for include vamm * use paused operation
This commit is contained in:
@@ -4,7 +4,9 @@ import {
|
|||||||
DriftEnv,
|
DriftEnv,
|
||||||
L2OrderBookGenerator,
|
L2OrderBookGenerator,
|
||||||
MarketType,
|
MarketType,
|
||||||
|
PerpOperation,
|
||||||
PositionDirection,
|
PositionDirection,
|
||||||
|
isOperationPaused,
|
||||||
isVariant,
|
isVariant,
|
||||||
} from '@drift-labs/sdk';
|
} from '@drift-labs/sdk';
|
||||||
import { RedisClient } from '@drift/common';
|
import { RedisClient } from '@drift/common';
|
||||||
@@ -86,9 +88,10 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
|
|||||||
const perpMarket = this.driftClient.getPerpMarketAccount(
|
const perpMarket = this.driftClient.getPerpMarketAccount(
|
||||||
market.marketIndex
|
market.marketIndex
|
||||||
);
|
);
|
||||||
const includeVamm =
|
const includeVamm = !isOperationPaused(
|
||||||
!isVariant(perpMarket.status, 'ammPaused') &&
|
perpMarket.pausedOperations,
|
||||||
!isVariant(perpMarket.status, 'initialized');
|
PerpOperation.AMM_FILL
|
||||||
|
);
|
||||||
|
|
||||||
this.marketArgs.push({
|
this.marketArgs.push({
|
||||||
marketIndex: market.marketIndex,
|
marketIndex: market.marketIndex,
|
||||||
|
|||||||
25
src/index.ts
25
src/index.ts
@@ -20,6 +20,8 @@ import {
|
|||||||
MarketType,
|
MarketType,
|
||||||
PhoenixSubscriber,
|
PhoenixSubscriber,
|
||||||
BulkAccountLoader,
|
BulkAccountLoader,
|
||||||
|
isOperationPaused,
|
||||||
|
PerpOperation,
|
||||||
} from '@drift-labs/sdk';
|
} from '@drift-labs/sdk';
|
||||||
import { RedisClient, RedisClientPrefix } from '@drift/common';
|
import { RedisClient, RedisClientPrefix } from '@drift/common';
|
||||||
|
|
||||||
@@ -774,11 +776,19 @@ const main = async (): Promise<void> => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let validateIncludeVamm = false;
|
||||||
|
if (!isSpot && `${includeVamm}`.toLowerCase() === 'true') {
|
||||||
|
const perpMarket = driftClient.getPerpMarketAccount(normedMarketIndex);
|
||||||
|
validateIncludeVamm = !isOperationPaused(
|
||||||
|
perpMarket.pausedOperations,
|
||||||
|
PerpOperation.AMM_FILL
|
||||||
|
);
|
||||||
|
}
|
||||||
const l2 = dlobSubscriber.getL2({
|
const l2 = dlobSubscriber.getL2({
|
||||||
marketIndex: normedMarketIndex,
|
marketIndex: normedMarketIndex,
|
||||||
marketType: normedMarketType,
|
marketType: normedMarketType,
|
||||||
depth: parseInt(adjustedDepth as string),
|
depth: parseInt(adjustedDepth as string),
|
||||||
includeVamm: isSpot ? false : `${includeVamm}`.toLowerCase() === 'true',
|
includeVamm: validateIncludeVamm,
|
||||||
numVammOrders: parseInt((numVammOrders ?? '100') as string),
|
numVammOrders: parseInt((numVammOrders ?? '100') as string),
|
||||||
fallbackL2Generators: isSpot
|
fallbackL2Generators: isSpot
|
||||||
? [
|
? [
|
||||||
@@ -938,13 +948,20 @@ const main = async (): Promise<void> => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let validateIncludeVamm = false;
|
||||||
|
if (!isSpot && `${includeVamm}`.toLowerCase() === 'true') {
|
||||||
|
const perpMarket =
|
||||||
|
driftClient.getPerpMarketAccount(normedMarketIndex);
|
||||||
|
validateIncludeVamm = !isOperationPaused(
|
||||||
|
perpMarket.pausedOperations,
|
||||||
|
PerpOperation.AMM_FILL
|
||||||
|
);
|
||||||
|
}
|
||||||
const l2 = dlobSubscriber.getL2({
|
const l2 = dlobSubscriber.getL2({
|
||||||
marketIndex: normedMarketIndex,
|
marketIndex: normedMarketIndex,
|
||||||
marketType: normedMarketType,
|
marketType: normedMarketType,
|
||||||
depth: parseInt(adjustedDepth as string),
|
depth: parseInt(adjustedDepth as string),
|
||||||
includeVamm: isSpot
|
includeVamm: validateIncludeVamm,
|
||||||
? false
|
|
||||||
: `${normedParam['includeVamm']}`.toLowerCase() === 'true',
|
|
||||||
fallbackL2Generators: isSpot
|
fallbackL2Generators: isSpot
|
||||||
? [
|
? [
|
||||||
`${normedParam['includePhoenix']}`.toLowerCase() === 'true' &&
|
`${normedParam['includePhoenix']}`.toLowerCase() === 'true' &&
|
||||||
|
|||||||
Reference in New Issue
Block a user