bugfixing dark pool component

This commit is contained in:
MuslemRahimi 2024-07-16 19:03:24 +02:00
parent d5ad019bbe
commit eb4a5d0f8d

View File

@ -27,7 +27,7 @@
let avgVolume; let avgVolume;
let avgShortVolume; let avgShortVolume;
let monthlyVolume; let monthlyVolume;
let monthlyShort; let avgMonthlyShort;
function normalizer(value) { function normalizer(value) {
if (Math?.abs(value) >= 1e18) { if (Math?.abs(value) >= 1e18) {
@ -65,9 +65,13 @@ function findMonthlyValue(data, lastDateStr) {
}, 0)); }, 0));
monthlyShort = filteredData?.reduce((accumulator, currentItem) => { const totalShortPercent = filteredData.reduce((accumulator, currentItem) => {
return accumulator + currentItem?.shortPercent; return accumulator + (currentItem?.shortPercent || 0);
}, 0)?.toFixed(2); }, 0);
avgMonthlyShort = (totalShortPercent / filteredData?.length)?.toFixed(2);
} }
@ -297,7 +301,7 @@ $: {
</tr> </tr>
<tr class="border-y border-gray-800 odd:bg-[#27272A]"> <tr class="border-y border-gray-800 odd:bg-[#27272A]">
<td class="px-[5px] py-1.5 xs:px-2.5 xs:py-2"> <td class="px-[5px] py-1.5 xs:px-2.5 xs:py-2">
<span>Volume</span> <span>Total Volume</span>
</td> </td>
<td class="px-[5px] py-1.5 text-right font-medium xs:px-2.5 xs:py-2"> <td class="px-[5px] py-1.5 text-right font-medium xs:px-2.5 xs:py-2">
{monthlyVolume} {monthlyVolume}
@ -305,10 +309,10 @@ $: {
</tr> </tr>
<tr class="border-y border-gray-800 odd:bg-[#27272A]"> <tr class="border-y border-gray-800 odd:bg-[#27272A]">
<td class="px-[5px] py-1.5 xs:px-2.5 xs:py-2"> <td class="px-[5px] py-1.5 xs:px-2.5 xs:py-2">
<span>Short % of Volume</span> <span>Avg. Short % of Volume</span>
</td> </td>
<td class="px-[5px] py-1.5 text-right font-medium xs:px-2.5 xs:py-2"> <td class="px-[5px] py-1.5 text-right font-medium xs:px-2.5 xs:py-2">
{monthlyShort}% {avgMonthlyShort}%
</td> </td>
</tr> </tr>
</tbody> </tbody>