bbgo_origin/frontend/components/Stats.tsx

52 lines
1.2 KiB
TypeScript
Raw Normal View History

2022-06-16 08:47:35 +00:00
import { styled } from '@mui/styles';
2022-06-16 14:30:05 +00:00
import { StatsTitle, StatsValue, Percentage } from './Summary';
2022-06-16 14:52:32 +00:00
import { GridStats } from '../api/bbgo';
2022-06-16 08:47:35 +00:00
const StatsSection = styled('div')(() => ({
display: 'grid',
gridTemplateColumns: '1fr 1fr 1fr',
2022-06-16 10:17:59 +00:00
gap: '10px',
2022-06-16 08:47:35 +00:00
}));
2022-06-16 14:30:05 +00:00
export default function Stats({
stats,
gridProfitsPercentage,
gridAprPercentage,
}: {
stats: GridStats;
gridProfitsPercentage: number;
gridAprPercentage: number;
}) {
2022-06-16 08:47:35 +00:00
return (
<StatsSection>
<div>
<StatsTitle>Grid Profits</StatsTitle>
<StatsValue>{stats.gridProfits}</StatsValue>
<Percentage>{gridProfitsPercentage}%</Percentage>
</div>
<div>
<StatsTitle>Floating PNL</StatsTitle>
<StatsValue>{stats.floatingPNL}</StatsValue>
</div>
<div>
<StatsTitle>Grid APR</StatsTitle>
<Percentage>{gridAprPercentage}%</Percentage>
</div>
<div>
<StatsTitle>Current Price</StatsTitle>
<div>{stats.currentPrice}</div>
</div>
<div>
<StatsTitle>Price Range</StatsTitle>
<div>
{stats.lowestPrice}~{stats.highestPrice}
</div>
</div>
</StatsSection>
);
2022-06-16 14:30:05 +00:00
}