|
@@ -65,7 +65,7 @@ async function _render(shareUUID: string, cx: string) {
|
|
|
const buildingExpertise = new Map<string, Expertise>(buildings.map(b => [b.building_ticker, b.expertise]));
|
|
const buildingExpertise = new Map<string, Expertise>(buildings.map(b => [b.building_ticker, b.expertise]));
|
|
|
const recipes = new Map<string, Recipe>(recipeList.map(r => [r.recipe_id, r]));
|
|
const recipes = new Map<string, Recipe>(recipeList.map(r => [r.recipe_id, r]));
|
|
|
const dailyTraded = new Map<string, number>(exchanges.filter((ex) => ex.exchange_code === cx)
|
|
const dailyTraded = new Map<string, number>(exchanges.filter((ex) => ex.exchange_code === cx)
|
|
|
- .map((ex) => [ex.ticker, ex.avg_traded_7d]));
|
|
|
|
|
|
|
+ .map((ex) => [ex.ticker, ex.sum_traded_7d / 7]));
|
|
|
|
|
|
|
|
const planInput = new Counter();
|
|
const planInput = new Counter();
|
|
|
const planOutput = new Counter();
|
|
const planOutput = new Counter();
|
|
@@ -89,13 +89,10 @@ async function _render(shareUUID: string, cx: string) {
|
|
|
<th>out</th>
|
|
<th>out</th>
|
|
|
<th>net</th>
|
|
<th>net</th>
|
|
|
<th>daily traded</th>
|
|
<th>daily traded</th>
|
|
|
|
|
+ <th>% of traded</th>
|
|
|
</tr>
|
|
</tr>
|
|
|
${[...net.entries()].map(([mat, netAmount]) => {
|
|
${[...net.entries()].map(([mat, netAmount]) => {
|
|
|
const traded = dailyTraded.get(mat)!;
|
|
const traded = dailyTraded.get(mat)!;
|
|
|
- let tradedDisplay = wholeFmt.format(traded) + ' ';
|
|
|
|
|
- if (netAmount > 0)
|
|
|
|
|
- tradedDisplay += ' ';
|
|
|
|
|
- tradedDisplay += pctFmt.format(netAmount / traded);
|
|
|
|
|
const colorPct = Math.min(Math.abs(netAmount) / traded * 500, 100);
|
|
const colorPct = Math.min(Math.abs(netAmount) / traded * 500, 100);
|
|
|
const color = `color-mix(in xyz, #f80 ${colorPct}%, #0aa)`;
|
|
const color = `color-mix(in xyz, #f80 ${colorPct}%, #0aa)`;
|
|
|
return `<tr>
|
|
return `<tr>
|
|
@@ -103,7 +100,8 @@ async function _render(shareUUID: string, cx: string) {
|
|
|
<td>${formatNumber(planInput.get(mat))}</td>
|
|
<td>${formatNumber(planInput.get(mat))}</td>
|
|
|
<td>${formatNumber(planOutput.get(mat))}</td>
|
|
<td>${formatNumber(planOutput.get(mat))}</td>
|
|
|
<td>${formatNumber(netAmount)}</td>
|
|
<td>${formatNumber(netAmount)}</td>
|
|
|
- <td style="color: ${color}">${tradedDisplay}</td>
|
|
|
|
|
|
|
+ <td>${wholeFmt.format(traded)}</td>
|
|
|
|
|
+ <td style="color: ${color}">${pctFmt.format(netAmount / traded)}</td>
|
|
|
</tr>`;
|
|
</tr>`;
|
|
|
}).join('')}
|
|
}).join('')}
|
|
|
</table>
|
|
</table>
|
|
@@ -202,7 +200,7 @@ interface Recipe {
|
|
|
interface Exchange {
|
|
interface Exchange {
|
|
|
ticker: string
|
|
ticker: string
|
|
|
exchange_code: string
|
|
exchange_code: string
|
|
|
- avg_traded_7d: number
|
|
|
|
|
|
|
+ sum_traded_7d: number // avg_traded_7d is nonsense
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
interface Planet {
|
|
interface Planet {
|