Skip to content

Commit ed29e71

Browse files
authored
Merge pull request #697 from opentensor/update-main/revert-ema-prices-subnets-list
Update: Temporarily removes Inflow EMA
2 parents c16d9c0 + ffaabf2 commit ed29e71

File tree

1 file changed

+9
-50
lines changed

1 file changed

+9
-50
lines changed

bittensor_cli/src/commands/subnets/subnets.py

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,10 @@ async def subnets_list(
223223

224224
async def fetch_subnet_data():
225225
block_hash = await subtensor.substrate.get_chain_head()
226-
subnets_, mechanisms, block_number_, ema_flows = await asyncio.gather(
226+
subnets_, mechanisms, block_number_ = await asyncio.gather(
227227
subtensor.all_subnets(block_hash=block_hash),
228228
subtensor.get_all_subnet_mechanisms(block_hash=block_hash),
229229
subtensor.substrate.get_block_number(block_hash=block_hash),
230-
subtensor.get_all_subnet_ema_tao_inflow(block_hash=block_hash),
231230
)
232231

233232
# Sort subnets by market cap, keeping the root subnet in the first position
@@ -238,7 +237,7 @@ async def fetch_subnet_data():
238237
reverse=True,
239238
)
240239
sorted_subnets = [root_subnet] + other_subnets
241-
return sorted_subnets, block_number_, mechanisms, ema_flows
240+
return sorted_subnets, block_number_, mechanisms
242241

243242
def calculate_emission_stats(
244243
subnets_: list, block_number_: int
@@ -335,11 +334,6 @@ def define_table(
335334
justify="left",
336335
footer=f"τ {total_emissions}",
337336
)
338-
defined_table.add_column(
339-
f"[bold white]Net Inflow EMA ({Balance.get_unit(0)})",
340-
style=COLOR_PALETTE["POOLS"]["ALPHA_OUT"],
341-
justify="left",
342-
)
343337
defined_table.add_column(
344338
f"[bold white]P ({Balance.get_unit(0)}_in, {Balance.get_unit(1)}_in)",
345339
style=COLOR_PALETTE["STAKE"]["TAO"],
@@ -371,7 +365,7 @@ def define_table(
371365
return defined_table
372366

373367
# Non-live mode
374-
def _create_table(subnets_, block_number_, mechanisms, ema_flows):
368+
def _create_table(subnets_, block_number_, mechanisms):
375369
rows = []
376370
_, percentage_string = calculate_emission_stats(subnets_, block_number_)
377371

@@ -438,18 +432,6 @@ def _create_table(subnets_, block_number_, mechanisms, ema_flows):
438432
)
439433
emission_cell = f"τ {emission_tao:,.4f}"
440434

441-
# TAO Inflow EMA cell
442-
if netuid in ema_flows:
443-
_, _ema_value = ema_flows[netuid]
444-
ema_value = _ema_value.tao
445-
ema_color, ema_sign = format_ema_flow_cell(ema_value)
446-
ema_formatted = format_ema_tao_value(ema_value, verbose)
447-
ema_flow_cell = (
448-
f"[{ema_color}]{ema_sign}τ {ema_formatted}[/{ema_color}]"
449-
)
450-
else:
451-
ema_flow_cell = "-"
452-
453435
price_cell = f"{price_value} τ/{symbol}"
454436
alpha_out_cell = (
455437
f"{alpha_out_value} {symbol}"
@@ -473,7 +455,6 @@ def _create_table(subnets_, block_number_, mechanisms, ema_flows):
473455
price_cell, # Rate τ_in/α_in
474456
market_cap_cell, # Market Cap
475457
emission_cell, # Emission (τ)
476-
ema_flow_cell, # TAO Flow EMA
477458
liquidity_cell, # Liquidity (t_in, a_in)
478459
alpha_out_cell, # Stake α_out
479460
supply_cell, # Supply
@@ -500,7 +481,7 @@ def _create_table(subnets_, block_number_, mechanisms, ema_flows):
500481
defined_table.add_row(*row)
501482
return defined_table
502483

503-
def dict_table(subnets_, block_number_, mechanisms, ema_flows) -> dict:
484+
def dict_table(subnets_, block_number_, mechanisms) -> dict:
504485
subnet_rows = {}
505486
total_tao_emitted, _ = calculate_emission_stats(subnets_, block_number_)
506487
total_emissions = 0.0
@@ -530,18 +511,12 @@ def dict_table(subnets_, block_number_, mechanisms, ema_flows) -> dict:
530511
),
531512
"sn_tempo": (subnet.tempo if netuid != 0 else None),
532513
}
533-
tao_flow_ema = None
534-
if netuid in ema_flows:
535-
_, ema_value = ema_flows[netuid]
536-
tao_flow_ema = ema_value.tao
537-
538514
subnet_rows[netuid] = {
539515
"netuid": netuid,
540516
"subnet_name": subnet_name,
541517
"price": price_value,
542518
"market_cap": market_cap,
543519
"emission": emission_tao,
544-
"tao_flow_ema": tao_flow_ema,
545520
"liquidity": {"tao_in": tao_in, "alpha_in": alpha_in},
546521
"alpha_out": alpha_out,
547522
"supply": supply,
@@ -559,9 +534,7 @@ def dict_table(subnets_, block_number_, mechanisms, ema_flows) -> dict:
559534
return output
560535

561536
# Live mode
562-
def create_table_live(
563-
subnets_, previous_data_, block_number_, mechanisms, ema_flows
564-
):
537+
def create_table_live(subnets_, previous_data_, block_number_, mechanisms):
565538
def format_cell(
566539
value, previous_value, unit="", unit_first=False, precision=4, millify=False
567540
):
@@ -679,16 +652,10 @@ def format_liquidity_cell(
679652
market_cap = (subnet.alpha_in.tao + subnet.alpha_out.tao) * subnet.price.tao
680653
supply = subnet.alpha_in.tao + subnet.alpha_out.tao
681654

682-
ema_value = 0
683-
if netuid in ema_flows:
684-
_, ema_value = ema_flows[netuid]
685-
ema_value = ema_value.tao
686-
687655
# Store current values for comparison
688656
current_data[netuid] = {
689657
"market_cap": market_cap,
690658
"emission_tao": emission_tao,
691-
"tao_flow_ema": ema_value,
692659
"alpha_out": subnet.alpha_out.tao,
693660
"tao_in": subnet.tao_in.tao,
694661
"alpha_in": subnet.alpha_in.tao,
@@ -717,12 +684,6 @@ def format_liquidity_cell(
717684
precision=4,
718685
)
719686

720-
ema_flow_cell = format_cell(
721-
ema_value,
722-
prev.get("tao_flow_ema"),
723-
unit="τ",
724-
precision=6,
725-
)
726687
price_cell = format_cell(
727688
subnet.price.tao,
728689
prev.get("price"),
@@ -806,7 +767,6 @@ def format_liquidity_cell(
806767
price_cell, # Rate τ_in/α_in
807768
market_cap_cell, # Market Cap
808769
emission_cell, # Emission (τ)
809-
ema_flow_cell, # TAO Flow EMA
810770
liquidity_cell, # Liquidity (t_in, a_in)
811771
alpha_out_cell, # Stake α_out
812772
supply_cell, # Supply
@@ -862,7 +822,6 @@ def format_liquidity_cell(
862822
subnets,
863823
block_number,
864824
mechanisms,
865-
ema_flows,
866825
) = await fetch_subnet_data()
867826

868827
# Update block numbers
@@ -875,7 +834,7 @@ def format_liquidity_cell(
875834
)
876835

877836
table, current_data = create_table_live(
878-
subnets, previous_data, block_number, mechanisms, ema_flows
837+
subnets, previous_data, block_number, mechanisms
879838
)
880839
previous_data = current_data
881840
progress.reset(progress_task)
@@ -901,13 +860,13 @@ def format_liquidity_cell(
901860
pass # Ctrl + C
902861
else:
903862
# Non-live mode
904-
subnets, block_number, mechanisms, ema_flows = await fetch_subnet_data()
863+
subnets, block_number, mechanisms = await fetch_subnet_data()
905864
if json_output:
906865
json_console.print(
907-
json.dumps(dict_table(subnets, block_number, mechanisms, ema_flows))
866+
json.dumps(dict_table(subnets, block_number, mechanisms))
908867
)
909868
else:
910-
table = _create_table(subnets, block_number, mechanisms, ema_flows)
869+
table = _create_table(subnets, block_number, mechanisms)
911870
console.print(table)
912871

913872
return

0 commit comments

Comments
 (0)