Skip to content

Commit 707437a

Browse files
feat(pyth-lazer-protocol): add confidence to aggregated data (#2333)
* feat(pyth-lazer-protocol): add confidence to aggregated data * update lock
1 parent c6a2eb9 commit 707437a

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

lazer/Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lazer/sdk/rust/protocol/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyth-lazer-protocol"
3-
version = "0.4.2"
3+
version = "0.5.0"
44
edition = "2021"
55
description = "Pyth Lazer SDK - protocol types."
66
license = "Apache-2.0"

lazer/sdk/rust/protocol/src/payload.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub struct AggregatedPriceFeedData {
4343
pub best_bid_price: Option<Price>,
4444
pub best_ask_price: Option<Price>,
4545
pub publisher_count: Option<u16>,
46+
pub confidence: Option<Price>,
4647
}
4748

4849
pub const PAYLOAD_FORMAT_MAGIC: u32 = 2479346549;

lazer/sdk/rust/protocol/src/router.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ impl Add<Price> for Price {
117117
}
118118
}
119119

120+
impl Sub<Price> for Price {
121+
type Output = Option<Price>;
122+
fn sub(self, rhs: Price) -> Self::Output {
123+
let value = self.0.get().saturating_sub(rhs.0.get());
124+
NonZeroI64::new(value).map(Self)
125+
}
126+
}
127+
120128
impl Div<i64> for Price {
121129
type Output = Option<Price>;
122130
fn div(self, rhs: i64) -> Self::Output {

0 commit comments

Comments
 (0)