mmnode-ticker: fix market cap sort with USD row

This commit is contained in:
The MMGen Project 2025-10-22 10:33:16 +00:00
commit d02c9936ef
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
4 changed files with 38 additions and 2 deletions

View file

@ -539,6 +539,7 @@ def gen_data(data):
'percent_change_7d': 0.0,
'percent_change_30d': 0.0,
'percent_change_1y': 0.0,
'market_cap': 0,
'last_updated': None})
def cache_data(data_src, no_overwrite=False):

View file

@ -1 +1 @@
3.6.dev9
3.6.dev10

View file

@ -101,6 +101,9 @@ class CmdTestScripts(CmdTestBase):
('ticker30', 'ticker [--cached-data --wide --pchg-unit=btc --sort=d] (cf with config file)'),
('ticker31', 'ticker [--cached-data --wide --pchg-unit=usd] (cf with no USD)'),
('ticker32', 'ticker [--cached-data --wide --pchg-unit=gc=f]'),
('ticker33', 'ticker [--cached-data --wide --pchg-unit=btc --sort=c] (cfg file with USD)'),
('ticker34', 'ticker [--cached-data --wide --pchg-unit=btc --sort=y] (cfg file with USD)'),
('ticker35', 'ticker [--cached-data --wide --pchg-unit=btc --sort=p] (cfg file with USD)'),
)
}
@ -475,4 +478,25 @@ class CmdTestScripts(CmdTestBase):
'GOLD', r'\+0.00', r'\+0.00', r'\+0.00', r'\+0.00',
'SILVER'
],
add_opts = ['--widest', '--pchg-unit=gc=f'])
add_opts = ['--widest', '--pchg-unit=gc=f', '--sort=c'])
def _ticker_cur(self, sort):
self.copy_file('ticker-cfg-usd.yaml', 'ticker-cfg.yaml')
t = self.ticker(
[],
[
'BITCOIN 23,250.77 1.00000000 \+0.00',
'US DOLLAR 1.00 0.00004301 -15.93',
],
add_opts = ['--widest', '--pchg-unit=btc', f'--sort={sort}'])
self.rm_file('ticker-cfg.yaml')
return t
def ticker33(self):
return self._ticker_cur(sort='c')
def ticker34(self):
return self._ticker_cur(sort='y')
def ticker35(self):
return self._ticker_cur(sort='p')

View file

@ -0,0 +1,11 @@
assets:
coin1:
- btc-bitcoin
- eth-ethereum
- xmr-monero
commodity:
- gc=f
- si=f
currency:
- usd-us-dollar
- eurusd=x