|
|
@@ -14,8 +14,11 @@ def read_data(f: typing.TextIO) -> dict[str, list[Row]]:
|
|
|
data[row[0]].append(Row(int(row[1]), int(row[2]), row[3]))
|
|
|
return data
|
|
|
|
|
|
-def get_prices(f: typing.TextIO) -> typing.Mapping[str, float]:
|
|
|
- raw_prices: typing.Sequence[Price] = json.load(f)
|
|
|
+def get_prices(month: str) -> typing.Mapping[str, float]:
|
|
|
+ with open(f'rawData/{month}-prices.json', 'r') as f:
|
|
|
+ raw_prices: typing.Sequence[Price] = json.load(f)
|
|
|
+ with open(f'rawData/{month}-prices-hardcoded.json', 'r') as f:
|
|
|
+ hardcoded_prices: typing.Mapping[str, int] = json.load(f)
|
|
|
volumes: dict[str, float] = collections.defaultdict(float)
|
|
|
traded: dict[str, int] = collections.defaultdict(int)
|
|
|
for price in raw_prices:
|
|
|
@@ -26,38 +29,6 @@ def get_prices(f: typing.TextIO) -> typing.Mapping[str, float]:
|
|
|
traded[price['MaterialTicker']] += price['Traded30D']
|
|
|
|
|
|
prices = {ticker: volume / traded[ticker] for ticker, volume in volumes.items()}
|
|
|
-
|
|
|
- hardcoded_prices = {
|
|
|
- 'AFP': 65638,
|
|
|
- 'ANZ': 70601,
|
|
|
- 'BFP': 23408,
|
|
|
- 'BSU': 605062,
|
|
|
- 'CPU': 1426423,
|
|
|
- 'CRU': 171386,
|
|
|
- 'DIS': 19583,
|
|
|
- 'GCH': 18303,
|
|
|
- 'GNZ': 30361,
|
|
|
- 'GWS': 9778478,
|
|
|
- 'HAM': 4686751,
|
|
|
- 'HNZ': 93580,
|
|
|
- 'IMM': 101522,
|
|
|
- 'JUI': 0,
|
|
|
- 'NOZ': 74525,
|
|
|
- 'PFG': 2677222,
|
|
|
- 'PK': 1144,
|
|
|
- 'RDS': 598170,
|
|
|
- 'SDM': 1721027,
|
|
|
- 'SST': 5863587,
|
|
|
- 'SU': 157860,
|
|
|
- 'SUD': 84327,
|
|
|
- 'TAC': 245797,
|
|
|
- 'TOR': 540169,
|
|
|
- 'VCB': 673713,
|
|
|
- 'VFT': 1781416,
|
|
|
- 'VOE': 3699358,
|
|
|
- 'VOR': 2547315,
|
|
|
- 'WR': 129412,
|
|
|
- }
|
|
|
assert frozenset(prices).isdisjoint(hardcoded_prices), frozenset(prices).intersection(hardcoded_prices)
|
|
|
prices.update(hardcoded_prices)
|
|
|
return prices
|