Skip to content

Commit

Permalink
feat(deribit_fetcher):
Browse files Browse the repository at this point in the history
  • Loading branch information
akhercha committed Jul 19, 2024
1 parent d36e659 commit 7b6d44c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ async def _fetch_options(
f"Deribit options request returned an unexpected data structure: {str(e)}"
)
except Exception as e:
logger.exception("Unexpected error occurred while fetching option data")
raise PublisherFetchError(f"An unexpected error occurred: {str(e)}")

def _assert_request_succeeded(self, response: Dict[str, Any]) -> None:
Expand All @@ -240,9 +239,7 @@ def _build_merkle_tree(
leaves = []
for currency, option_data_list in options.items():
for option_data in option_data_list:
leaf = abs(hash(option_data)) % (
2**251 - 1 # Use a prime number close to 2^251
)
leaf = abs(hash(option_data)) % (2**251 - 1)
leaves.append(leaf)
# Sort the leaves to ensure consistent tree construction
leaves.sort()
Expand Down
3 changes: 2 additions & 1 deletion pragma-sdk/pragma_sdk/common/types/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,8 @@ class GenericEntry(Entry):
Currently used this way:
instead of publishing all the future options for all availables instruments from Deribit,
we place them in all a Merkle tree & we only publish the merkle root through this Generic entry.
So key will be {?} and value the merkle root containing all the price feeds.
So the key will be DERIBIT_OPTIONS_DATA and the value the merkle root containing
all the price feeds.
"""

base: BaseEntry
Expand Down

0 comments on commit 7b6d44c

Please sign in to comment.