@drift-labs/jit-proxy 0.10.207 → 0.10.208
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -25,9 +25,8 @@ class JitterSniper extends baseJitter_1.BaseJitter {
|
|
|
25
25
|
const { slotsTilCross, willCross, bid, ask, auctionStartPrice, auctionEndPrice, stepSize, oraclePrice, } = this.getAuctionAndOrderDetails(order);
|
|
26
26
|
// don't increase risk if we're past max positions
|
|
27
27
|
if ((0, sdk_1.isVariant)(order.marketType, 'perp')) {
|
|
28
|
-
const currPerpPos = this.driftClient
|
|
29
|
-
.getUser()
|
|
30
|
-
.getPerpPosition(order.marketIndex);
|
|
28
|
+
const currPerpPos = this.driftClient.getUser().getPerpPosition(order.marketIndex) ||
|
|
29
|
+
this.driftClient.getUser().getEmptyPosition(order.marketIndex);
|
|
31
30
|
if (currPerpPos.baseAssetAmount.lt(sdk_1.ZERO) &&
|
|
32
31
|
(0, sdk_1.isVariant)(order.direction, 'short')) {
|
|
33
32
|
if (currPerpPos.baseAssetAmount.lte(params.minPosition)) {
|
package/package.json
CHANGED
|
@@ -86,7 +86,7 @@ export class JitterShotgun extends BaseJitter {
|
|
|
86
86
|
console.log('Order does not cross params yet, retrying');
|
|
87
87
|
} else if (e.message.includes('0x1779')) {
|
|
88
88
|
console.log('Order could not fill');
|
|
89
|
-
}
|
|
89
|
+
} else if (e.message.includes('0x1793')) {
|
|
90
90
|
console.log('Oracle invalid, retrying');
|
|
91
91
|
} else {
|
|
92
92
|
await sleep(10000);
|
|
@@ -89,9 +89,9 @@ export class JitterSniper extends BaseJitter {
|
|
|
89
89
|
|
|
90
90
|
// don't increase risk if we're past max positions
|
|
91
91
|
if (isVariant(order.marketType, 'perp')) {
|
|
92
|
-
const currPerpPos =
|
|
93
|
-
.getUser()
|
|
94
|
-
.
|
|
92
|
+
const currPerpPos =
|
|
93
|
+
this.driftClient.getUser().getPerpPosition(order.marketIndex) ||
|
|
94
|
+
this.driftClient.getUser().getEmptyPosition(order.marketIndex);
|
|
95
95
|
if (
|
|
96
96
|
currPerpPos.baseAssetAmount.lt(ZERO) &&
|
|
97
97
|
isVariant(order.direction, 'short')
|
|
@@ -204,7 +204,8 @@ export class JitterSniper extends BaseJitter {
|
|
|
204
204
|
minPosition: params.minPosition,
|
|
205
205
|
bid: params.bid,
|
|
206
206
|
ask: params.ask,
|
|
207
|
-
postOnly:
|
|
207
|
+
postOnly:
|
|
208
|
+
params.postOnlyParams ?? PostOnlyParams.MUST_POST_ONLY,
|
|
208
209
|
priceType: params.priceType,
|
|
209
210
|
referrerInfo,
|
|
210
211
|
subAccountId: params.subAccountId,
|
|
@@ -315,7 +316,8 @@ export class JitterSniper extends BaseJitter {
|
|
|
315
316
|
|
|
316
317
|
// if it doesnt cross during auction, check if limit price crosses
|
|
317
318
|
if (!willCross) {
|
|
318
|
-
const slotAfterAuction =
|
|
319
|
+
const slotAfterAuction =
|
|
320
|
+
order.slot.toNumber() + order.auctionDuration + 1;
|
|
319
321
|
const limitPrice = getLimitPrice(order, oraclePrice, slotAfterAuction);
|
|
320
322
|
if (!limitPrice) {
|
|
321
323
|
willCross = true;
|