@drift-labs/sdk 2.61.0-beta.1 → 2.61.0-beta.2
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/VERSION +1 -1
- package/lib/oracles/pythClient.js +2 -1
- package/package.json +1 -1
- package/src/oracles/pythClient.ts +2 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.61.0-beta.
|
|
1
|
+
2.61.0-beta.2
|
|
@@ -17,6 +17,7 @@ class PythClient {
|
|
|
17
17
|
getOraclePriceDataFromBuffer(buffer) {
|
|
18
18
|
const priceData = (0, client_1.parsePriceData)(buffer);
|
|
19
19
|
const confidence = convertPythPrice(priceData.confidence, priceData.exponent, this.multiple);
|
|
20
|
+
const minPublishers = Math.min(priceData.numComponentPrices, 3);
|
|
20
21
|
let price = convertPythPrice(priceData.aggregate.price, priceData.exponent, this.multiple);
|
|
21
22
|
if (this.stableCoin) {
|
|
22
23
|
price = getStableCoinPrice(price, confidence);
|
|
@@ -27,7 +28,7 @@ class PythClient {
|
|
|
27
28
|
confidence,
|
|
28
29
|
twap: convertPythPrice(priceData.twap.value, priceData.exponent, this.multiple),
|
|
29
30
|
twapConfidence: convertPythPrice(priceData.twac.value, priceData.exponent, this.multiple),
|
|
30
|
-
hasSufficientNumberOfDataPoints:
|
|
31
|
+
hasSufficientNumberOfDataPoints: priceData.numQuoters >= minPublishers,
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
}
|
package/package.json
CHANGED
|
@@ -38,6 +38,7 @@ export class PythClient implements OracleClient {
|
|
|
38
38
|
priceData.exponent,
|
|
39
39
|
this.multiple
|
|
40
40
|
);
|
|
41
|
+
const minPublishers = Math.min(priceData.numComponentPrices, 3);
|
|
41
42
|
let price = convertPythPrice(
|
|
42
43
|
priceData.aggregate.price,
|
|
43
44
|
priceData.exponent,
|
|
@@ -61,7 +62,7 @@ export class PythClient implements OracleClient {
|
|
|
61
62
|
priceData.exponent,
|
|
62
63
|
this.multiple
|
|
63
64
|
),
|
|
64
|
-
hasSufficientNumberOfDataPoints:
|
|
65
|
+
hasSufficientNumberOfDataPoints: priceData.numQuoters >= minPublishers,
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
68
|
}
|