|
|
@@ -0,0 +1,52 @@
|
|
|
+import collections
|
|
|
+
|
|
|
+import httpx
|
|
|
+
|
|
|
+def main():
|
|
|
+ corps = httpx.get('https://prun.raylu.net/stats/data/parentCorps.json').json()
|
|
|
+ companies = httpx.get('https://prun.raylu.net/stats/data/knownCompanies.json').json()
|
|
|
+
|
|
|
+ volume_delta(corps, companies)
|
|
|
+
|
|
|
+def volume_delta(corps, companies):
|
|
|
+ co_totals = httpx.get('https://prun.raylu.net/stats/data/company-data-jul26.json').json()['totals']
|
|
|
+ jul_volume = month_volume(corps, companies, co_totals)
|
|
|
+ co_totals = httpx.get('https://prun.raylu.net/stats/data/company-data-aug26.json').json()['totals']
|
|
|
+ aug_volume = month_volume(corps, companies, co_totals)
|
|
|
+
|
|
|
+ for corp, volume in aug_volume.items():
|
|
|
+ print(corp, volume - jul_volume.get(corp, 0))
|
|
|
+
|
|
|
+def month_volume(corps, companies, co_totals) -> dict:
|
|
|
+ volumes = collections.defaultdict(int)
|
|
|
+ for coid, pd in co_totals.items():
|
|
|
+ co = companies.get(coid)
|
|
|
+ if co is None: continue
|
|
|
+ corp = co.get('Corporation')
|
|
|
+ if corp is None: continue
|
|
|
+ corp = corps.get(corp, corp)
|
|
|
+ volumes[corp] += pd['volume']
|
|
|
+ return volumes
|
|
|
+
|
|
|
+def base_delta(corps, companies):
|
|
|
+ base_data = httpx.get('https://prun.raylu.net/stats/data/base-data-jul26.json').json()
|
|
|
+ jul_bases = month_bases(corps, companies, base_data)
|
|
|
+ base_data = httpx.get('https://prun.raylu.net/stats/data/base-data-aug26.json').json()
|
|
|
+ aug_bases = month_bases(corps, companies, base_data)
|
|
|
+
|
|
|
+ for corp, base_count in aug_bases.items():
|
|
|
+ print(corp, base_count - jul_bases.get(corp, 0))
|
|
|
+
|
|
|
+def month_bases(corps, companies, base_data) -> dict:
|
|
|
+ base_counts = collections.defaultdict(int)
|
|
|
+ for coid, bd in base_data.items():
|
|
|
+ co = companies.get(coid)
|
|
|
+ if co is None: continue
|
|
|
+ corp = co.get('Corporation')
|
|
|
+ if corp is None: continue
|
|
|
+ corp = corps.get(corp, corp)
|
|
|
+ base_counts[corp] += bd['bases']
|
|
|
+ return base_counts
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ main()
|