roi.ts 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. import {setupPopover} from './popover';
  2. const roiCache: Record<string, Promise<{lastModified: Date, profits: Profit[]}>> = {};
  3. async function getROI(cx: string) {
  4. const response = await fetch(`/roi_${cx.toLowerCase()}.json`);
  5. const lastModified = new Date(response.headers.get('last-modified')!);
  6. const profits = await response.json();
  7. return {lastModified, profits};
  8. }
  9. type MetricType = 'vwap' | 'bid' | 'ask';
  10. const lowVolume = document.querySelector('input#low-volume') as HTMLInputElement;
  11. const cxSelect = document.querySelector('select#cx') as HTMLSelectElement;
  12. const expertise = {
  13. AGRICULTURE: 'agri',
  14. CHEMISTRY: 'chem',
  15. CONSTRUCTION: 'const',
  16. ELECTRONICS: 'elec',
  17. FOOD_INDUSTRIES: 'food ind',
  18. FUEL_REFINING: 'fuel',
  19. MANUFACTURING: 'mfg',
  20. METALLURGY: 'metal',
  21. RESOURCE_EXTRACTION: 'res ext',
  22. } as const;
  23. const expertiseSelect = document.querySelector('select#expertise') as HTMLSelectElement;
  24. for (const key of Object.keys(expertise)) {
  25. const option = document.createElement('option');
  26. option.value = key;
  27. option.textContent = key.replace('_', ' ').toLowerCase();
  28. expertiseSelect.appendChild(option);
  29. }
  30. const buildingSelect = document.querySelector('select#building') as HTMLSelectElement;
  31. const formatSigFig = new Intl.NumberFormat(undefined, {
  32. notation: 'compact',
  33. maximumSignificantDigits: 3,
  34. }).format;
  35. if (localStorage.getItem('roi-cx')) cxSelect.value = localStorage.getItem('roi-cx')!;
  36. if (localStorage.getItem('roi-expertise')) expertiseSelect.value = localStorage.getItem('roi-expertise')!;
  37. if (localStorage.getItem('roi-low-volume')) lowVolume.checked = localStorage.getItem('roi-low-volume') === 'true';
  38. let savedBuilding = localStorage.getItem('roi-building') || '';
  39. let storedSortKey = localStorage.getItem('roi-sort-key') as any;
  40. if (storedSortKey === 'logistics_per_base') storedSortKey = 'normalized_logistics_per_base';
  41. let currentSortKey: keyof ProfitWithMetrics | 'outputs' = storedSortKey || 'break_even';
  42. let currentSortAsc: boolean = localStorage.getItem('roi-sort-asc') !== 'false';
  43. let headersInitialized = false;
  44. let metricControlsInitialized = false;
  45. let capexMetric: MetricType = (localStorage.getItem('roi-capex-metric') as MetricType) || 'vwap';
  46. let opexMetric: MetricType = (localStorage.getItem('roi-opex-metric') as MetricType) || 'vwap';
  47. let revenueMetric: MetricType = (localStorage.getItem('roi-revenue-metric') as MetricType) || 'vwap';
  48. // EXTREME DETAIL: Because '0' is no longer an option in the UI, we update the fallback
  49. // state to 'omit' to prevent the script from trying to load a non-existent dropdown item.
  50. let roundTripOption: string = localStorage.getItem('roi-round-trip') || 'omit';
  51. let showNegativeProfit: boolean = localStorage.getItem('roi-show-negative') !== 'false';
  52. let workingCapitalOption: string = localStorage.getItem('roi-working-capital-opt') || 'dynamic';
  53. let targetPermitOption: string = localStorage.getItem('roi-target-permit') || '2';
  54. async function render() {
  55. const tbody = document.querySelector('tbody')!;
  56. tbody.innerHTML = '';
  57. const cx = cxSelect.value;
  58. if (!roiCache[cx])
  59. roiCache[cx] = getROI(cx);
  60. const {lastModified, profits} = await roiCache[cx];
  61. if (!metricControlsInitialized) {
  62. const controls = document.createElement('div');
  63. controls.style.marginBottom = '15px';
  64. // EXTREME DETAIL: We generate the massive dropdown arrays on the fly using ES6 interpolation.
  65. // Array.from({length: x}) creates an empty array of size x, and the mapping function evaluates
  66. // the index (i) to inject the correct incremental HTML options directly into the template string.
  67. controls.innerHTML = `
  68. <label style="margin-right: 15px;">CapEx Price:
  69. <select id="capex-metric"><option value="vwap">VWAP</option><option value="bid">Bid</option><option value="ask">Ask</option></select>
  70. </label>
  71. <label style="margin-right: 15px;">OpEx Price:
  72. <select id="opex-metric"><option value="vwap">VWAP</option><option value="bid">Bid</option><option value="ask">Ask</option></select>
  73. </label>
  74. <label style="margin-right: 15px;">Revenue Price:
  75. <select id="revenue-metric"><option value="vwap">VWAP</option><option value="bid">Bid</option><option value="ask">Ask</option></select>
  76. </label>
  77. <label style="margin-right: 15px;">
  78. <input type="checkbox" id="show-negative"> Show Negative Profit
  79. </label>
  80. <label style="margin-right: 15px;">
  81. Round Trip (hrs):
  82. <select id="round-trip">
  83. <option value="omit">Omit From Calculation</option>
  84. ${Array.from({length: 25}, (_, i) => `<option value="${i + 1}">${i + 1}</option>`).join('')}
  85. </select>
  86. </label>
  87. <label style="margin-right: 15px;">
  88. Days OpEx:
  89. <select id="working-capital">
  90. <option value="omit">Omit From Calculation</option>
  91. <option value="dynamic">Max for Shipment (dynamic)</option>
  92. <option value="1">1</option>
  93. <option value="2">2</option>
  94. <option value="3">3</option>
  95. <option value="4">4</option>
  96. <option value="5">5</option>
  97. <option value="6">6</option>
  98. <option value="7">7</option>
  99. <option value="14">14</option>
  100. <option value="30">30</option>
  101. </select>
  102. </label>
  103. <label>
  104. Permit Number:
  105. <select id="target-permit">
  106. <option value="omit">Omit From Calculation</option>
  107. ${Array.from({length: 49}, (_, i) => `<option value="${i + 2}">${i + 2}</option>`).join('')}
  108. </select>
  109. </label>
  110. `;
  111. const table = document.querySelector('table');
  112. if (table) table.parentNode?.insertBefore(controls, table);
  113. (document.getElementById('capex-metric') as HTMLSelectElement).value = capexMetric;
  114. (document.getElementById('opex-metric') as HTMLSelectElement).value = opexMetric;
  115. (document.getElementById('revenue-metric') as HTMLSelectElement).value = revenueMetric;
  116. (document.getElementById('show-negative') as HTMLInputElement).checked = showNegativeProfit;
  117. (document.getElementById('round-trip') as HTMLSelectElement).value = roundTripOption;
  118. (document.getElementById('working-capital') as HTMLSelectElement).value = workingCapitalOption;
  119. (document.getElementById('target-permit') as HTMLSelectElement).value = targetPermitOption;
  120. document.getElementById('capex-metric')!.addEventListener('change', (e) => {
  121. capexMetric = (e.target as HTMLSelectElement).value as MetricType;
  122. render();
  123. });
  124. document.getElementById('opex-metric')!.addEventListener('change', (e) => {
  125. opexMetric = (e.target as HTMLSelectElement).value as MetricType;
  126. render();
  127. });
  128. document.getElementById('revenue-metric')!.addEventListener('change', (e) => {
  129. revenueMetric = (e.target as HTMLSelectElement).value as MetricType;
  130. render();
  131. });
  132. document.getElementById('show-negative')!.addEventListener('change', (e) => {
  133. showNegativeProfit = (e.target as HTMLInputElement).checked;
  134. render();
  135. });
  136. document.getElementById('round-trip')!.addEventListener('change', (e) => {
  137. roundTripOption = (e.target as HTMLSelectElement).value;
  138. render();
  139. });
  140. document.getElementById('working-capital')!.addEventListener('change', (e) => {
  141. workingCapitalOption = (e.target as HTMLSelectElement).value;
  142. render();
  143. });
  144. document.getElementById('target-permit')!.addEventListener('change', (e) => {
  145. targetPermitOption = (e.target as HTMLSelectElement).value;
  146. render();
  147. });
  148. metricControlsInitialized = true;
  149. }
  150. if (!headersInitialized) {
  151. const ths = document.querySelectorAll('th');
  152. const keys: (keyof ProfitWithMetrics | 'outputs')[] = [
  153. 'outputs', 'expertise', 'profit_per_base', 'break_even',
  154. 'capex_val', 'opex_val', 'normalized_logistics_per_base', 'market_capacity_base'
  155. ];
  156. ths.forEach((th, i) => {
  157. if (keys[i]) {
  158. th.style.cursor = 'pointer';
  159. th.title = '';
  160. if (keys[i] === 'profit_per_base') {
  161. th.textContent = 'Profit/Base';
  162. th.dataset.tooltip = 'Click to sort.\n\nDaily profit scaled to a full 500-area planetary base.\n(Percentiles rank 100.0% as the most desirable outcome, i.e., highest profit or lowest cost.)';
  163. } else if (keys[i] === 'capex_val') {
  164. th.textContent = 'CapEx/Base';
  165. th.dataset.tooltip = 'Click to sort.\n\nTotal capital expenditure scaled to a full 500-area planetary base.\nIncludes base construction, and optional Working Capital, HQ Upgrades, and Ship CapEx (use "Omit From Calculation" to exclude).';
  166. } else if (keys[i] === 'opex_val') {
  167. th.textContent = 'OpEx/Base';
  168. th.dataset.tooltip = 'Click to sort.\n\nDaily operational expenditure (input materials + worker consumables) scaled to a full 500-area planetary base.';
  169. } else if (keys[i] === 'normalized_logistics_per_base') {
  170. th.textContent = 'Logistics/Base';
  171. th.dataset.tooltip = 'Click to sort.\n\nDaily logistics bottleneck scaled to a full 500-area planetary base. The suffix indicates whether Weight (t) or Volume (m³) of Inputs (I) or Outputs (O) is the limiting bottleneck.\nSorts and percentiles are strictly normalized based on ship capacity limits (3000t or 1000m³).';
  172. } else if (keys[i] === 'market_capacity_base') {
  173. th.textContent = 'Market Cap (Bases)';
  174. th.dataset.tooltip = 'Click to sort.\n\nMarket Capacity: 7-day average traded volume ÷ daily output per base. Indicates how many full 500-area bases you can build before saturating the market.';
  175. } else if (keys[i] === 'break_even') {
  176. th.dataset.tooltip = 'Click to sort.\n\nBreak Even: CapEx ÷ daily profit. Note that CapEx dynamically includes optional logistics and HQ upgrades to accurately reflect operational readiness.';
  177. } else {
  178. th.dataset.tooltip = 'Click to sort.';
  179. }
  180. th.addEventListener('click', () => {
  181. if (currentSortKey === keys[i]) {
  182. currentSortAsc = !currentSortAsc;
  183. } else {
  184. currentSortKey = keys[i];
  185. currentSortAsc = keys[i] === 'break_even' ? true : false;
  186. }
  187. render();
  188. });
  189. }
  190. });
  191. headersInitialized = true;
  192. }
  193. const buildingTickers = new Set(profits.map(p => p.building));
  194. const buildings: {ticker: string, expertise: keyof typeof expertise}[] = Array.from(buildingTickers)
  195. .map((building) => ({ticker: building, expertise: profits.find(p => p.building === building)!.expertise}))
  196. .sort((a, b) => a.ticker.localeCompare(b.ticker));
  197. let selectedBuilding = buildingSelect.value || savedBuilding;
  198. let buildingFound = false;
  199. buildingSelect.innerHTML = '<option value="">(all)</option>';
  200. for (const building of buildings)
  201. if (expertiseSelect.value === '' || expertiseSelect.value === building.expertise) {
  202. const option = document.createElement('option');
  203. option.value = building.ticker;
  204. option.textContent = building.ticker;
  205. if (building.ticker === selectedBuilding) {
  206. buildingFound = true;
  207. option.selected = true;
  208. }
  209. buildingSelect.appendChild(option);
  210. }
  211. if (!buildingFound)
  212. selectedBuilding = '';
  213. savedBuilding = '';
  214. const filteredProfits = profits.filter(p => {
  215. const volumeRatio = p.output_per_day / p.average_traded_7d;
  216. if (!lowVolume.checked && volumeRatio > 0.05) return false;
  217. if (expertiseSelect.value !== '' && p.expertise !== expertiseSelect.value) return false;
  218. if (selectedBuilding !== '' && p.building !== selectedBuilding) return false;
  219. return true;
  220. });
  221. let profitsWithMetrics: ProfitWithMetrics[] = filteredProfits.map(p => {
  222. const bases = p.area / 500;
  223. const opex_val = p.opex[opexMetric] / bases;
  224. const revenue_val = p.revenue[revenueMetric] / bases;
  225. let capex_val = p.capex[capexMetric] / bases;
  226. let activeWorkingCapitalDays = 0;
  227. if (workingCapitalOption !== 'omit') {
  228. if (workingCapitalOption === 'dynamic') {
  229. activeWorkingCapitalDays = p.normalized_logistics_per_base > 0
  230. ? 1 / p.normalized_logistics_per_base
  231. : 0;
  232. } else {
  233. activeWorkingCapitalDays = parseInt(workingCapitalOption, 10);
  234. }
  235. capex_val += (opex_val * activeWorkingCapitalDays);
  236. }
  237. let hq_capex = 0;
  238. if (targetPermitOption !== 'omit') {
  239. const targetPermit = parseInt(targetPermitOption, 10);
  240. if (targetPermit >= 3) {
  241. const hqLevelStr = (targetPermit - 1).toString();
  242. if (p.hq_costs && p.hq_costs[hqLevelStr]) {
  243. hq_capex = p.hq_costs[hqLevelStr][capexMetric];
  244. capex_val += hq_capex;
  245. }
  246. }
  247. }
  248. let shipsNeeded = 0;
  249. let activeShipCapex = 0;
  250. if (roundTripOption !== 'omit') {
  251. const roundTripHours = parseInt(roundTripOption, 10);
  252. shipsNeeded = p.normalized_logistics_per_base * (roundTripHours / 24);
  253. activeShipCapex = shipsNeeded * 800_000;
  254. capex_val += activeShipCapex;
  255. }
  256. const profit_per_base = revenue_val - opex_val;
  257. const break_even = profit_per_base > 0 ? capex_val / profit_per_base : Infinity;
  258. return {
  259. ...p,
  260. capex_val,
  261. opex_val,
  262. revenue_val,
  263. profit_per_base,
  264. break_even,
  265. hq_capex,
  266. activeWorkingCapitalDays,
  267. activeShipCapex,
  268. shipsNeeded
  269. };
  270. });
  271. if (!showNegativeProfit) {
  272. profitsWithMetrics = profitsWithMetrics.filter(p => p.profit_per_base > 0);
  273. }
  274. const numSort = (a: number, b: number) => (a < b ? -1 : a > b ? 1 : 0);
  275. const arrProfit = profitsWithMetrics.map(p => p.profit_per_base).sort(numSort);
  276. const arrBreak = profitsWithMetrics.map(p => p.break_even).sort(numSort);
  277. const arrCapex = profitsWithMetrics.map(p => p.capex_val).sort(numSort);
  278. const arrOpex = profitsWithMetrics.map(p => p.opex_val).sort(numSort);
  279. const arrLog = profitsWithMetrics.map(p => p.normalized_logistics_per_base).sort(numSort);
  280. const arrCap = profitsWithMetrics.map(p => p.market_capacity_base).sort(numSort);
  281. profitsWithMetrics.sort((a, b) => {
  282. let valA: any = a[currentSortKey as keyof ProfitWithMetrics];
  283. let valB: any = b[currentSortKey as keyof ProfitWithMetrics];
  284. if (currentSortKey === 'outputs') {
  285. valA = a.outputs.map(o => o.ticker).join(', ');
  286. valB = b.outputs.map(o => o.ticker).join(', ');
  287. }
  288. if (valA < valB) return currentSortAsc ? -1 : 1;
  289. if (valA > valB) return currentSortAsc ? 1 : -1;
  290. return 0;
  291. });
  292. for (const p of profitsWithMetrics) {
  293. const tr = document.createElement('tr');
  294. const pctProfit = getPercentile(p.profit_per_base, arrProfit, false);
  295. const pctBreak = getPercentile(p.break_even, arrBreak, true);
  296. const pctCapex = getPercentile(p.capex_val, arrCapex, true);
  297. const pctOpex = getPercentile(p.opex_val, arrOpex, true);
  298. const pctLog = getPercentile(p.normalized_logistics_per_base, arrLog, true);
  299. const pctCap = getPercentile(p.market_capacity_base, arrCap, false);
  300. tr.innerHTML = `
  301. <td>${p.outputs.map(o => o.ticker).join(', ')}</td>
  302. <td>${expertise[p.expertise]}</td>
  303. <td style="color: ${color(p.profit_per_base, 0, 150000)}">${formatSigFig(p.profit_per_base)} <span style="font-size: 0.85em; opacity: 0.6;">(${pctProfit})</span></td>
  304. <td><span style="color: ${color(p.break_even, 30, 3)}">${formatSigFig(p.break_even)}</span>d <span style="font-size: 0.85em; opacity: 0.6;">(${pctBreak})</span></td>
  305. <td style="color: ${color(p.capex_val, 3_000_000, 400_000)}">${formatSigFig(p.capex_val)} <span style="font-size: 0.85em; opacity: 0.6;">(${pctCapex})</span></td>
  306. <td style="color: ${color(p.opex_val, 400_000, 10_000)}">${formatSigFig(p.opex_val)} <span style="font-size: 0.85em; opacity: 0.6;">(${pctOpex})</span></td>
  307. <td style="color: ${color(p.normalized_logistics_per_base, 1.0, 0.1)}">${formatSigFig(p.logistics_per_base)} ${p.logistics_bottleneck} <span style="font-size: 0.85em; opacity: 0.6;">(${pctLog})</span></td>
  308. <td style="color: ${color(p.market_capacity_base, 0.04, 1)}">${formatSigFig(p.market_capacity_base)} <span style="font-size: 0.85em; opacity: 0.6;">(${pctCap})</span></td>
  309. `;
  310. const output = tr.querySelector('td')!;
  311. output.dataset.tooltip = p.recipe;
  312. const profitCell = tr.querySelectorAll('td')[2];
  313. const runs_per_base = p.runs_per_day / (p.area / 500);
  314. profitCell.dataset.tooltip = formatMatPrices(p.outputs, revenueMetric, runs_per_base) + '\n\n' +
  315. formatMatPrices(p.input_costs, opexMetric, runs_per_base) + '\n' +
  316. '+ worker consumables\n\n' +
  317. `(${formatSigFig(p.revenue_val)} - ${formatSigFig(p.opex_val)}) = ${formatSigFig(p.profit_per_base)}`;
  318. const capexCell = tr.querySelectorAll('td')[4];
  319. capexCell.dataset.tooltip = `Base Construction: ${formatSigFig(p.capex[capexMetric] / (p.area / 500))}`;
  320. if (workingCapitalOption !== 'omit') {
  321. capexCell.dataset.tooltip += `\nWorking Capital (${formatSigFig(p.activeWorkingCapitalDays)} days): ${formatSigFig(p.opex_val * p.activeWorkingCapitalDays)}`;
  322. }
  323. if (targetPermitOption !== 'omit' && p.hq_capex > 0) {
  324. capexCell.dataset.tooltip += `\nHQ Upgrade (Permit ${targetPermitOption}): ${formatSigFig(p.hq_capex)}`;
  325. }
  326. if (roundTripOption !== 'omit') {
  327. capexCell.dataset.tooltip += `\nShip CapEx: ${formatSigFig(p.activeShipCapex)} (${formatSigFig(p.shipsNeeded)} ships)`;
  328. }
  329. const marketCell = tr.querySelectorAll('td')[7];
  330. marketCell.dataset.tooltip = `Market Capacity: ${formatSigFig(p.average_traded_7d)} traded/day ÷ ${formatSigFig(p.output_per_day / (p.area / 500))} produced/day/base = ${formatSigFig(p.market_capacity_base)} equivalent bases`;
  331. tbody.appendChild(tr);
  332. }
  333. document.getElementById('last-updated')!.textContent =
  334. `last updated: ${lastModified.toLocaleString(undefined, {dateStyle: 'full', timeStyle: 'long', hour12: false})}`;
  335. saveState();
  336. }
  337. function getPercentile(val: number, sortedArr: number[], invert: boolean = false): string {
  338. if (sortedArr.length < 2) return "100.0%";
  339. let less = 0;
  340. for (let i = 0; i < sortedArr.length; i++) {
  341. if (sortedArr[i] < val) less++;
  342. else break;
  343. }
  344. let decimal = less / (sortedArr.length - 1);
  345. if (invert) {
  346. decimal = 1.0 - decimal;
  347. }
  348. return (decimal * 100).toFixed(1) + "%";
  349. }
  350. function saveState() {
  351. localStorage.setItem('roi-cx', cxSelect.value);
  352. localStorage.setItem('roi-expertise', expertiseSelect.value);
  353. localStorage.setItem('roi-building', buildingSelect.value);
  354. localStorage.setItem('roi-low-volume', lowVolume.checked.toString());
  355. localStorage.setItem('roi-sort-key', currentSortKey);
  356. localStorage.setItem('roi-sort-asc', currentSortAsc.toString());
  357. localStorage.setItem('roi-capex-metric', capexMetric);
  358. localStorage.setItem('roi-opex-metric', opexMetric);
  359. localStorage.setItem('roi-revenue-metric', revenueMetric);
  360. localStorage.setItem('roi-show-negative', showNegativeProfit.toString());
  361. localStorage.setItem('roi-round-trip', roundTripOption);
  362. localStorage.setItem('roi-working-capital-opt', workingCapitalOption);
  363. localStorage.setItem('roi-target-permit', targetPermitOption);
  364. }
  365. function color(n: number, low: number, high: number): string {
  366. const scale = Math.min(Math.max((n - low) / (high - low), 0), 1);
  367. return `color-mix(in xyz, #0aa ${scale * 100}%, #f80)`;
  368. }
  369. function formatMatPrices(matPrices: MatPrice[], metric: MetricType, runs_per_day: number): string {
  370. return matPrices.map(({ticker, amount, vwap_7d, bid, ask}) => {
  371. const val = metric === 'vwap' ? vwap_7d : metric === 'bid' ? (bid ?? vwap_7d) : (ask ?? vwap_7d);
  372. const daily_amount = amount * runs_per_day;
  373. return `${ticker}: ${formatSigFig(daily_amount)} × ${formatSigFig(val)} = ${formatSigFig(daily_amount * val)}`;
  374. }).join('\n');
  375. }
  376. setupPopover();
  377. lowVolume.addEventListener('change', render);
  378. cxSelect.addEventListener('change', render);
  379. expertiseSelect.addEventListener('change', render);
  380. buildingSelect.addEventListener('change', render);
  381. render();
  382. interface Metrics {
  383. vwap: number;
  384. bid: number;
  385. ask: number;
  386. }
  387. interface Profit {
  388. outputs: MatPrice[]
  389. recipe: string
  390. expertise: keyof typeof expertise
  391. building: string
  392. area: number
  393. capex: Metrics
  394. opex: Metrics
  395. revenue: Metrics
  396. input_costs: MatPrice[]
  397. runs_per_day: number
  398. logistics_per_base: number
  399. normalized_logistics_per_base: number
  400. logistics_bottleneck: string
  401. output_per_day: number
  402. average_traded_7d: number
  403. market_capacity_base: number
  404. hq_costs: Record<string, Metrics>
  405. }
  406. interface ProfitWithMetrics extends Profit {
  407. capex_val: number;
  408. opex_val: number;
  409. revenue_val: number;
  410. profit_per_day: number;
  411. profit_per_base: number;
  412. break_even: number;
  413. hq_capex: number;
  414. activeWorkingCapitalDays: number;
  415. activeShipCapex: number;
  416. shipsNeeded: number;
  417. }
  418. interface MatPrice {
  419. ticker: string
  420. amount: number
  421. vwap_7d: number
  422. bid: number | null
  423. ask: number | null
  424. }
  425. interface Building {
  426. building_type: 'INFRASTRUCTURE' | 'PLANETARY' | 'PRODUCTION';
  427. building_ticker: string;
  428. expertise: keyof typeof expertise;
  429. }