update pay promo
This commit is contained in:
@@ -278,6 +278,29 @@ const getDefaultTopSector = (count: number | undefined, dateStr: string | undefi
|
||||
return sectors[dateNum % sectors.length];
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据股票代码推断涨停幅度
|
||||
* - 主板(60开头、00开头):10%
|
||||
* - 科创板(688开头):20%
|
||||
* - 创业板(30开头):20%
|
||||
* - 北交所(8开头):30%
|
||||
*/
|
||||
const getLimitUpPercent = (scode: string | undefined): number => {
|
||||
if (!scode) return 10.0;
|
||||
const code = scode.replace(/\.\w+$/, ''); // 移除后缀如 .SZ .SH
|
||||
|
||||
if (code.startsWith('688')) {
|
||||
return 20.0; // 科创板
|
||||
}
|
||||
if (code.startsWith('30')) {
|
||||
return 20.0; // 创业板
|
||||
}
|
||||
if (code.startsWith('8')) {
|
||||
return 30.0; // 北交所
|
||||
}
|
||||
return 10.0; // 主板
|
||||
};
|
||||
|
||||
/**
|
||||
* 解析连板天数
|
||||
* 例如 "2连板" -> 2, "首板" -> 1
|
||||
@@ -448,7 +471,7 @@ export const fetchHighPositionStocks = async (date: string): Promise<HighPositio
|
||||
stock_code: stock.scode,
|
||||
stock_name: stock.sname,
|
||||
price: 0, // 静态数据中没有实时价格
|
||||
increase_rate: 10.0, // 涨停固定 10%
|
||||
increase_rate: getLimitUpPercent(stock.scode), // 根据股票类型推断涨停幅度
|
||||
continuous_limit_up: days,
|
||||
industry: (stock.core_sectors || [])[0] || '未知',
|
||||
turnover_rate: 0, // 静态数据中没有换手率
|
||||
|
||||
@@ -6,6 +6,31 @@ import React, { memo, useMemo, useState, useCallback } from 'react';
|
||||
import { Box, Text, HStack, VStack, Icon, Table, Thead, Tbody, Tr, Th, Td, Badge, Tooltip } from '@chakra-ui/react';
|
||||
import { Activity, ArrowUp, ArrowDown, Zap, ChevronDown, ChevronUp } from 'lucide-react';
|
||||
|
||||
// ============ 辅助函数 ============
|
||||
|
||||
/**
|
||||
* 根据股票代码推断涨停幅度
|
||||
* - 主板(60开头、00开头):10%
|
||||
* - 科创板(688开头):20%
|
||||
* - 创业板(30开头):20%
|
||||
* - 北交所(8开头):30%
|
||||
*/
|
||||
const getLimitUpPercent = (scode: string | undefined): string => {
|
||||
if (!scode) return "10.00";
|
||||
const code = scode.replace(/\.\w+$/, ''); // 移除后缀如 .SZ .SH
|
||||
|
||||
if (code.startsWith('688')) {
|
||||
return "20.00"; // 科创板
|
||||
}
|
||||
if (code.startsWith('30')) {
|
||||
return "20.00"; // 创业板
|
||||
}
|
||||
if (code.startsWith('8')) {
|
||||
return "30.00"; // 北交所
|
||||
}
|
||||
return "10.00"; // 主板
|
||||
};
|
||||
|
||||
// ============ 类型定义 ============
|
||||
|
||||
interface Stock {
|
||||
@@ -114,7 +139,7 @@ const SectorMovementTable: React.FC<SectorMovementTableProps> = memo(({ sectorDa
|
||||
netInflow: typeof netInflow === 'number' ? netInflow : parseFloat(netInflow),
|
||||
leadingStock: leadingStock?.sname || info.leading_stock || '-',
|
||||
leadingStockCode: leadingStock?.scode || '',
|
||||
leadingStockChange: leadingStock?.change_pct || (Math.random() * 3 + 8).toFixed(2),
|
||||
leadingStockChange: leadingStock?.change_pct || getLimitUpPercent(leadingStock?.scode),
|
||||
stocks,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -24,6 +24,29 @@ import {
|
||||
bgColors,
|
||||
} from "@/constants/limitAnalyseTheme";
|
||||
|
||||
/**
|
||||
* 根据股票代码推断涨停幅度
|
||||
* - 主板(60开头、00开头):10%
|
||||
* - 科创板(688开头):20%
|
||||
* - 创业板(30开头):20%
|
||||
* - 北交所(8开头):30%
|
||||
*/
|
||||
function getLimitUpPercent(scode: string): string {
|
||||
if (!scode) return "10.00";
|
||||
const code = scode.replace(/\.\w+$/, ''); // 移除后缀如 .SZ .SH
|
||||
|
||||
if (code.startsWith('688')) {
|
||||
return "20.00"; // 科创板
|
||||
}
|
||||
if (code.startsWith('30')) {
|
||||
return "20.00"; // 创业板
|
||||
}
|
||||
if (code.startsWith('8')) {
|
||||
return "30.00"; // 北交所
|
||||
}
|
||||
return "10.00"; // 主板
|
||||
}
|
||||
|
||||
/** 获取板块颜色 */
|
||||
function getSectorTagColor(sector: string): string {
|
||||
if (sector === "公告") return "#D4AF37";
|
||||
@@ -136,7 +159,7 @@ const StockRow = memo<StockRowProps>(
|
||||
minW="70px"
|
||||
textAlign="center"
|
||||
>
|
||||
+{stock.change_pct || "10.00"}%
|
||||
+{stock.change_pct || getLimitUpPercent(stock.scode)}%
|
||||
</Text>
|
||||
|
||||
{/* 右侧:连板标签 + 板块标签 */}
|
||||
|
||||
Reference in New Issue
Block a user