Skip to content

Commit 1dd2aaa

Browse files
authored
fix(lazer): add proper aggregated data type to state proto (#3128)
* feat(lazer): add all aggregate fields to state proto * refactor(lazer): separate publisher and aggregated update types * chore: remove unnecessary funding timestamp field * chore: bump version
1 parent 69662fd commit 1dd2aaa

File tree

3 files changed

+32
-18
lines changed

3 files changed

+32
-18
lines changed

Cargo.lock

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

lazer/publisher_sdk/proto/state.proto

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ message Feed {
117117
// [required] Feed kind.
118118
optional FeedKind kind = 108;
119119
// [required] Current aggregated data of the feed.
120-
optional FeedDataFields aggregated_data = 109;
121-
120+
optional FeedAggregateData aggregated_data = 109;
122121

123122
// [required] Feed status in the current shard. Disabled feeds will not be visible in
124123
// the consumer API for the current shard. This setting should only be used
@@ -136,8 +135,6 @@ message Feed {
136135
// [optional] If present, the aggregator will disable the feed in the current shard
137136
// at the specified instant.
138137
optional google.protobuf.Timestamp disable_in_shard_timestamp = 203;
139-
140-
// TODO: list of permissioned publisher IDs.
141138
}
142139

143140
// A part of the feed state related to a particular publisher.
@@ -154,21 +151,30 @@ message FeedPublisherState {
154151
optional google.protobuf.Timestamp last_publisher_timestamp = 3;
155152
// [optional] Data of the last update received from this publisher to this feed.
156153
// Can be absent if no update was ever received or if the last update was deemed no longer relevant.
157-
optional FeedData last_feed_data = 4;
154+
optional FeedPublisherData last_feed_data = 4;
158155
}
159156

160157
// Data provided by a publisher for a certain feed.
161-
message FeedData {
158+
message FeedPublisherData {
159+
// [optional] Best executable price. Can be absent if no data is available. Never present for funding rate feeds.
160+
optional int64 price = 1;
161+
// [optional] Best bid price. Can be absent if no data is available. Never present for funding rate feeds.
162+
optional int64 best_bid_price = 2;
163+
// [optional] Best ask price. Can be absent if no data is available. Never present for funding rate feeds.
164+
optional int64 best_ask_price = 3;
165+
// [optional] Funding rate. Can be absent if no data is available. Can only be present for funding rate feeds.
166+
optional int64 funding_rate = 4;
167+
// [optional] Funding rate interval. Can be absent if no data is available. Can only be present for funding rate feeds.
168+
optional google.protobuf.Duration funding_rate_interval = 5;
162169
// [required] Timestamp provided by the source of data that the publisher uses (e.g. an exchange).
163170
// If no such timestamp is available, it should be set to the same value as `publisher_timestamp`.
164-
optional google.protobuf.Timestamp source_timestamp = 1;
171+
optional google.protobuf.Timestamp source_timestamp = 6;
165172
// [required] Timestamp of the publisher.
166-
optional google.protobuf.Timestamp publisher_timestamp = 2;
167-
// [required] Values of the data fields.
168-
optional FeedDataFields fields = 3;
173+
optional google.protobuf.Timestamp publisher_timestamp = 7;
169174
}
170175

171-
message FeedDataFields {
176+
// Aggregate data derived from all accepted publisher updates.
177+
message FeedAggregateData {
172178
// [optional] Best executable price. Can be absent if no data is available. Never present for funding rate feeds.
173179
optional int64 price = 1;
174180
// [optional] Best bid price. Can be absent if no data is available. Never present for funding rate feeds.
@@ -179,6 +185,14 @@ message FeedDataFields {
179185
optional int64 funding_rate = 4;
180186
// [optional] Funding rate interval. Can be absent if no data is available. Can only be present for funding rate feeds.
181187
optional google.protobuf.Duration funding_rate_interval = 5;
188+
// [optional] Timestamp of the funding. Can be absent if no data is available.
189+
// Can only be present for funding rate feeds.
190+
optional google.protobuf.Timestamp funding_timestamp = 6;
191+
// [required] Number of publishers that were included in the aggregate.
192+
optional uint64 publisher_count = 7;
193+
// [optional] Confidence interval for the `price` field. Can be absent if no data is available.
194+
// Never present for funding rate feeds.
195+
optional int64 confidence = 8;
182196
}
183197

184198
// State associated with a governance source.

lazer/publisher_sdk/rust/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-publisher-sdk"
3-
version = "0.16.1"
3+
version = "0.17.0"
44
edition = "2021"
55
description = "Pyth Lazer Publisher SDK types."
66
license = "Apache-2.0"

0 commit comments

Comments
 (0)