- Add useStock, useStockCandles, useStockDividends, useBond, useBondCandles hooks - Add StockDetails component with full share info - Add BondDetails component with full bond info (NKD, YTM, duration, coupon) - Add PriceChart component using lightweight-charts (candlestick chart) - Update StockPage and BondPage with details, charts, and dividends table
15 lines
387 B
TypeScript
15 lines
387 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { getShare } from '../api/client';
|
|
import type { ShareResponse } from '../api/responses';
|
|
|
|
export function useStock(secid: string) {
|
|
return useQuery<ShareResponse>({
|
|
queryKey: ['stock', secid],
|
|
queryFn: async () => {
|
|
const res = await getShare(secid);
|
|
return res.data;
|
|
},
|
|
staleTime: 900_000,
|
|
});
|
|
}
|