@officefield/tv-market-pulse
v1.2.0
Published
A Vue 3 widget that displays **trending market indexes** with an interactive area chart. Built for [Traderverse](https://traderverse.io), it fetches data from configurable APIs and supports multiple symbols and time ranges.
Downloads
154
Readme
TV Market Pulse
A Vue 3 widget that displays trending market indexes with an interactive area chart. Built for Traderverse, it fetches data from configurable APIs and supports multiple symbols and time ranges.
Features
- Trending indexes – Fetches and displays a list of trending symbols (e.g. SPY, QQQ) from your API
- Symbol tabs – Custom horizontal slider (prev/next) to select one or more symbols; chart updates when selection changes
- Area chart – ApexCharts-based area chart with gradient fill, dark theme, and percentage-based Y-axis
- Time ranges – 1 Day, 5 Days, 1 Month, 6 Months, 1 Year (interval sent to chart API)
- Loading & error states – Spinner, error message, and empty state when no data
Tech stack
- Vue 3 (Composition API,
<script setup>) - Vite (dev server + library build)
- ApexCharts (vue3-apexcharts) for the area chart
- Axios for API requests
- Sass for styles
- @splidejs/vue-splide (Sass theme imported in widget; demo app registers it globally)
Installation
npm install @officefield/tv-market-pulsePeer dependencies (install in your app if not already present):
vue^3.2.41@vitejs/plugin-vue^3.2.0 (for Vite projects)sass-embedded^1.80.2 (orsass)
Usage
As a library (in your Vue app)
- Import the component and styles, then use
<MarketPulse>:
<script setup>
import MarketPulse from '@officefield/tv-market-pulse';
import '@officefield/tv-market-pulse/style';
</script>
<template>
<MarketPulse
:trendingIndexURL="trendingIndexURL"
:chartURL="chartURL"
/>
</template>- Optional: pass your own API base URLs (defaults point to Traderverse):
const trendingIndexURL = 'https://facts.traderverse.io/api/v1/discover/trending_indexes';
const chartURL = 'https://facts.traderverse.io/api/v1/discover/chart';- If the chart does not render, register the ApexCharts component in your app:
app.component('apexchart', VueApexCharts)(importVueApexChartsfromvue3-apexcharts).
Props
| Prop | Type | Required | Default | Description |
|--------------------|--------|----------|-------------------------------------------------------------------------|--------------------------------------|
| title | String | Yes | — | Title for the widget. |
| token | String | No | — | Optional auth token for API calls. |
| trendingIndexURL | String | No | https://facts.traderverse.io/api/v1/discover/trending_indexes | URL for trending indexes list. |
| chartURL | String | No | https://facts.traderverse.io/api/v1/discover/chart | URL for chart time-series data. |
API expectations:
- Trending indexes: GET request; response is expected to have
data.data.records, each record with at leastticker(array of ticker symbols, e.g.["SPY"]). - Chart: GET request with query params
index(symbol or array of symbols) andinterval(1d,5d,1m,6m,1y). Response is expected to havedata.dataas an object keyed by symbol, each value an array of[timestamp, value]pairs.
Development
# Install dependencies
npm install
# Dev server (demo app in src/App.vue)
npm run dev
# Library build (output in dist/)
npm run build
# Preview production build
npm run previewThe demo app uses src/main.js (registers VueApexCharts and VueSplide globally) and src/App.vue, which passes the default Traderverse URLs and a title prop. Change the URLs in App.vue to point at your own APIs.
Project structure
src/components/MarketPulse.vue– Main widget (symbol slider + area chart)src/components/SelectBox.vue– Reusable select component (used internally)src/components/index.js– Library entry (exportsMarketPulseonly)src/App.vue– Demo app root componentsrc/main.js– Demo app entry (registers VueApexCharts, VueSplide, mounts App)index.html– Demo app HTML entryvite.config.js– Vite config with library build (entry:src/components/index.js)
License
See repository license file.
