diff --git a/src/routes/etf/[tickerID]/+page.svelte b/src/routes/etf/[tickerID]/+page.svelte index fdb3005c..d8af8163 100644 --- a/src/routes/etf/[tickerID]/+page.svelte +++ b/src/routes/etf/[tickerID]/+page.svelte @@ -622,58 +622,6 @@ } } - async function exportData(timePeriod: string) { - if (data?.user?.tier === "Pro") { - let exportList = []; - - const response = await fetch("/api/export-price-data", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ ticker: $etfTicker, timePeriod: timePeriod }), - }); - - exportList = await response.json(); - - exportList = exportList?.map( - ({ time, open, high, low, close, date, volume }) => ({ - date: timePeriod === "max" ? time : date, // Use 'time' if timePeriod is "max", otherwise use 'date' - open, - high, - low, - close, - volume, - }), - ); - - const csvRows = []; - - // Add headers row - csvRows.push("time,open,high,low,close, volume"); - - // Add data rows - for (const row of exportList) { - const csvRow = `${row.date},${row.open},${row.high},${row.low},${row.close},${row.volume}`; - csvRows.push(csvRow); - } - - // Create CSV blob and trigger download - const csv = csvRows.join("\n"); - const blob = new Blob([csv], { type: "text/csv" }); - const url = window.URL.createObjectURL(blob); - const a = document.createElement("a"); - a.setAttribute("hidden", ""); - a.setAttribute("href", url); - a.setAttribute("download", `${$etfTicker}_${timePeriod}.csv`); - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - } else { - goto("/pricing"); - } - } - function updateClosePrice(data, extendPriceChart) { const newDateParsedUTC = Date?.parse(extendPriceChart?.time + "Z") / 1000; // Parse the incoming time const closePrice = extendPriceChart?.price; // Store the close price for easier reference @@ -897,113 +845,6 @@ - - - diff --git a/src/routes/stocks/[tickerID]/+page.svelte b/src/routes/stocks/[tickerID]/+page.svelte index cf4e52a0..30c4e2db 100644 --- a/src/routes/stocks/[tickerID]/+page.svelte +++ b/src/routes/stocks/[tickerID]/+page.svelte @@ -25,9 +25,6 @@ import Sidecard from "$lib/components/Sidecard.svelte"; import { convertTimestamp, abbreviateNumber } from "$lib/utils"; - import { Button } from "$lib/components/shadcn/button/index.js"; - import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.js"; - import { goto } from "$app/navigation"; export let data; export let form; @@ -596,58 +593,6 @@ } } - async function exportData(timePeriod: string) { - if (data?.user?.tier === "Pro") { - let exportList = []; - - const response = await fetch("/api/export-price-data", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ ticker: $stockTicker, timePeriod: timePeriod }), - }); - - exportList = await response.json(); - - exportList = exportList?.map( - ({ time, open, high, low, close, date, volume }) => ({ - date: timePeriod === "max" ? time : date, // Use 'time' if timePeriod is "max", otherwise use 'date' - open, - high, - low, - close, - volume, - }), - ); - - const csvRows = []; - - // Add headers row - csvRows.push("time,open,high,low,close, volume"); - - // Add data rows - for (const row of exportList) { - const csvRow = `${row.date},${row.open},${row.high},${row.low},${row.close},${row.volume}`; - csvRows.push(csvRow); - } - - // Create CSV blob and trigger download - const csv = csvRows.join("\n"); - const blob = new Blob([csv], { type: "text/csv" }); - const url = window.URL.createObjectURL(blob); - const a = document.createElement("a"); - a.setAttribute("hidden", ""); - a.setAttribute("href", url); - a.setAttribute("download", `${$stockTicker}_${timePeriod}.csv`); - document.body.appendChild(a); - a.click(); - document.body.removeChild(a); - } else { - goto("/pricing"); - } - } - function updateClosePrice(data, extendPriceChart) { const newDateParsedUTC = Date?.parse(extendPriceChart?.time + "Z") / 1000; // Parse the incoming time const closePrice = extendPriceChart?.price; // Store the close price for easier reference @@ -770,100 +715,7 @@ >
-
- - - +