Skip to content

Commit

Permalink
(feat) Updated fetch_metadata script to reuse logic in AsyncClient. S…
Browse files Browse the repository at this point in the history
…ynchronized all denom files after the changes
  • Loading branch information
abel committed Nov 6, 2023
1 parent 4a5aea9 commit c0ccd08
Show file tree
Hide file tree
Showing 5 changed files with 723 additions and 359 deletions.
17 changes: 13 additions & 4 deletions pyinjective/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,9 +875,15 @@ async def _initialize_tokens_and_markets(self):
binary_option_markets = dict()
tokens = dict()
tokens_by_denom = dict()
markets_info = (await self.get_spot_markets()).markets
markets_info = (await self.get_spot_markets(market_status="active")).markets
valid_markets = (
market_info
for market_info in markets_info
if len(market_info.base_token_meta.SerializeToString()) > 0
and len(market_info.quote_token_meta.SerializeToString()) > 0
)

for market_info in markets_info:
for market_info in valid_markets:
if "/" in market_info.ticker:
base_token_symbol, quote_token_symbol = market_info.ticker.split(constant.TICKER_TOKENS_SEPARATOR)
else:
Expand Down Expand Up @@ -917,8 +923,11 @@ async def _initialize_tokens_and_markets(self):

spot_markets[market.id] = market

markets_info = (await self.get_derivative_markets()).markets
for market_info in markets_info:
markets_info = (await self.get_derivative_markets(market_status="active")).markets
valid_markets = (
market_info for market_info in markets_info if len(market_info.quote_token_meta.SerializeToString()) > 0
)
for market_info in valid_markets:
quote_token_symbol = market_info.quote_token_meta.symbol

quote_token = self._token_representation(
Expand Down
Loading

0 comments on commit c0ccd08

Please sign in to comment.