comment out indicative liq
This commit is contained in:
@@ -137,109 +137,109 @@ export class DLOBSubscriberIO extends DLOBSubscriber {
|
|||||||
let indicativeOrderId = 0;
|
let indicativeOrderId = 0;
|
||||||
for (const marketArgs of this.marketArgs) {
|
for (const marketArgs of this.marketArgs) {
|
||||||
try {
|
try {
|
||||||
if (this.indicativeQuotesRedisClient) {
|
// if (this.indicativeQuotesRedisClient) {
|
||||||
const marketType = isVariant(marketArgs.marketType, 'perp')
|
// const marketType = isVariant(marketArgs.marketType, 'perp')
|
||||||
? 'perp'
|
// ? 'perp'
|
||||||
: 'spot';
|
// : 'spot';
|
||||||
|
|
||||||
const mms = await this.indicativeQuotesRedisClient.smembers(
|
// const mms = await this.indicativeQuotesRedisClient.smembers(
|
||||||
`market_mms_${marketType}_${marketArgs.marketIndex}`
|
// `market_mms_${marketType}_${marketArgs.marketIndex}`
|
||||||
);
|
// );
|
||||||
const mmQuotes = await Promise.all(
|
// const mmQuotes = await Promise.all(
|
||||||
mms.map((mm) => {
|
// mms.map((mm) => {
|
||||||
return this.indicativeQuotesRedisClient.get(
|
// return this.indicativeQuotesRedisClient.get(
|
||||||
`mm_quotes_${marketType}_${marketArgs.marketIndex}_${mm}`
|
// `mm_quotes_${marketType}_${marketArgs.marketIndex}_${mm}`
|
||||||
);
|
// );
|
||||||
})
|
// })
|
||||||
);
|
// );
|
||||||
|
|
||||||
const nowMinus1000Ms = Date.now() - 1000;
|
// const nowMinus1000Ms = Date.now() - 1000;
|
||||||
for (const quote of mmQuotes) {
|
// for (const quote of mmQuotes) {
|
||||||
if (Number(quote['ts']) > nowMinus1000Ms) {
|
// if (Number(quote['ts']) > nowMinus1000Ms) {
|
||||||
const indicativeBaseOrder: Order = {
|
// const indicativeBaseOrder: Order = {
|
||||||
status: OrderStatus.OPEN,
|
// status: OrderStatus.OPEN,
|
||||||
orderType: OrderType.LIMIT,
|
// orderType: OrderType.LIMIT,
|
||||||
orderId: 0,
|
// orderId: 0,
|
||||||
slot: new BN(this.slotSource.getSlot()),
|
// slot: new BN(this.slotSource.getSlot()),
|
||||||
marketIndex: marketArgs.marketIndex,
|
// marketIndex: marketArgs.marketIndex,
|
||||||
marketType: marketArgs.marketType,
|
// marketType: marketArgs.marketType,
|
||||||
baseAssetAmount: ZERO,
|
// baseAssetAmount: ZERO,
|
||||||
immediateOrCancel: false,
|
// immediateOrCancel: false,
|
||||||
direction: PositionDirection.LONG,
|
// direction: PositionDirection.LONG,
|
||||||
oraclePriceOffset: 0,
|
// oraclePriceOffset: 0,
|
||||||
maxTs: new BN(quote['ts'] + 1000),
|
// maxTs: new BN(quote['ts'] + 1000),
|
||||||
reduceOnly: false,
|
// reduceOnly: false,
|
||||||
triggerCondition: OrderTriggerCondition.ABOVE,
|
// triggerCondition: OrderTriggerCondition.ABOVE,
|
||||||
price: ZERO,
|
// price: ZERO,
|
||||||
userOrderId: 0,
|
// userOrderId: 0,
|
||||||
postOnly: true,
|
// postOnly: true,
|
||||||
auctionDuration: 0,
|
// auctionDuration: 0,
|
||||||
auctionStartPrice: ZERO,
|
// auctionStartPrice: ZERO,
|
||||||
auctionEndPrice: ZERO,
|
// auctionEndPrice: ZERO,
|
||||||
// Rest are not necessary and set for type conforming
|
// // Rest are not necessary and set for type conforming
|
||||||
existingPositionDirection: PositionDirection.LONG,
|
// existingPositionDirection: PositionDirection.LONG,
|
||||||
triggerPrice: ZERO,
|
// triggerPrice: ZERO,
|
||||||
baseAssetAmountFilled: ZERO,
|
// baseAssetAmountFilled: ZERO,
|
||||||
quoteAssetAmountFilled: ZERO,
|
// quoteAssetAmountFilled: ZERO,
|
||||||
quoteAssetAmount: ZERO,
|
// quoteAssetAmount: ZERO,
|
||||||
bitFlags: 0,
|
// bitFlags: 0,
|
||||||
postedSlotTail: 0,
|
// postedSlotTail: 0,
|
||||||
};
|
// };
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
const indicativeBid: Order = Object.assign(
|
// const indicativeBid: Order = Object.assign(
|
||||||
{},
|
// {},
|
||||||
indicativeBaseOrder,
|
// indicativeBaseOrder,
|
||||||
{
|
// {
|
||||||
orderId: indicativeOrderId,
|
// orderId: indicativeOrderId,
|
||||||
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']),
|
// baseAssetAmount: new BN(quote['bid_size']),
|
||||||
direction: PositionDirection.LONG,
|
// direction: PositionDirection.LONG,
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
this.dlob.insertOrder(
|
// this.dlob.insertOrder(
|
||||||
indicativeBid,
|
// indicativeBid,
|
||||||
INDICATIVE_QUOTES_PUBKEY,
|
// INDICATIVE_QUOTES_PUBKEY,
|
||||||
this.slotSource.getSlot(),
|
// this.slotSource.getSlot(),
|
||||||
false
|
// false
|
||||||
);
|
// );
|
||||||
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(
|
// const indicativeAsk: Order = Object.assign(
|
||||||
{},
|
// {},
|
||||||
indicativeBaseOrder,
|
// indicativeBaseOrder,
|
||||||
{
|
// {
|
||||||
orderId: indicativeOrderId,
|
// orderId: indicativeOrderId,
|
||||||
oraclePriceOffset: quote['is_oracle_offset']
|
// oraclePriceOffset: quote['is_oracle_offset']
|
||||||
? quote['ask_price']
|
// ? quote['ask_price']
|
||||||
: 0,
|
// : 0,
|
||||||
price: quote['is_oracle_offset']
|
// price: quote['is_oracle_offset']
|
||||||
? 0
|
// ? 0
|
||||||
: new BN(quote['ask_price']),
|
// : new BN(quote['ask_price']),
|
||||||
baseAssetAmount: new BN(quote['ask_size']),
|
// baseAssetAmount: new BN(quote['ask_size']),
|
||||||
direction: PositionDirection.SHORT,
|
// direction: PositionDirection.SHORT,
|
||||||
}
|
// }
|
||||||
);
|
// );
|
||||||
this.dlob.insertOrder(
|
// this.dlob.insertOrder(
|
||||||
indicativeAsk,
|
// indicativeAsk,
|
||||||
INDICATIVE_QUOTES_PUBKEY,
|
// INDICATIVE_QUOTES_PUBKEY,
|
||||||
this.slotSource.getSlot(),
|
// this.slotSource.getSlot(),
|
||||||
false
|
// false
|
||||||
);
|
// );
|
||||||
indicativeOrderId += 1;
|
// indicativeOrderId += 1;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
this.getL2AndSendMsg(marketArgs);
|
this.getL2AndSendMsg(marketArgs);
|
||||||
this.getL3AndSendMsg(marketArgs);
|
this.getL3AndSendMsg(marketArgs);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user