|
|
@@ -10,6 +10,7 @@ import tap
|
|
|
|
|
|
import cache
|
|
|
from config import config
|
|
|
+import market
|
|
|
|
|
|
class Args(tap.Tap):
|
|
|
planets: tuple[str, ...]
|
|
|
@@ -78,6 +79,10 @@ def main() -> None:
|
|
|
print('supply for', round(target_days, 1), 'days,', end=' ')
|
|
|
print(f'consuming {round(total_weight_used, 1)}t and {round(total_volume_used, 1)}㎥') # pyright: ignore[reportPossiblyUnboundVariable]
|
|
|
|
|
|
+ raw_prices: typing.Mapping[str, market.RawPrice] = {p['MaterialTicker']: p
|
|
|
+ for p in cache.get('https://refined-prun.github.io/refined-prices/all.json') if p['ExchangeCode'] == 'IC1'}
|
|
|
+
|
|
|
+ total_cost = 0
|
|
|
for planet in planets:
|
|
|
print('\n' + cyan(planet.name))
|
|
|
for consumption in planet.net_consumption:
|
|
|
@@ -87,9 +92,12 @@ def main() -> None:
|
|
|
days = avail / daily_consumption
|
|
|
print(f'{ticker:>3}: {avail:5d} ({daily_consumption:8.2f}/d) {days:4.1f} d', end='')
|
|
|
if need := optimal[planet.name].get(ticker): # pyright: ignore[reportOptionalMemberAccess]
|
|
|
- print(f' | {need:8.1f}')
|
|
|
+ cost = raw_prices[ticker]['Ask'] * need
|
|
|
+ total_cost += cost
|
|
|
+ print(f' | {need:6.1f} (${cost:6.0f})')
|
|
|
else:
|
|
|
print()
|
|
|
+ print(f'\ntotal cost: {total_cost:,}')
|
|
|
|
|
|
combined_buy: dict[str, int] = collections.defaultdict(int)
|
|
|
for buy in optimal.values():
|