|
|
@@ -193,9 +193,13 @@ class Profit:
|
|
|
average_traded_7d: float
|
|
|
|
|
|
def __lt__(self, other: Profit) -> bool:
|
|
|
- if (break_even := self.capex / self.profit_per_day) < 0:
|
|
|
+ # EXTREME DETAIL: The sorting logic for Profit instances determines the order items appear in the frontend.
|
|
|
+ # This has been updated to match the new frontend break-even calculation, which includes 3 days of operational
|
|
|
+ # expenses (cost_per_day) in the numerator along with capex. This ensures the JSON arrays generated by this script
|
|
|
+ # are inherently sorted by the new, more accurate break-even metric.
|
|
|
+ if (break_even := (self.capex + 3 * self.cost_per_day) / self.profit_per_day) < 0:
|
|
|
break_even = 10000 - self.profit_per_day
|
|
|
- if (other_break_even := other.capex / other.profit_per_day) < 0:
|
|
|
+ if (other_break_even := (other.capex + 3 * other.cost_per_day) / other.profit_per_day) < 0:
|
|
|
other_break_even = 10000 - other.profit_per_day
|
|
|
return break_even < other_break_even
|
|
|
|
|
|
@@ -206,4 +210,4 @@ class MatPrice:
|
|
|
vwap_7d: float
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- main()
|
|
|
+ main()
|