Skip to content

Commit

Permalink
Merge pull request #264 from InjectiveLabs/feat/sync_denoms_ini_files
Browse files Browse the repository at this point in the history
feat/sync_denoms_ini_files
  • Loading branch information
aarmoa authored Nov 7, 2023
2 parents 4a5aea9 + 04abec3 commit 7911c53
Show file tree
Hide file tree
Showing 7 changed files with 728 additions and 360 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ poetry run pytest -v
```

### Changelogs
**0.9.5**
* Updated fetch_metadata script (to synchronize denom ini files) to reuse logic in AsyncClient
* Synchronized denom ini files with Indexer information for mainnet, testnet and devnet

**0.9.4**
* Added TIA/USDT spot market in mainnet and testnet ini file

Expand Down
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 7911c53

Please sign in to comment.