@drift-labs/jit-proxy 0.10.206 → 0.10.207
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.
- package/lib/jitter/baseJitter.d.ts +2 -1
- package/lib/jitter/jitterShotgun.d.ts +2 -11
- package/lib/jitter/jitterShotgun.js +3 -1
- package/lib/jitter/jitterSniper.js +2 -1
- package/package.json +1 -1
- package/src/jitter/baseJitter.ts +2 -6
- package/src/jitter/jitterShotgun.ts +2 -17
- package/src/jitter/jitterSniper.ts +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="@pythnetwork/client/node_modules/@solana/web3.js" />
|
|
2
2
|
import { JitProxyClient, PriceType } from '../jitProxyClient';
|
|
3
3
|
import { PublicKey } from '@solana/web3.js';
|
|
4
|
-
import { AuctionSubscriber, BN, DriftClient, Order, UserAccount, UserStatsMap } from '@drift-labs/sdk';
|
|
4
|
+
import { AuctionSubscriber, BN, DriftClient, Order, PostOnlyParams, UserAccount, UserStatsMap } from '@drift-labs/sdk';
|
|
5
5
|
export type UserFilter = (userAccount: UserAccount, userKey: string, order: Order) => boolean;
|
|
6
6
|
export type JitParams = {
|
|
7
7
|
bid: BN;
|
|
@@ -10,6 +10,7 @@ export type JitParams = {
|
|
|
10
10
|
maxPosition: any;
|
|
11
11
|
priceType: PriceType;
|
|
12
12
|
subAccountId?: number;
|
|
13
|
+
postOnlyParams?: PostOnlyParams;
|
|
13
14
|
};
|
|
14
15
|
export declare abstract class BaseJitter {
|
|
15
16
|
auctionSubscriber: AuctionSubscriber;
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
/// <reference types="@pythnetwork/client/node_modules/@solana/web3.js" />
|
|
2
|
-
import { JitProxyClient
|
|
2
|
+
import { JitProxyClient } from '../jitProxyClient';
|
|
3
3
|
import { PublicKey } from '@solana/web3.js';
|
|
4
|
-
import { AuctionSubscriber,
|
|
4
|
+
import { AuctionSubscriber, DriftClient, Order, UserAccount, UserStatsMap } from '@drift-labs/sdk';
|
|
5
5
|
import { BaseJitter } from './baseJitter';
|
|
6
|
-
export type UserFilter = (userAccount: UserAccount, userKey: string, order: Order) => boolean;
|
|
7
|
-
export type JitParams = {
|
|
8
|
-
bid: BN;
|
|
9
|
-
ask: BN;
|
|
10
|
-
minPosition: BN;
|
|
11
|
-
maxPosition: any;
|
|
12
|
-
priceType: PriceType;
|
|
13
|
-
subAccountId?: number;
|
|
14
|
-
};
|
|
15
6
|
export declare class JitterShotgun extends BaseJitter {
|
|
16
7
|
constructor({ auctionSubscriber, jitProxyClient, driftClient, userStatsMap, }: {
|
|
17
8
|
driftClient: DriftClient;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.JitterShotgun = void 0;
|
|
4
|
+
const sdk_1 = require("@drift-labs/sdk");
|
|
4
5
|
const baseJitter_1 = require("./baseJitter");
|
|
5
6
|
class JitterShotgun extends baseJitter_1.BaseJitter {
|
|
6
7
|
constructor({ auctionSubscriber, jitProxyClient, driftClient, userStatsMap, }) {
|
|
@@ -13,6 +14,7 @@ class JitterShotgun extends baseJitter_1.BaseJitter {
|
|
|
13
14
|
}
|
|
14
15
|
createTryFill(taker, takerKey, takerStatsKey, order, orderSignature) {
|
|
15
16
|
return async () => {
|
|
17
|
+
var _a;
|
|
16
18
|
let i = 0;
|
|
17
19
|
while (i < 10) {
|
|
18
20
|
const params = this.perpParams.get(order.marketIndex);
|
|
@@ -37,7 +39,7 @@ class JitterShotgun extends baseJitter_1.BaseJitter {
|
|
|
37
39
|
minPosition: params.minPosition,
|
|
38
40
|
bid: params.bid,
|
|
39
41
|
ask: params.ask,
|
|
40
|
-
postOnly: null,
|
|
42
|
+
postOnly: (_a = params.postOnlyParams) !== null && _a !== void 0 ? _a : sdk_1.PostOnlyParams.MUST_POST_ONLY,
|
|
41
43
|
priceType: params.priceType,
|
|
42
44
|
referrerInfo,
|
|
43
45
|
subAccountId: params.subAccountId,
|
|
@@ -65,6 +65,7 @@ class JitterSniper extends baseJitter_1.BaseJitter {
|
|
|
65
65
|
stepSize,
|
|
66
66
|
oraclePrice,
|
|
67
67
|
}).then(async ({ slot, updatedDetails }) => {
|
|
68
|
+
var _a;
|
|
68
69
|
if (slot === -1) {
|
|
69
70
|
console.log('Auction expired without crossing');
|
|
70
71
|
this.deleteOnGoingAuction(orderSignature);
|
|
@@ -108,7 +109,7 @@ class JitterSniper extends baseJitter_1.BaseJitter {
|
|
|
108
109
|
minPosition: params.minPosition,
|
|
109
110
|
bid: params.bid,
|
|
110
111
|
ask: params.ask,
|
|
111
|
-
postOnly: null,
|
|
112
|
+
postOnly: (_a = params.postOnlyParams) !== null && _a !== void 0 ? _a : sdk_1.PostOnlyParams.MUST_POST_ONLY,
|
|
112
113
|
priceType: params.priceType,
|
|
113
114
|
referrerInfo,
|
|
114
115
|
subAccountId: params.subAccountId,
|
package/package.json
CHANGED
package/src/jitter/baseJitter.ts
CHANGED
|
@@ -5,17 +5,12 @@ import {
|
|
|
5
5
|
AuctionSubscriber,
|
|
6
6
|
BN,
|
|
7
7
|
BulkAccountLoader,
|
|
8
|
-
convertToNumber,
|
|
9
8
|
DriftClient,
|
|
10
|
-
getAuctionPrice,
|
|
11
|
-
getAuctionPriceForOracleOffsetAuction,
|
|
12
9
|
getUserStatsAccountPublicKey,
|
|
13
10
|
hasAuctionPrice,
|
|
14
11
|
isVariant,
|
|
15
|
-
OraclePriceData,
|
|
16
12
|
Order,
|
|
17
|
-
|
|
18
|
-
SlotSubscriber,
|
|
13
|
+
PostOnlyParams,
|
|
19
14
|
UserAccount,
|
|
20
15
|
UserStatsMap,
|
|
21
16
|
} from '@drift-labs/sdk';
|
|
@@ -33,6 +28,7 @@ export type JitParams = {
|
|
|
33
28
|
maxPosition;
|
|
34
29
|
priceType: PriceType;
|
|
35
30
|
subAccountId?: number;
|
|
31
|
+
postOnlyParams?: PostOnlyParams;
|
|
36
32
|
};
|
|
37
33
|
|
|
38
34
|
export abstract class BaseJitter {
|
|
@@ -2,29 +2,14 @@ import { JitProxyClient, PriceType } from '../jitProxyClient';
|
|
|
2
2
|
import { PublicKey } from '@solana/web3.js';
|
|
3
3
|
import {
|
|
4
4
|
AuctionSubscriber,
|
|
5
|
-
BN,
|
|
6
5
|
DriftClient,
|
|
7
6
|
Order,
|
|
7
|
+
PostOnlyParams,
|
|
8
8
|
UserAccount,
|
|
9
9
|
UserStatsMap,
|
|
10
10
|
} from '@drift-labs/sdk';
|
|
11
11
|
import { BaseJitter } from './baseJitter';
|
|
12
12
|
|
|
13
|
-
export type UserFilter = (
|
|
14
|
-
userAccount: UserAccount,
|
|
15
|
-
userKey: string,
|
|
16
|
-
order: Order
|
|
17
|
-
) => boolean;
|
|
18
|
-
|
|
19
|
-
export type JitParams = {
|
|
20
|
-
bid: BN;
|
|
21
|
-
ask: BN;
|
|
22
|
-
minPosition: BN;
|
|
23
|
-
maxPosition;
|
|
24
|
-
priceType: PriceType;
|
|
25
|
-
subAccountId?: number;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
13
|
export class JitterShotgun extends BaseJitter {
|
|
29
14
|
constructor({
|
|
30
15
|
auctionSubscriber,
|
|
@@ -83,7 +68,7 @@ export class JitterShotgun extends BaseJitter {
|
|
|
83
68
|
minPosition: params.minPosition,
|
|
84
69
|
bid: params.bid,
|
|
85
70
|
ask: params.ask,
|
|
86
|
-
postOnly:
|
|
71
|
+
postOnly: params.postOnlyParams ?? PostOnlyParams.MUST_POST_ONLY,
|
|
87
72
|
priceType: params.priceType,
|
|
88
73
|
referrerInfo,
|
|
89
74
|
subAccountId: params.subAccountId,
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
isVariant,
|
|
12
12
|
OraclePriceData,
|
|
13
13
|
Order,
|
|
14
|
+
PostOnlyParams,
|
|
14
15
|
PRICE_PRECISION,
|
|
15
16
|
SlotSubscriber,
|
|
16
17
|
UserAccount,
|
|
@@ -203,7 +204,7 @@ export class JitterSniper extends BaseJitter {
|
|
|
203
204
|
minPosition: params.minPosition,
|
|
204
205
|
bid: params.bid,
|
|
205
206
|
ask: params.ask,
|
|
206
|
-
postOnly:
|
|
207
|
+
postOnly: params.postOnlyParams ?? PostOnlyParams.MUST_POST_ONLY,
|
|
207
208
|
priceType: params.priceType,
|
|
208
209
|
referrerInfo,
|
|
209
210
|
subAccountId: params.subAccountId,
|