+
+
+
+
+
+ {#if $isCrosshairMoveActive}
+ {displayLegend?.close}
+ {:else if !$isCrosshairMoveActive && $realtimePrice !== null}
+ {$realtimePrice}
+ {:else}
+ {displayLegend?.close}
+ {/if}
-
-
-
-
-
-
-
-
-
-
-
-
-
- {#if $isCrosshairMoveActive }
- {displayLegend?.close}
- {:else if !$isCrosshairMoveActive && $realtimePrice !== null}
- {$realtimePrice}
- {:else}
- {displayLegend?.close}
-
- {/if}
-
- {#if $priceIncrease === true}
-
- {:else if $priceIncrease === false}
-
- {/if}
-
-
-
-
-
-
-
-
- {#if displayLegend?.change >= 0}
-
-
+{displayLegend?.change}%
- {:else if displayLegend?.change < 0}
-
-
{displayLegend?.change}%
- {/if}
-
-
{displayLegend?.date}
-
-
-
-
-
-
-
- {#if Object?.keys(prePostData)?.length !== 0 && prePostData?.price !== 0}
-
-
-
- {prePostData?.price}
-
- {#if prePostData?.changesPercentage >= 0}
- ({prePostData?.changesPercentage}%)
- {:else if prePostData?.changesPercentage < 0}
- ({prePostData?.changesPercentage}%)
- {/if}
-
- {#if $isBeforeMarketOpen && !$isOpen && !$isWeekend}
-
- {:else}
-
- {/if}
-
-
- {/if}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ {#if $priceIncrease === true}
+
+ {:else if $priceIncrease === false}
+
+ {/if}
+
-
-
-
-
-
-
-
-
- {#if output !== null}
-
- {#if displayData === '1D' && oneDayPrice?.length === 0}
-
- No data available
-
- {:else if displayData === '1W' && oneWeekPrice?.length === 0}
-
- No data available
-
- {:else if displayData === '1M' && oneMonthPrice?.length === 0}
-
- No data available
-
- {:else if displayData === '6M' && sixMonthPrice?.length === 0}
-
- No data available
-
- {:else if displayData === '1Y' && oneYearPrice?.length === 0}
-
- No data available
-
- {:else if displayData === 'MAX' && threeYearPrice?.length === 0}
-
- No data available
-
- {:else}
-
-
chart = ref} on:crosshairMove={handleCrosshairMove} >
-
- {#if displayData === '1D'}
- {#if displayChartType === 'line'}
- ({ time, value: close }))}
- lineWidth={1.5}
- priceScaleId="left"
- lineColor={colorChange}
- topColor={topColorChange}
- bottomColor={bottomColorChange}
- crosshairMarkerVisible={false}
- ref={handleSeriesReference}
- priceLineVisible= {false}
- lastPriceAnimation={1}
- >
-
-
- {:else}
-
-
-
- {/if}
- {:else if displayData === '1W'}
- {#if displayChartType === 'line'}
- ({ time, value: close }))}
- lineWidth={1.5}
- priceScaleId="left"
- lineColor={colorChange}
- topColor={topColorChange}
- bottomColor={bottomColorChange}
- crosshairMarkerVisible={false}
- ref={handleSeriesReference}
- priceLineVisible= {false}
- lastPriceAnimation={1}
- >
-
-
- {:else}
-
-
-
- {/if}
-
- {:else if displayData === '1M'}
- {#if displayChartType === 'line'}
- ({ time, value: close }))}
- lineWidth={1.5}
- priceScaleId="left"
- lineColor={colorChange}
- topColor={topColorChange}
- bottomColor={bottomColorChange}
- crosshairMarkerVisible={false}
- ref={handleSeriesReference}
- priceLineVisible= {false}
- lastPriceAnimation={1}
- >
-
-
- {:else}
-
-
-
- {/if}
-
-
- {:else if displayData === '6M'}
- {#if displayChartType === 'line'}
- ({ time, value: close }))}
- lineWidth={1.5}
- priceScaleId="left"
- lineColor={colorChange}
- topColor={topColorChange}
- bottomColor={bottomColorChange}
- crosshairMarkerVisible={false}
- ref={handleSeriesReference}
- priceLineVisible= {false}
- lastPriceAnimation={1}
- >
-
-
- {:else}
-
-
-
- {/if}
-
-
-
- {:else if displayData === '1Y'}
- {#if displayChartType === 'line'}
- ({ time, value: close }))}
- lineWidth={1.5}
- priceScaleId="left"
- lineColor={colorChange}
- topColor={topColorChange}
- bottomColor={bottomColorChange}
- crosshairMarkerVisible={false}
- ref={handleSeriesReference}
- priceLineVisible= {false}
- lastPriceAnimation={1}
- >
-
-
- {:else}
-
-
-
- {/if}
-
-
-
- {:else if displayData === 'MAX'}
- {#if displayChartType === 'line'}
- ({ time, value: close }))}
- lineWidth={1.5}
- priceScaleId="left"
- lineColor={colorChange}
- topColor={topColorChange}
- bottomColor={bottomColorChange}
- crosshairMarkerVisible={false}
- ref={handleSeriesReference}
- priceLineVisible= {false}
- lastPriceAnimation={1}
- >
-
-
- {:else}
-
-
-
- {/if}
-
-
- {/if}
-
-
- {/if}
-
-
- {:else}
-
-
- {/if}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {#if ETFKeyInformation && $screenWidth <=1022}
-
-
-
-
-
- {/if}
+
+ {#if displayLegend?.change >= 0}
+
+
+{displayLegend?.change}%
+ {:else if displayLegend?.change < 0}
+
+
{displayLegend?.change}%
+
+ {/if}
-
-
-
- {#await import('$lib/components/WIIM.svelte') then {default: Comp}}
-
- {/await}
-
-
+
{displayLegend?.date}
+
+
-
-
- {#await import("$lib/components/FOMCImpact.svelte") then { default: Comp }}
-
- {/await}
-
-
-
-
-
- {#await import('$lib/components/VaR.svelte') then {default: Comp}}
-
- {/await}
-
-
-
-
-
- {#await import('$lib/components/OptionsData.svelte') then {default: Comp}}
-
- {/await}
-
-
+ {#if Object?.keys(prePostData)?.length !== 0 && prePostData?.price !== 0}
+
+
+
+ {prePostData?.price}
+
+ {#if prePostData?.changesPercentage >= 0}
+ ({prePostData?.changesPercentage}%)
+ {:else if prePostData?.changesPercentage < 0}
+ ({prePostData?.changesPercentage}%)
+ {/if}
+
+ {#if $isBeforeMarketOpen && !$isOpen && !$isWeekend}
+
+ {:else}
+
+ {/if}
+
+ {/if}
+
+
-
-
- {#await import('$lib/components/OptionsNetFlow.svelte') then {default: Comp}}
-
- {/await}
-
-
-
-
-
- {#await import("$lib/components/FailToDeliver.svelte") then { default: Comp }}
-
- {/await}
-
-
-
-
-
-
-
-
- {#if CountrySegmentation}
-
- {/if}
-
-
-
-
-
-
- {#if SectorSegmentation}
-
- {/if}
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
- {#await import('$lib/components/TARating.svelte') then {default: Comp}}
-
- {/await}
-
-
-
-
-
-
+
+
+
+
+ {#if output !== null}
+
+ {#if displayData === "1D" && oneDayPrice?.length === 0}
+
+ No data available
+
+ {:else if displayData === "1W" && oneWeekPrice?.length === 0}
+
+ No data available
+
+ {:else if displayData === "1M" && oneMonthPrice?.length === 0}
+
+ No data available
+
+ {:else if displayData === "6M" && sixMonthPrice?.length === 0}
+
+ No data available
+
+ {:else if displayData === "1Y" && oneYearPrice?.length === 0}
+
+ No data available
+
+ {:else if displayData === "MAX" && threeYearPrice?.length === 0}
+
+ No data available
+
+ {:else}
+
(chart = ref)}
+ on:crosshairMove={handleCrosshairMove}
+ >
+ {#if displayData === "1D"}
+ {#if displayChartType === "line"}
+ ({
+ time,
+ value: close,
+ }))}
+ lineWidth={1.5}
+ priceScaleId="left"
+ lineColor={colorChange}
+ topColor={topColorChange}
+ bottomColor={bottomColorChange}
+ crosshairMarkerVisible={false}
+ ref={handleSeriesReference}
+ priceLineVisible={false}
+ lastPriceAnimation={1}
+ >
+
+
+ {:else}
+
+
+
+ {/if}
+ {:else if displayData === "1W"}
+ {#if displayChartType === "line"}
+ ({
+ time,
+ value: close,
+ }))}
+ lineWidth={1.5}
+ priceScaleId="left"
+ lineColor={colorChange}
+ topColor={topColorChange}
+ bottomColor={bottomColorChange}
+ crosshairMarkerVisible={false}
+ ref={handleSeriesReference}
+ priceLineVisible={false}
+ lastPriceAnimation={1}
+ >
+
+
+ {:else}
+
+
+
+ {/if}
+ {:else if displayData === "1M"}
+ {#if displayChartType === "line"}
+ ({
+ time,
+ value: close,
+ }))}
+ lineWidth={1.5}
+ priceScaleId="left"
+ lineColor={colorChange}
+ topColor={topColorChange}
+ bottomColor={bottomColorChange}
+ crosshairMarkerVisible={false}
+ ref={handleSeriesReference}
+ priceLineVisible={false}
+ lastPriceAnimation={1}
+ >
+
+
+ {:else}
+
+
+
+ {/if}
+ {:else if displayData === "6M"}
+ {#if displayChartType === "line"}
+ ({
+ time,
+ value: close,
+ }))}
+ lineWidth={1.5}
+ priceScaleId="left"
+ lineColor={colorChange}
+ topColor={topColorChange}
+ bottomColor={bottomColorChange}
+ crosshairMarkerVisible={false}
+ ref={handleSeriesReference}
+ priceLineVisible={false}
+ lastPriceAnimation={1}
+ >
+
+
+ {:else}
+
+
+
+ {/if}
+ {:else if displayData === "1Y"}
+ {#if displayChartType === "line"}
+ ({
+ time,
+ value: close,
+ }))}
+ lineWidth={1.5}
+ priceScaleId="left"
+ lineColor={colorChange}
+ topColor={topColorChange}
+ bottomColor={bottomColorChange}
+ crosshairMarkerVisible={false}
+ ref={handleSeriesReference}
+ priceLineVisible={false}
+ lastPriceAnimation={1}
+ >
+
+
+ {:else}
+
+
+
+ {/if}
+ {:else if displayData === "MAX"}
+ {#if displayChartType === "line"}
+ ({
+ time,
+ value: close,
+ }))}
+ lineWidth={1.5}
+ priceScaleId="left"
+ lineColor={colorChange}
+ topColor={topColorChange}
+ bottomColor={bottomColorChange}
+ crosshairMarkerVisible={false}
+ ref={handleSeriesReference}
+ priceLineVisible={false}
+ lastPriceAnimation={1}
+ >
+
+
+ {:else}
+
+
+
+ {/if}
+ {/if}
+
+ {/if}
+
+ {:else}
+
+
+ {/if}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {#if ETFKeyInformation && $screenWidth <= 1022}
+
+
+
+
+
+ {/if}
+
+
+
+ {#await import("$lib/components/WIIM.svelte") then { default: Comp }}
+
+ {/await}
+
+
+
+
+
+ {#await import("$lib/components/FOMCImpact.svelte") then { default: Comp }}
+
+ {/await}
+
+
+
+
+
+ {#await import("$lib/components/VaR.svelte") then { default: Comp }}
+
+ {/await}
+
+
+
+
+
+ {#await import("$lib/components/OptionsData.svelte") then { default: Comp }}
+
+ {/await}
+
+
+
+
+
+ {#await import("$lib/components/OptionsNetFlow.svelte") then { default: Comp }}
+
+ {/await}
+
+
+
+
+
+ {#await import("$lib/components/FailToDeliver.svelte") then { default: Comp }}
+
+ {/await}
+
+
+
+
+
+
+
+ {#if CountrySegmentation}
+
+ {/if}
+
+
+
+
+
+ {#if SectorSegmentation}
+
+ {/if}
+
+
+
+
+
+ {#await import("$lib/components/TARating.svelte") then { default: Comp }}
+
+ {/await}
+
+
+
+
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+ }
+
+ :root {
+ --date-picker-background: #09090b;
+ --date-picker-foreground: #f7f7f7;
+ }
+
diff --git a/src/routes/stocks/[tickerID]/+page.svelte b/src/routes/stocks/[tickerID]/+page.svelte
index f9b00005..21225137 100644
--- a/src/routes/stocks/[tickerID]/+page.svelte
+++ b/src/routes/stocks/[tickerID]/+page.svelte
@@ -709,6 +709,48 @@
async function exportData(timePeriod: string) {
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 }) => ({
+ date: timePeriod === "max" ? time : date, // Use 'time' if timePeriod is "max", otherwise use 'date'
+ open,
+ high,
+ low,
+ close,
+ }));
+
+ const csvRows = [];
+
+ // Add headers row
+ csvRows.push("time,open,high,low,close");
+
+ // Add data rows
+ for (const row of exportList) {
+ const csvRow = `${row.date},${row.open},${row.high},${row.low},${row.close}`;
+ 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);
+ /*
if (data?.user) {
const response = await fetch("/api/historical-price", {
method: "POST",
@@ -757,6 +799,7 @@
style: "border-radius: 200px; background: #333; color: #fff;",
});
}
+ */
}
function updateClosePrice(data, extendPriceChart) {
@@ -1097,37 +1140,38 @@
/>
+
+
+
+ {/if}