Explorar el Código

cx_spend: take CX as an argument

raylu hace 1 mes
padre
commit
2d48715345
Se han modificado 1 ficheros con 5 adiciones y 3 borrados
  1. 5 3
      cx_spend.py

+ 5 - 3
cx_spend.py

@@ -1,17 +1,19 @@
 from __future__ import annotations
 
+import sys
 import typing
 
 import cache
 
 def main() -> None:
-	for spent_30d, ticker in sorted(items(), reverse=True):
+	cx = sys.argv[1]
+	for spent_30d, ticker in sorted(items(cx), reverse=True):
 		print(f'{ticker:4} {spent_30d:11,.0f}')
 
-def items() -> typing.Iterator[tuple[float, str]]:
+def items(cx: str) -> typing.Iterator[tuple[float, str]]:
 	raw_prices: list[RawPrice] = cache.get('https://refined-prun.github.io/refined-prices/all.json')
 	for price in raw_prices:
-		if price['ExchangeCode'] != 'IC1':
+		if price['ExchangeCode'] != cx:
 			continue
 		if (vwap_30d := price['VWAP30D']) is None or (traded_30d := price['Traded30D']) is None:
 			continue