|
|
@@ -62,7 +62,7 @@ def get_prices(f: typing.TextIO) -> typing.Mapping[str, float]:
|
|
|
prices.update(hardcoded_prices)
|
|
|
return prices
|
|
|
|
|
|
-def add_company_ranks(totals: dict[str, CompanyTotals]) -> dict[str, CompanyTotals]:
|
|
|
+def add_company_ranks(totals: typing.Mapping[str, CompanyTotals]) -> typing.Mapping[str, CompanyTotals]:
|
|
|
ranked = sorted(totals.items(), key=lambda item: item[1]['volume'], reverse=True)
|
|
|
for rank, (company_id, company_totals) in enumerate(ranked, start=1):
|
|
|
company_totals['volumeRank'] = rank
|
|
|
@@ -123,6 +123,6 @@ class CompanyTickerData(typing.TypedDict):
|
|
|
volume: float
|
|
|
rank: int
|
|
|
|
|
|
-class CompanyTotals(typing.TypedDict, total=False):
|
|
|
+class CompanyTotals(typing.TypedDict):
|
|
|
volume: float
|
|
|
- volumeRank: int
|
|
|
+ volumeRank: typing.NotRequired[int]
|