feat(types): add TypeScript definitions for TradingView and Datafeeds
This commit is contained in:
22
src/tradingview/index.tsx
Normal file
22
src/tradingview/index.tsx
Normal 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" />;
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user