raylu 1 gün önce
ebeveyn
işleme
5209e0a8b6
1 değiştirilmiş dosya ile 28 ekleme ve 0 silme
  1. 28 0
      cx_spend.py

+ 28 - 0
cx_spend.py

@@ -0,0 +1,28 @@
+from __future__ import annotations
+
+import typing
+
+import cache
+
+def main() -> None:
+	for spent_30d, ticker in sorted(items(), reverse=True):
+		print(f'{ticker:4} {spent_30d:11,.0f}')
+
+def items() -> 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':
+			continue
+		if (vwap_30d := price['VWAP30D']) is None or (traded_30d := price['Traded30D']) is None:
+			continue
+		spent_30d = vwap_30d * traded_30d
+		yield spent_30d, price['MaterialTicker']
+
+class RawPrice(typing.TypedDict):
+	MaterialTicker: str
+	ExchangeCode: str
+	VWAP30D: float | None
+	Traded30D: float | None
+
+if __name__ == '__main__':
+	main()