patch indicative liquidity filtering
This commit is contained in:
@@ -227,20 +227,20 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (quote['bid_size'] && quote['bid_price'] != null) {
|
if (quote['bid_size'] && quote['bid_price'] != null) {
|
||||||
// Sanity check bid price and size
|
// Sanity check bid price and size and change to top of book if necessary
|
||||||
const indicativeBid: Order = Object.assign(
|
let indicativeBid: Order = Object.assign(
|
||||||
{},
|
{},
|
||||||
indicativeBaseOrder,
|
indicativeBaseOrder,
|
||||||
{
|
{
|
||||||
orderId: indicativeOrderId,
|
orderId: indicativeOrderId,
|
||||||
|
direction: PositionDirection.LONG,
|
||||||
|
baseAssetAmount: new BN(quote['bid_size']),
|
||||||
oraclePriceOffset: quote['is_oracle_offset']
|
oraclePriceOffset: quote['is_oracle_offset']
|
||||||
? quote['bid_price']
|
? quote['bid_price']
|
||||||
: 0,
|
: 0,
|
||||||
price: quote['is_oracle_offset']
|
price: quote['is_oracle_offset']
|
||||||
? 0
|
? 0
|
||||||
: new BN(quote['bid_price']),
|
: new BN(quote['bid_price']),
|
||||||
baseAssetAmount: new BN(quote['bid_size']),
|
|
||||||
direction: PositionDirection.LONG,
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const limitPrice = getLimitPrice(
|
const limitPrice = getLimitPrice(
|
||||||
@@ -248,7 +248,12 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
|
|||||||
oraclePriceData,
|
oraclePriceData,
|
||||||
this.slotSource.getSlot()
|
this.slotSource.getSlot()
|
||||||
);
|
);
|
||||||
if (limitPrice.lte(bestBid)) {
|
if (limitPrice.gt(bestBid)) {
|
||||||
|
indicativeBid = Object.assign({}, indicativeBid, {
|
||||||
|
price: bestBid,
|
||||||
|
oraclePriceOffset: 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
this.dlob.insertOrder(
|
this.dlob.insertOrder(
|
||||||
indicativeBid,
|
indicativeBid,
|
||||||
INDICATIVE_QUOTES_PUBKEY,
|
INDICATIVE_QUOTES_PUBKEY,
|
||||||
@@ -257,9 +262,8 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
|
|||||||
);
|
);
|
||||||
indicativeOrderId += 1;
|
indicativeOrderId += 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (quote['ask_size'] && quote['ask_price'] != null) {
|
if (quote['ask_size'] && quote['ask_price'] != null) {
|
||||||
const indicativeAsk: Order = Object.assign(
|
let indicativeAsk: Order = Object.assign(
|
||||||
{},
|
{},
|
||||||
indicativeBaseOrder,
|
indicativeBaseOrder,
|
||||||
{
|
{
|
||||||
@@ -279,7 +283,12 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
|
|||||||
oraclePriceData,
|
oraclePriceData,
|
||||||
this.slotSource.getSlot()
|
this.slotSource.getSlot()
|
||||||
);
|
);
|
||||||
if (limitPrice.gte(bestAsk)) {
|
if (limitPrice.lt(bestAsk)) {
|
||||||
|
indicativeAsk = Object.assign({}, indicativeAsk, {
|
||||||
|
price: bestAsk,
|
||||||
|
oraclePriceOffset: 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
this.dlob.insertOrder(
|
this.dlob.insertOrder(
|
||||||
indicativeAsk,
|
indicativeAsk,
|
||||||
INDICATIVE_QUOTES_PUBKEY,
|
INDICATIVE_QUOTES_PUBKEY,
|
||||||
@@ -290,7 +299,6 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('skipping mmQuote: ', error);
|
console.log('skipping mmQuote: ', error);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user