fix isSpot check

This commit is contained in:
wphan
2023-05-31 17:18:59 -07:00
parent e80ec8bcdd
commit 0b50e4894a

View File

@@ -28,7 +28,8 @@ import {
PhoenixSubscriber,
SerumSubscriber,
DLOBNode,
} from "@drift-labs/sdk";
isVariant,
} from '@drift-labs/sdk';
import { Mutex } from 'async-mutex';
@@ -498,7 +499,7 @@ const main = async () => {
const userAccount = user.getUserAccount();
for (const order of userAccount.orders) {
if (getVariant(order.status) === 'init') {
if (isVariant(order.status, 'init')) {
continue;
}
@@ -553,7 +554,7 @@ const main = async () => {
const userAccount = user.getUserAccount();
for (const order of userAccount.orders) {
if (getVariant(order.status) === 'init') {
if (isVariant(order.status, 'init')) {
continue;
}
@@ -617,7 +618,7 @@ const main = async () => {
const userAccount = user.getUserAccount();
for (const order of userAccount.orders) {
if (getVariant(order.status) === 'init') {
if (isVariant(order.status, 'init')) {
continue;
}
@@ -665,7 +666,7 @@ const main = async () => {
const userAccount = user.getUserAccount();
for (const order of userAccount.orders) {
if (getVariant(order.status) === 'init') {
if (isVariant(order.status, 'init')) {
continue;
}
@@ -769,7 +770,7 @@ const main = async () => {
};
};
app.get("/topMakers", handleResponseTime, async (req, res, next) => {
app.get('/topMakers', handleResponseTime, async (req, res, next) => {
try {
const {
marketName,
@@ -789,8 +790,8 @@ const main = async () => {
return;
}
if (side !== "bid" && side !== "ask") {
res.status(400).send("Bad Request: side must be either bid or ask");
if (side !== 'bid' && side !== 'ask') {
res.status(400).send('Bad Request: side must be either bid or ask');
return;
}
const normedSide = (side as string).toLowerCase();
@@ -801,7 +802,7 @@ const main = async () => {
if (isNaN(parseInt(limit as string))) {
res
.status(400)
.send("Bad Request: limit must be a number if supplied");
.send('Bad Request: limit must be a number if supplied');
return;
}
normedLimit = parseInt(limit as string);
@@ -828,7 +829,7 @@ const main = async () => {
}
};
if (normedSide === "bid") {
if (normedSide === 'bid') {
findMakers(
dlobSubscriber
.getDLOB()
@@ -859,7 +860,7 @@ const main = async () => {
}
});
app.get("/l2", handleResponseTime, async (req, res, next) => {
app.get('/l2', handleResponseTime, async (req, res, next) => {
try {
const {
marketName,
@@ -881,7 +882,7 @@ const main = async () => {
return;
}
const isSpot = getVariant(normedMarketType);
const isSpot = isVariant(normedMarketType, 'spot');
const l2 = await dlobSubscriber.getL2({
marketIndex: normedMarketIndex,