-
Notifications
You must be signed in to change notification settings - Fork 307
feat(hip-3-pusher): Configurable price sources #3169
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| stale_price_threshold_seconds = 5 | ||
| prometheus_port = 9090 | ||
|
|
||
| [hyperliquid] | ||
| hyperliquid_ws_urls = ["wss://api.hyperliquid-testnet.xyz/ws"] | ||
| market_name = "pyth" | ||
| asset_context_symbols = ["BTC"] | ||
| use_testnet = false | ||
| oracle_pusher_key_path = "/path/to/oracle_pusher_key.txt" | ||
| publish_interval = 3.0 | ||
| publish_timeout = 5.0 | ||
| enable_publish = false | ||
|
|
||
| [multisig] | ||
| enable_multisig = false | ||
|
|
||
| [kms] | ||
| enable_kms = false | ||
| aws_kms_key_id_path = "/path/to/aws_kms_key_id.txt" | ||
|
|
||
| [lazer] | ||
| lazer_urls = ["wss://pyth-lazer-0.dourolabs.app/v1/stream", "wss://pyth-lazer-1.dourolabs.app/v1/stream"] | ||
| lazer_api_key = "lazer_api_key" | ||
| feed_ids = [1, 8] # BTC, USDT | ||
|
|
||
| [hermes] | ||
| hermes_urls = ["wss://hermes.pyth.network/ws"] | ||
| feed_ids = [ | ||
| "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43", # BTC | ||
| "2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b" # USDT | ||
| ] | ||
|
|
||
| [price.oracle] | ||
| BTC = [ | ||
| { source_type = "single", source = { source_name = "hl_oracle", source_id = "BTC" } }, | ||
| { source_type = "pair", base_source = { source_name = "lazer", source_id = 1, exponent = -8 }, quote_source = { source_name = "lazer", source_id = 8, exponent = -8 } }, | ||
| { source_type = "pair", base_source = { source_name = "hermes", source_id = "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43", exponent = -8 }, quote_source = { source_name = "hermes", source_id = "2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b", exponent = -8 } }, | ||
| ] | ||
|
|
||
| [price.external] | ||
| BTC = [{ source_type = "single", source = { source_name = "hl_mark", source_id = "BTC" } }] | ||
| PYTH = [{ source_type = "constant", value = "0.10" }] | ||
| FOGO = [{ source_type = "constant", value = "0.01" }] |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| from hyperliquid.utils.constants import MAINNET_API_URL, TESTNET_API_URL | ||
| from pydantic import BaseModel, FilePath, model_validator | ||
| from typing import Optional | ||
| from typing import Literal | ||
|
|
||
| STALE_TIMEOUT_SECONDS = 5 | ||
|
|
||
|
|
@@ -18,25 +19,19 @@ class MultisigConfig(BaseModel): | |
| class LazerConfig(BaseModel): | ||
| lazer_urls: list[str] | ||
| lazer_api_key: str | ||
| base_feed_id: int | ||
| base_feed_exponent: int | ||
| quote_feed_id: int | ||
| quote_feed_exponent: int | ||
| feed_ids: list[int] | ||
|
|
||
|
|
||
| class HermesConfig(BaseModel): | ||
| hermes_urls: list[str] | ||
| base_feed_id: str | ||
| base_feed_exponent: int | ||
| quote_feed_id: str | ||
| quote_feed_exponent: int | ||
| feed_ids: list[str] | ||
|
|
||
|
|
||
| class HyperliquidConfig(BaseModel): | ||
| hyperliquid_ws_urls: list[str] | ||
| push_urls: Optional[list[str]] = None | ||
| market_name: str | ||
| market_symbol: str | ||
| asset_context_symbols: list[str] | ||
| use_testnet: bool | ||
| oracle_pusher_key_path: Optional[FilePath] = None | ||
| publish_interval: float | ||
|
|
@@ -50,11 +45,58 @@ def set_default_urls(self): | |
| return self | ||
|
|
||
|
|
||
| class SedaFeedConfig(BaseModel): | ||
| exec_program_id: str | ||
| exec_inputs: str | ||
|
|
||
|
|
||
| class SedaConfig(BaseModel): | ||
| url: str | ||
| api_key_path: Optional[FilePath] = None | ||
| poll_interval: float | ||
| poll_failure_interval: float | ||
| poll_timeout: float | ||
| feeds: dict[str, SedaFeedConfig] | ||
|
|
||
|
|
||
| class PriceSource(BaseModel): | ||
| source_name: str | ||
| source_id: str | int | ||
| exponent: Optional[int] = None | ||
|
|
||
|
|
||
| class SingleSourceConfig(BaseModel): | ||
| source_type: Literal["single"] | ||
| source: PriceSource | ||
|
|
||
|
|
||
| class PairSourceConfig(BaseModel): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess generally we would leave "combining feeds" up to SEDA? Or would we use this PairSourceConfig for it?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Set this up specifcally for the case (as in our internal publishers) where we need to quote in e.g. USDT. For more complicated transformations yes, hopefully SEDA can abstract it out. |
||
| source_type: Literal["pair"] | ||
| base_source: PriceSource | ||
| quote_source: PriceSource | ||
|
|
||
|
|
||
| class ConstantSourceConfig(BaseModel): | ||
| source_type: Literal["constant"] | ||
| value: str | ||
|
|
||
|
|
||
| PriceSourceConfig = SingleSourceConfig | PairSourceConfig | ConstantSourceConfig | ||
|
|
||
|
|
||
| class PriceConfig(BaseModel): | ||
| oracle: dict[str, list[PriceSourceConfig]] = {} | ||
| mark: dict[str, list[PriceSourceConfig]] = {} | ||
| external: dict[str, list[PriceSourceConfig]] = {} | ||
|
|
||
|
|
||
| class Config(BaseModel): | ||
| stale_price_threshold_seconds: int | ||
| prometheus_port: int | ||
| hyperliquid: HyperliquidConfig | ||
| kms: KMSConfig | ||
| lazer: LazerConfig | ||
| hermes: HermesConfig | ||
| seda: SedaConfig | ||
| multisig: MultisigConfig | ||
| price: PriceConfig | ||
Uh oh!
There was an error while loading. Please reload this page.