Browse Source

roi: profit per area

raylu 1 week ago
parent
commit
e221706391
1 changed files with 5 additions and 9 deletions
  1. 5 9
      roi.py

+ 5 - 9
roi.py

@@ -21,14 +21,14 @@ def main() -> None:
 			profits.append(profit)
 	profits.sort(reverse=True)
 	for p in profits:
-		print(f'{p.output:5} \033[32m{p.profit: 10,.0f}\033[31m', end='')
+		print(f'{p.output:5} \033[32m{p.profit_per_area: 10,.0f}\033[31m', end='')
 		if p.low_volume:
 			print(' low volume', end='')
 		if p.heavy_logistics:
 			print(' heavy logistics', end='')
 		if p.high_opex:
 			print(' high opex', end='')
-		print(f'\n\033[30m{p.recipe:30} \033[0m{p.expertise:15} \033[33m{p.capex: 6,.0f} \033[35m{p.cost_per_day: 6,.0f}\033[0m')
+		print(f'\n\033[30m{p.recipe:30} \033[0m{p.expertise:19} \033[33m{p.capex:7,.0f} \033[35m{p.cost_per_day:7,.0f}\033[0m')
 
 def calc_profit(recipe: Recipe, buildings: typing.Mapping[str, Building], materials: typing.Mapping[str, Material],
 		prices: typing.Mapping[str, Price]) -> Profit | None:
@@ -57,7 +57,7 @@ def calc_profit(recipe: Recipe, buildings: typing.Mapping[str, Building], materi
 	) * runs_per_day
 	return Profit(output['Ticker'], recipe['RecipeName'],
 			expertise=building['Expertise'].replace('_', ' ').lower(),
-			profit=profit_per_run * runs_per_day,
+			profit_per_area=profit_per_run * runs_per_day / building['AreaCost'],
 			capex=capex,
 			cost_per_day=cost_per_day,
 			low_volume=output_price.average_traded < output_per_day * 20,
@@ -106,7 +106,7 @@ class Profit:
 	output: str
 	recipe: str
 	expertise: str
-	profit: float
+	profit_per_area: float
 	capex: float
 	cost_per_day: float
 	low_volume: bool
@@ -116,13 +116,9 @@ class Profit:
 
 	def __post_init__(self) -> None:
 		self.high_opex = self.cost_per_day > 50_000
-		self.score = self.profit
+		self.score = self.profit_per_area
 		if self.low_volume:
 			self.score *= 0.2
-		if self.heavy_logistics:
-			self.score *= 0.5
-		if self.high_opex:
-			self.score *= 0.8
 
 	def __lt__(self, other: Profit) -> bool:
 		return self.score < other.score