Skip to content

Commit

Permalink
frank/0.7.33 (#123)
Browse files Browse the repository at this point in the history
* couple fixes in cached

* couple fixes in cached

* 0.7.33
  • Loading branch information
soundsonacid authored Feb 29, 2024
1 parent 70d1dc3 commit 732f97c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.7.32
current_version = 0.7.33
commit = True
tag = True
tag_name = {new_version}
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,14 @@ Add guardrails to avoid `CachedDriftClientAccountSubscriber` panicking on cache

Add `perp_market_indexes`, `spot_market_indexes`, `oracle_infos`, `should_find_all_markets_and_oracles` to `CachedDriftClientAccountSubscriber`

Add `stack_trace()` utility function
Add `stack_trace()` utility function

## [0.7.33] - 2024-2-29

Fix `IndexError` vs `KeyError` bug in `CachedDriftClientAccountSubscriber.get_oracle_price_data_and_slot()`

Sort market indexes in `CachedDriftClientAccountSubscriber` before populating cache

Merge PR #116: Update div_ceil to use integer division isntead of float division

Merge PR #117: Allows for the Jupiter V6 Swap API url to be configured
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "driftpy"
version = "0.7.32"
version = "0.7.33"
description = "A Python client for the Drift DEX"
authors = ["x19 <https://twitter.com/[email protected]>", "bigz <https://twitter.com/bigz_pubkey>", "frank <https://twitter.com/soundsonacid>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/driftpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.7.32"
__version__ = "0.7.33"
6 changes: 3 additions & 3 deletions src/driftpy/accounts/cache/drift_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def update_cache(self):
if 0 not in self.spot_market_indexes:
self.spot_market_indexes.insert(0, 0)

for market_index in self.spot_market_indexes:
for market_index in sorted(self.spot_market_indexes):
spot_market_and_slot = await get_spot_market_account_and_slot(
self.program, market_index
)
Expand All @@ -121,7 +121,7 @@ async def update_cache(self):

self.cache["spot_markets"] = spot_markets

for market_index in self.perp_market_indexes:
for market_index in sorted(self.perp_market_indexes):
perp_market_and_slot = await get_perp_market_account_and_slot(
self.program, market_index
)
Expand Down Expand Up @@ -177,7 +177,7 @@ def get_oracle_price_data_and_slot(
) -> Optional[DataAndSlot[OraclePriceData]]:
try:
return self.cache["oracle_price_data"][str(oracle)]
except IndexError:
except KeyError:
print(
f"WARNING: Oracle {oracle} not found in cache, Location: {stack_trace()}"
)
Expand Down

0 comments on commit 732f97c

Please sign in to comment.