feat(types): add TypeScript definitions for TradingView and Datafeeds

This commit is contained in:
2025-12-29 23:09:52 +07:00
parent ae0e73a4e8
commit 0741b7b507
8 changed files with 32109 additions and 2 deletions

22
src/tradingview/index.tsx Normal file
View File

@@ -0,0 +1,22 @@
import type { ResolutionString } from "#/datafeed-api";
export const TradingViewChart = defineComponent({
name: "TradingViewChart",
setup(props, ctx) {
const chartContainer = ref<HTMLDivElement>();
onMounted(() => {
// eslint-disable-next-line new-cap
const tradingView = new TradingView.widget({
container: chartContainer.value!,
locale: "en",
library_path: "http://localhost:6173/charting_library/",
datafeed: new Datafeeds.UDFCompatibleDatafeed("https://demo-feed-data.tradingview.com"),
symbol: "AAPL",
interval: "1D" as ResolutionString,
debug: true,
});
});
return () => <div ref={chartContainer} class="w-full h-150" />;
},
});