Skip to content

Commit

Permalink
Generate charts with data filtered by selected currency
Browse files Browse the repository at this point in the history
  • Loading branch information
femelo committed Nov 6, 2024
1 parent 054093d commit e85a292
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions frontend/src/components/Charts/DepthChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,24 @@ const DepthChart: React.FC<DepthChartProps> = ({
const generateSeries: () => void = () => {
const sortedOrders: PublicOrder[] =
xType === 'base_price'
? enrichedOrders.sort(
(order1, order2) => (order1?.base_price ?? 0) - (order2?.base_price ?? 0),
? enrichedOrders
.filter(
(order: PublicOrder | null) =>
(fav.currency === 0) || (order?.currency == fav.currency)
)
: enrichedOrders.sort((order1, order2) => order1?.premium - order2?.premium);
.sort(
(order1: PublicOrder | null, order2: PublicOrder | null) =>
(order1?.base_price ?? 0) - (order2?.base_price ?? 0)
)
: enrichedOrders
.filter(
(order: PublicOrder | null) =>
(fav.currency === 0) || (order?.currency == fav.currency)
)
.sort(
(order1: PublicOrder | null, order2: PublicOrder | null) =>
order1?.premium - order2?.premium
);

const sortedBuyOrders: PublicOrder[] = sortedOrders
.filter((order) => order?.type === 0)
Expand Down

0 comments on commit e85a292

Please sign in to comment.