Compare commits

...

2 Commits

Author SHA1 Message Date
Nelson Torres 5304a36b87 get_assets now uses public endpoint
It's better if the data is available through a public endpoint.
2024-11-13 10:43:30 -03:00
Nelson Torres 089c79e905 now using exch_info in search_symbols 2024-11-13 10:40:05 -03:00
1 changed files with 12 additions and 18 deletions

View File

@ -65,6 +65,7 @@ from .venues import (
)
from piker.accounting import (
Asset,
digits_to_dec,
MktPair,
)
from piker.data import (
@ -308,18 +309,16 @@ class Client:
"""
assets = {}
resp = await self.json_rpc(
'private/get_account_summaries',
params={
'extended' : True
}
'public/get_currencies',
params={}
)
summaries = resp.result['summaries']
for summary in summaries:
currency = summary['currency']
tx_tick = Decimal('1e-08')
currencies = resp.result
for currency in currencies:
name = currency['currency']
tx_tick = digits_to_dec(currency['fee_precision'])
atype='crypto_currency'
assets[currency] = Asset(
name=currency,
assets[name] = Asset(
name=name,
atype=atype,
tx_tick=tx_tick)
return assets
@ -452,20 +451,15 @@ class Client:
Fuzzy search symbology set for pairs matching `pattern`.
'''
pairs: dict[str, Pair] = await self.symbol_info()
matches: dict[str, Pair] = match_from_pairs(
pairs: dict[str, Pair] = await self.exch_info()
return match_from_pairs(
pairs=pairs,
query=pattern.upper(),
score_cutoff=35,
limit=limit
)
# repack in name-keyed table
return {
pair.instrument_name.lower(): pair
for pair in matches.values()
}
async def bars(
self,
mkt: MktPair,