mm-balance 0.1.7__tar.gz → 0.1.8__tar.gz

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.
@@ -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,6 +1,6 @@
1
1
  [project]
2
2
  name = "mm-balance"
3
- version = "0.1.7"
3
+ version = "0.1.8"
4
4
  description = ""
5
5
  requires-python = ">=3.12"
6
6
  dependencies = [
@@ -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")
@@ -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:
@@ -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)
@@ -923,7 +923,7 @@ wheels = [
923
923
 
924
924
  [[package]]
925
925
  name = "mm-balance"
926
- version = "0.1.7"
926
+ version = "0.1.8"
927
927
  source = { editable = "." }
928
928
  dependencies = [
929
929
  { name = "mm-btc" },
File without changes
File without changes
File without changes
@@ -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
 
File without changes
File without changes