mm-balance 0.1.7__py3-none-any.whl → 0.1.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mm_balance/cli.py CHANGED
@@ -34,8 +34,8 @@ def cli(
34
34
  balances = Balances.from_config(config)
35
35
  balances.process()
36
36
 
37
- output.print_groups(balances, config, prices)
38
37
  output.print_prices(config, prices)
38
+ output.print_groups(balances, config, prices)
39
39
  output.print_total(config, balances, prices)
40
40
 
41
41
 
mm_balance/config.py CHANGED
@@ -98,7 +98,7 @@ class Config(BaseConfig):
98
98
  def sol_groups(self) -> list[Group]:
99
99
  return [g for g in self.groups if g.network == Network.SOL]
100
100
 
101
- def has_sum_share(self) -> bool:
101
+ def has_share(self) -> bool:
102
102
  return any(g.share != Decimal(1) for g in self.groups)
103
103
 
104
104
  @model_validator(mode="after")
mm_balance/output.py CHANGED
@@ -25,18 +25,18 @@ def _print_group(group: Config.Group, group_balances: list[Balances.Balance], co
25
25
  if config.price:
26
26
  balance_usd = round(address_task.balance.ok * prices[group.coin], config.round_ndigits)
27
27
  usd_sum += balance_usd
28
- row.append(balance_usd)
28
+ row.append(f"${balance_usd}")
29
29
  rows.append(row)
30
30
 
31
31
  sum_row = ["sum", round(balance_sum, config.round_ndigits)]
32
32
  if config.price:
33
- sum_row.append(round(usd_sum, config.round_ndigits))
33
+ sum_row.append(f"${round(usd_sum, config.round_ndigits)}")
34
34
  rows.append(sum_row)
35
35
 
36
36
  if group.share < Decimal(1):
37
37
  sum_share_row = [f"sum_share, {group.share}", round(balance_sum * group.share, config.round_ndigits)]
38
38
  if config.price:
39
- sum_share_row.append(round(usd_sum * group.share, config.round_ndigits))
39
+ sum_share_row.append(f"${round(usd_sum * group.share, config.round_ndigits)}")
40
40
  rows.append(sum_share_row)
41
41
 
42
42
  table_headers = ["address", "balance"]
@@ -48,7 +48,7 @@ def _print_group(group: Config.Group, group_balances: list[Balances.Balance], co
48
48
  def print_prices(config: Config, prices: Prices) -> None:
49
49
  if config.price:
50
50
  rows = [[k, round(v, config.round_ndigits)] for (k, v) in prices.items()]
51
- print_table("price", ["coin", "usd"], rows)
51
+ print_table("Prices", ["coin", "usd"], rows)
52
52
 
53
53
 
54
54
  def print_total(config: Config, balances: Balances, prices: Prices) -> None:
mm_balance/total.py CHANGED
@@ -67,10 +67,14 @@ class Total:
67
67
  if self.config.print_format == PrintFormat.TABLE:
68
68
  if self.config.price:
69
69
  self._print_total_total_with_price()
70
- self._print_share_total_with_price()
70
+
71
+ if self.config.has_share():
72
+ self._print_share_total_with_price()
71
73
  else:
72
74
  self._print_total_total_without_price()
73
- self._print_share_total_without_price()
75
+
76
+ if self.config.has_share():
77
+ self._print_share_total_without_price()
74
78
 
75
79
  def _print_total_total_with_price(self) -> None:
76
80
  if self.config.print_format == PrintFormat.TABLE:
@@ -81,16 +85,16 @@ class Total:
81
85
  usd_share = round(self.stablecoin_sum * 100 / self.usd_sum, self.config.round_ndigits)
82
86
  else:
83
87
  usd_share = round(usd_value * 100 / self.usd_sum, self.config.round_ndigits)
84
- rows.append([key, value, usd_value, usd_share])
85
- rows.append(["usd_sum", self.usd_sum])
86
- print_table("total", ["coin", "balance", "usd", "usd_share"], rows)
88
+ rows.append([key, value, f"${usd_value}", f"{usd_share}%"])
89
+ rows.append(["usd_sum", f"${self.usd_sum}"])
90
+ print_table("Total", ["coin", "balance", "usd", "usd_share"], rows)
87
91
 
88
92
  def _print_total_total_without_price(self) -> None:
89
93
  if self.config.print_format == PrintFormat.TABLE:
90
94
  rows = []
91
95
  for key, value in self.coins.items():
92
96
  rows.append([key, value])
93
- print_table("total", ["coin", "balance"], rows)
97
+ print_table("Total", ["coin", "balance"], rows)
94
98
 
95
99
  def _print_share_total_with_price(self) -> None:
96
100
  rows = []
@@ -100,12 +104,12 @@ class Total:
100
104
  usd_share = round(self.stablecoin_sum_share * 100 / self.usd_sum_share, self.config.round_ndigits)
101
105
  else:
102
106
  usd_share = round(usd_value * 100 / self.usd_sum_share, self.config.round_ndigits)
103
- rows.append([key, self.coins_share[key], usd_value, usd_share])
104
- rows.append(["usd_sum", self.usd_sum_share])
105
- print_table("total / share", ["coin", "balance", "usd", "usd_share"], rows)
107
+ rows.append([key, self.coins_share[key], f"${usd_value}", f"{usd_share}%"])
108
+ rows.append(["usd_sum", f"${self.usd_sum_share}"])
109
+ print_table("Total, share", ["coin", "balance", "usd", "usd_share"], rows)
106
110
 
107
111
  def _print_share_total_without_price(self) -> None:
108
112
  rows = []
109
113
  for key, _ in self.coins.items():
110
114
  rows.append([key, self.coins_share[key]])
111
- print_table("total / share", ["coin", "balance"], rows)
115
+ print_table("Total, share", ["coin", "balance"], rows)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mm-balance
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Requires-Python: >=3.12
5
5
  Requires-Dist: mm-btc==0.1.0
6
6
  Requires-Dist: mm-eth==0.1.3
@@ -1,16 +1,16 @@
1
1
  mm_balance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  mm_balance/balances.py,sha256=UGhJBecq-2CfNYdXE2EWjDcKkfPG30MERawOtWq5D5E,3399
3
3
  mm_balance/btc.py,sha256=h8hjcRk6BM0JwhAnB_V39wzeRO94s_hsOlzG7XpE9nk,445
4
- mm_balance/cli.py,sha256=GaxqhQ-uPguZRKieNGrIPoye8VZKAqg6-nbOExqtG9g,1250
5
- mm_balance/config.py,sha256=oeA5Oaru6pumzNws287dXvvj7CmOMQAjjqiRpYCb5PE,5918
4
+ mm_balance/cli.py,sha256=VpiNJdwels7qWuklpV7kNEYm0lhsN4NJ7yENIsQLdK8,1250
5
+ mm_balance/config.py,sha256=VGw8f9oQbu5qUJD5lcMnd6kKtXzyX5-CEqcRNd8mgVo,5914
6
6
  mm_balance/eth.py,sha256=wFpbqo4wHupTeMc9ybCPUkBBaJWxiWCBYJO3LvvU39s,1066
7
- mm_balance/output.py,sha256=j-kxENWcYEtv56UvEl_uKDF-92ALPZPJkvXqYmlBojs,2125
7
+ mm_balance/output.py,sha256=hCLq-hynO0c_MJrKSzOoY0p8yFGDZOb5_mE_pqGaBrc,2144
8
8
  mm_balance/price.py,sha256=xKwF0bWySfnryDYxsPTd2c8C82mrm1TXxIRzRmu_0MA,2577
9
9
  mm_balance/solana.py,sha256=tK1JHGo9ioIz-jXZ9pRDbACjQh_3vhgqFx1wZKVot6M,460
10
- mm_balance/total.py,sha256=RLwE_WrlO4TMftscoVuBHATmHXeV08IAukaU76wB75U,4812
10
+ mm_balance/total.py,sha256=gdH9BzFgc-akVVrsCJ6NqN6cIS9mkEfp-TTKcn01I0U,4944
11
11
  mm_balance/types.py,sha256=8TflwL3KJ8HQW31qa8xrh-gyJT232lN1XznuNnIR6zM,662
12
12
  mm_balance/config/example.yml,sha256=6_S0hBdh7gMyO1ZPTGxmL21bBSzzmXuJHB0eWqKGueU,1225
13
- mm_balance-0.1.7.dist-info/METADATA,sha256=WJLGieTEgyhR3azJl1ifA_hNdOuMnqGZSPAr3FoVlGM,197
14
- mm_balance-0.1.7.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
15
- mm_balance-0.1.7.dist-info/entry_points.txt,sha256=rSnP0ZW1a3ACNwTWM7T53CmOycKbzhG43m2_wseENng,50
16
- mm_balance-0.1.7.dist-info/RECORD,,
13
+ mm_balance-0.1.8.dist-info/METADATA,sha256=3fUpPe2SujgWG7zghwkJAkXOMDY0g4EYIP7KOChheUs,197
14
+ mm_balance-0.1.8.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
15
+ mm_balance-0.1.8.dist-info/entry_points.txt,sha256=rSnP0ZW1a3ACNwTWM7T53CmOycKbzhG43m2_wseENng,50
16
+ mm_balance-0.1.8.dist-info/RECORD,,