-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat(observer): Detect artificially noisy stalled publisher prices #81
Feat(observer): Detect artificially noisy stalled publisher prices #81
Conversation
response_json = await response.json() | ||
price_feeds.extend(response_json["parsed"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how this is working currently in prod, but this wouldn't run locally for me without this change because the json response structure wasn't as expected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cctdaniel any idea on this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm i can see that the query_string
is changed in this PR https://github.com/pyth-network/pyth-observer/pull/79/files#diff-858c896a341166e34351e654992a17790df86095bb42d1b262b9673d43e2ea98R47 it seems like it wasnt tested properly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks -- I'll leave this change in then, and verify it works in testnet before deploying to mainnet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! thank you!!
pyth_observer/check/publisher.py
Outdated
|
||
publisher_key = (self.__state.publisher_name, self.__state.symbol) | ||
PUBLISHER_CACHE[publisher_key].append( | ||
PriceUpdate(current_time, self.__state.price) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the logic in the StalledDetector that you have I think you need to append a price only it's different that the latest stored price, otherwise the exact stalled might never fire.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yeah you're right, i was considering a few different ways to do this and looks like this slipped between the cracks during refactoring. test suite should have caught this -- let me fix and cover it with a test case
Purpose
Implementation Details
Most of the new stuff is in
stall_detection.py
. From the docstring:The detection strategy is based on the intuition that meaningful price movements must exceed some minimum relative threshold. If a price very slightly fluctuates but doesn't exceed the
noise_threshold
withinstall_time_limit
, then it's likely that it's just a static price with artificial noise thrown in.Detection Logic:
stall_time_limit
are exactly equalnoise_threshold
(default 0.01% - we may need to tune this)for longer than
stall_time_limit
(and with more updates thanmin_noise_samples
.)The
noise_threshold
(default 1e-4 or 0.01%) strategy is chosen because:price accuracy versus the aggregate.
Example:
Testing
The test suite has been updated to capture both exact and noisy stalls, normal price movement, and redemption rate feeds. The test file was restructured to enable reuse of setup functions via fixtures.
Ticket: https://www.notion.so/pyth-network/Observer-alert-for-almost-stalled-publishers-e0a12998ac08414c96b6414582280684?pvs=4
We're trying to detect patterns like this: