Skip to content

Conversation

@merolish
Copy link
Contributor

Summary

Support mark price as mean(oracle, mid).

Rationale

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

@vercel
Copy link

vercel bot commented Nov 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
api-reference Ready Ready Preview Comment Nov 14, 2025 9:17pm
component-library Ready Ready Preview Comment Nov 14, 2025 9:17pm
developer-hub Ready Ready Preview Comment Nov 14, 2025 9:17pm
entropy-explorer Ready Ready Preview Comment Nov 14, 2025 9:17pm
insights Ready Ready Preview Comment Nov 14, 2025 9:17pm
proposals Error Error Nov 14, 2025 9:17pm
staking Error Error Nov 14, 2025 9:17pm

Comment on lines +133 to +147
def get_price_from_oracle_mid_average(self, symbol: str, oracle_update: OracleUpdate):
oracle_price = oracle_update.oracle.get(symbol)
if oracle_price is None:
return None

mid_price_update: PriceUpdate | None = self.hl_mid_state.get(symbol)
if mid_price_update is None:
logger.warning("mid price for {} is missing", symbol)
return None
time_diff = mid_price_update.time_diff(time.time())
if time_diff >= self.stale_price_threshold_seconds:
logger.warning("mid price for {} is stale by {} seconds", symbol, time_diff)
return None

return (float(oracle_price) + float(mid_price_update.price)) / 2.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the logic is simple for now, but maybe you want to generate a quick unit test anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per Slack discussion, need to improve testing, will put in a separate PR.

@merolish merolish merged commit cbb5dd5 into main Nov 19, 2025
7 of 9 checks passed
@merolish merolish deleted the mike/hip3-price-move branch November 19, 2025 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants