add indicative in l2 queries
This commit is contained in:
@@ -144,7 +144,6 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
|
|||||||
const mms = await this.indicativeQuotesRedisClient.smembers(
|
const mms = await this.indicativeQuotesRedisClient.smembers(
|
||||||
`market_mms_${marketType}_${marketArgs.marketIndex}`
|
`market_mms_${marketType}_${marketArgs.marketIndex}`
|
||||||
);
|
);
|
||||||
console.log(mms);
|
|
||||||
const mmQuotes = await Promise.all(
|
const mmQuotes = await Promise.all(
|
||||||
mms.map((mm) => {
|
mms.map((mm) => {
|
||||||
return this.indicativeQuotesRedisClient.get(
|
return this.indicativeQuotesRedisClient.get(
|
||||||
|
|||||||
26
src/index.ts
26
src/index.ts
@@ -521,7 +521,7 @@ const main = async (): Promise<void> => {
|
|||||||
|
|
||||||
app.get('/l2', async (req, res, next) => {
|
app.get('/l2', async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const { marketName, marketIndex, marketType, depth, includePmm } =
|
const { marketName, marketIndex, marketType, depth, includeIndicative } =
|
||||||
req.query;
|
req.query;
|
||||||
|
|
||||||
const { normedMarketType, normedMarketIndex, error } = validateDlobQuery(
|
const { normedMarketType, normedMarketIndex, error } = validateDlobQuery(
|
||||||
@@ -537,14 +537,15 @@ const main = async (): Promise<void> => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isSpot = isVariant(normedMarketType, 'spot');
|
const isSpot = isVariant(normedMarketType, 'spot');
|
||||||
const includePmmStr = (includePmm as string)?.toLowerCase() === 'true';
|
const includeIndicativeStr =
|
||||||
|
(includeIndicative as string)?.toLowerCase() === 'true';
|
||||||
const adjustedDepth = depth ?? '100';
|
const adjustedDepth = depth ?? '100';
|
||||||
|
|
||||||
let l2Formatted: any;
|
let l2Formatted: any;
|
||||||
const redisL2 = await fetchFromRedis(
|
const redisL2 = await fetchFromRedis(
|
||||||
`last_update_orderbook_${
|
`last_update_orderbook_${
|
||||||
isSpot ? 'spot' : 'perp'
|
isSpot ? 'spot' : 'perp'
|
||||||
}_${normedMarketIndex}${includePmmStr ? '_pmm' : ''}`,
|
}_${normedMarketIndex}${includeIndicativeStr ? '_indicative' : ''}`,
|
||||||
selectMostRecentBySlot
|
selectMostRecentBySlot
|
||||||
);
|
);
|
||||||
const depthToUse = Math.min(parseInt(adjustedDepth as string) ?? 1, 100);
|
const depthToUse = Math.min(parseInt(adjustedDepth as string) ?? 1, 100);
|
||||||
@@ -606,7 +607,7 @@ const main = async (): Promise<void> => {
|
|||||||
includePhoenix,
|
includePhoenix,
|
||||||
includeOpenbook,
|
includeOpenbook,
|
||||||
includeOracle,
|
includeOracle,
|
||||||
includePmm,
|
includeIndicative,
|
||||||
} = req.query;
|
} = req.query;
|
||||||
|
|
||||||
const normedParams = normalizeBatchQueryParams({
|
const normedParams = normalizeBatchQueryParams({
|
||||||
@@ -618,7 +619,7 @@ const main = async (): Promise<void> => {
|
|||||||
includePhoenix: includePhoenix as string | undefined,
|
includePhoenix: includePhoenix as string | undefined,
|
||||||
includeOpenbook: includeOpenbook as string | undefined,
|
includeOpenbook: includeOpenbook as string | undefined,
|
||||||
includeOracle: includeOracle as string | undefined,
|
includeOracle: includeOracle as string | undefined,
|
||||||
includePmm: includePmm as string | undefined,
|
includeIndicative: includeIndicative as string | undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (normedParams === undefined) {
|
if (normedParams === undefined) {
|
||||||
@@ -649,14 +650,17 @@ const main = async (): Promise<void> => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isSpot = isVariant(normedMarketType, 'spot');
|
const isSpot = isVariant(normedMarketType, 'spot');
|
||||||
const normedIncludePmm = normedParam['includePmm'] == 'true';
|
const normedIncludeIndicative =
|
||||||
|
normedParam['includeIndicative'] == 'true';
|
||||||
|
|
||||||
const adjustedDepth = normedParam['depth'] ?? '100';
|
const adjustedDepth = normedParam['depth'] ?? '100';
|
||||||
let l2Formatted: any;
|
let l2Formatted: any;
|
||||||
const redisL2 = await fetchFromRedis(
|
const redisL2 = await fetchFromRedis(
|
||||||
`last_update_orderbook_${
|
`last_update_orderbook_${
|
||||||
isSpot ? 'spot' : 'perp'
|
isSpot ? 'spot' : 'perp'
|
||||||
}_${normedMarketIndex}${normedIncludePmm ? '_pmm' : ''}`,
|
}_${normedMarketIndex}${
|
||||||
|
normedIncludeIndicative ? '_indicative' : ''
|
||||||
|
}`,
|
||||||
selectMostRecentBySlot
|
selectMostRecentBySlot
|
||||||
);
|
);
|
||||||
const depth = Math.min(parseInt(adjustedDepth as string) ?? 1, 100);
|
const depth = Math.min(parseInt(adjustedDepth as string) ?? 1, 100);
|
||||||
@@ -726,7 +730,8 @@ const main = async (): Promise<void> => {
|
|||||||
|
|
||||||
app.get('/l3', async (req, res, next) => {
|
app.get('/l3', async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const { marketName, marketIndex, marketType, includePmm } = req.query;
|
const { marketName, marketIndex, marketType, includeIndicative } =
|
||||||
|
req.query;
|
||||||
|
|
||||||
const { normedMarketType, normedMarketIndex, error } = validateDlobQuery(
|
const { normedMarketType, normedMarketIndex, error } = validateDlobQuery(
|
||||||
driftClient,
|
driftClient,
|
||||||
@@ -741,11 +746,12 @@ const main = async (): Promise<void> => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const marketTypeStr = getVariant(normedMarketType);
|
const marketTypeStr = getVariant(normedMarketType);
|
||||||
const normedIncludePmm = (includePmm as string)?.toLowerCase() === 'true';
|
const normedIncludeIndicative =
|
||||||
|
(includeIndicative as string)?.toLowerCase() === 'true';
|
||||||
|
|
||||||
const redisL3 = await fetchFromRedis(
|
const redisL3 = await fetchFromRedis(
|
||||||
`last_update_orderbook_l3_${marketTypeStr}_${normedMarketIndex}${
|
`last_update_orderbook_l3_${marketTypeStr}_${normedMarketIndex}${
|
||||||
normedIncludePmm ? '_pmm' : ''
|
normedIncludeIndicative ? '_indicative' : ''
|
||||||
}`,
|
}`,
|
||||||
selectMostRecentBySlot
|
selectMostRecentBySlot
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user