|
@@ -55,13 +55,13 @@ const StockHistoryItemSchema = z.object({
|
|
|
example: 78.85
|
|
example: 78.85
|
|
|
}),
|
|
}),
|
|
|
zd: z.number().openapi({
|
|
zd: z.number().openapi({
|
|
|
- description: '涨跌额',
|
|
|
|
|
- example: 496.07
|
|
|
|
|
- }),
|
|
|
|
|
- zde: z.number().openapi({
|
|
|
|
|
description: '涨跌幅',
|
|
description: '涨跌幅',
|
|
|
- example: 44.2
|
|
|
|
|
|
|
+ example: 496.07
|
|
|
}),
|
|
}),
|
|
|
|
|
+ // pc: z.number().openapi({
|
|
|
|
|
+ // description: '涨跌额',
|
|
|
|
|
+ // example: 44.2
|
|
|
|
|
+ // }),
|
|
|
ud: z.string().openapi({
|
|
ud: z.string().openapi({
|
|
|
description: '最后更新时间',
|
|
description: '最后更新时间',
|
|
|
example: '2025-06-29 02:13:11'
|
|
example: '2025-06-29 02:13:11'
|
|
@@ -135,7 +135,7 @@ const app = new OpenAPIHono<AuthContext>().openapi(routeDef, async (c) => {
|
|
|
zf: 0, // 振幅 (计算值)
|
|
zf: 0, // 振幅 (计算值)
|
|
|
hs: 0, // 换手率 (计算值)
|
|
hs: 0, // 换手率 (计算值)
|
|
|
zd: 0, // 涨跌额 (计算值)
|
|
zd: 0, // 涨跌额 (计算值)
|
|
|
- zde: 0, // 涨跌幅 (计算值)
|
|
|
|
|
|
|
+ // pc: 0, // 涨跌幅 (计算值)
|
|
|
ud: new Date().toISOString() // 最后更新时间
|
|
ud: new Date().toISOString() // 最后更新时间
|
|
|
}));
|
|
}));
|
|
|
|
|
|
|
@@ -146,20 +146,20 @@ const app = new OpenAPIHono<AuthContext>().openapi(routeDef, async (c) => {
|
|
|
return {
|
|
return {
|
|
|
...item,
|
|
...item,
|
|
|
zd: 0,
|
|
zd: 0,
|
|
|
- zde: 0,
|
|
|
|
|
|
|
+ // pc: 0,
|
|
|
zf: 0
|
|
zf: 0
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const prevItem = array[index - 1];
|
|
const prevItem = array[index - 1];
|
|
|
const zd = item.c - prevItem.c; // 涨跌额
|
|
const zd = item.c - prevItem.c; // 涨跌额
|
|
|
- const zde = prevItem.c !== 0 ? (zd / prevItem.c) * 100 : 0; // 涨跌幅百分比
|
|
|
|
|
|
|
+ // const pc = prevItem.c !== 0 ? (zd / prevItem.c) * 100 : 0; // 涨跌幅百分比
|
|
|
const zf = prevItem.c !== 0 ? ((item.h - item.l) / prevItem.c) * 100 : 0; // 振幅百分比
|
|
const zf = prevItem.c !== 0 ? ((item.h - item.l) / prevItem.c) * 100 : 0; // 振幅百分比
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
...item,
|
|
...item,
|
|
|
zd: parseFloat(zd.toFixed(2)),
|
|
zd: parseFloat(zd.toFixed(2)),
|
|
|
- zde: parseFloat(zde.toFixed(2)),
|
|
|
|
|
|
|
+ // pc: parseFloat(pc.toFixed(2)),
|
|
|
zf: parseFloat(zf.toFixed(2))
|
|
zf: parseFloat(zf.toFixed(2))
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|