first commit
This commit is contained in:
40
frontend/src/hooks/useTickerDetail.ts
Normal file
40
frontend/src/hooks/useTickerDetail.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { getOHLCV } from '../api/ohlcv';
|
||||
import { getScores } from '../api/scores';
|
||||
import { getLevels } from '../api/sr-levels';
|
||||
import { getSentiment } from '../api/sentiment';
|
||||
import { getFundamentals } from '../api/fundamentals';
|
||||
|
||||
export function useTickerDetail(symbol: string) {
|
||||
const ohlcv = useQuery({
|
||||
queryKey: ['ohlcv', symbol],
|
||||
queryFn: () => getOHLCV(symbol),
|
||||
enabled: !!symbol,
|
||||
});
|
||||
|
||||
const scores = useQuery({
|
||||
queryKey: ['scores', symbol],
|
||||
queryFn: () => getScores(symbol),
|
||||
enabled: !!symbol,
|
||||
});
|
||||
|
||||
const srLevels = useQuery({
|
||||
queryKey: ['sr-levels', symbol],
|
||||
queryFn: () => getLevels(symbol),
|
||||
enabled: !!symbol,
|
||||
});
|
||||
|
||||
const sentiment = useQuery({
|
||||
queryKey: ['sentiment', symbol],
|
||||
queryFn: () => getSentiment(symbol),
|
||||
enabled: !!symbol,
|
||||
});
|
||||
|
||||
const fundamentals = useQuery({
|
||||
queryKey: ['fundamentals', symbol],
|
||||
queryFn: () => getFundamentals(symbol),
|
||||
enabled: !!symbol,
|
||||
});
|
||||
|
||||
return { ohlcv, scores, srLevels, sentiment, fundamentals };
|
||||
}
|
||||
Reference in New Issue
Block a user