import { useEffect, useState } from 'react' import { Card, Row, Col, Statistic, message } from 'antd' import { ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons' import { apiService } from '../services/api' import type { Statistics as StatisticsType } from '../types' const Statistics: React.FC = () => { const [stats, setStats] = useState(null) const [loading, setLoading] = useState(false) useEffect(() => { fetchStatistics() }, []) const fetchStatistics = async () => { setLoading(true) try { const response = await apiService.statistics.global() if (response.data.code === 0 && response.data.data) { setStats(response.data.data) } else { message.error(response.data.msg || '获取统计信息失败') } } catch (error: any) { message.error(error.message || '获取统计信息失败') } finally { setLoading(false) } } return (

统计信息

= 0 ? : } valueStyle={{ color: stats?.totalPnl && parseFloat(stats.totalPnl || '0') >= 0 ? '#3f8600' : '#cf1322' }} suffix="USDC" loading={loading} /> } valueStyle={{ color: '#3f8600' }} suffix="USDC" loading={loading} /> } valueStyle={{ color: '#cf1322' }} suffix="USDC" loading={loading} />
) } export default Statistics