|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
import { signal } from "@preact/signals";
|
|
|
|
|
import { useCallback, useEffect } from "preact/hooks";
|
|
|
|
|
import { signal, computed } from "@preact/signals";
|
|
|
|
|
import { useEffect } from "preact/hooks";
|
|
|
|
|
import {trpc} from '../../trpc.js';
|
|
|
|
|
import {
|
|
|
|
|
Chart as ChartJS,
|
|
|
|
@ -35,6 +35,13 @@ const historicalCalendarExitQuoteChartData = signal([]);
|
|
|
|
|
const chosenLookbackPeriodStart = signal("2022-01-01");
|
|
|
|
|
const chosenLookbackPeriodEnd = signal("2024-01-01");
|
|
|
|
|
|
|
|
|
|
const maxChartPrice = computed(()=>
|
|
|
|
|
Math.max(
|
|
|
|
|
Math.max.apply(null, historicalCalendarQuoteChartData.value.map(d=>d.y)),
|
|
|
|
|
Math.max.apply(null, historicalCalendarExitQuoteChartData.value.map(d=>d.y)),
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const refreshHistoricalStockQuoteChartData = ()=>{
|
|
|
|
|
trpc.getHistoricalStockQuoteChartData
|
|
|
|
@ -212,7 +219,9 @@ export function HistoricalCalendarPrices(){
|
|
|
|
|
callback: function(value, index, ticks) {
|
|
|
|
|
return (new Date(value as number*1000)).toISOString().substring(0,10);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
min: (new Date(chosenLookbackPeriodStart.value)).getTime()/1000,
|
|
|
|
|
max: (new Date(chosenLookbackPeriodEnd.value)).getTime()/1000,
|
|
|
|
|
},
|
|
|
|
|
y: {
|
|
|
|
|
beginAtZero: false,
|
|
|
|
@ -271,7 +280,9 @@ export function HistoricalCalendarPrices(){
|
|
|
|
|
callback: function(value, index, ticks) {
|
|
|
|
|
return (new Date(value as number*1000)).toISOString().substring(0,10);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
min: (new Date(chosenLookbackPeriodStart.value)).getTime()/1000,
|
|
|
|
|
max: (new Date(chosenLookbackPeriodEnd.value)).getTime()/1000,
|
|
|
|
|
},
|
|
|
|
|
y: {
|
|
|
|
|
beginAtZero: true,
|
|
|
|
@ -279,7 +290,9 @@ export function HistoricalCalendarPrices(){
|
|
|
|
|
callback: function(value, index, ticks) {
|
|
|
|
|
return "$"+value.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
min: 0,
|
|
|
|
|
max: maxChartPrice.value,
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
plugins: {
|
|
|
|
@ -325,7 +338,7 @@ export function HistoricalCalendarPrices(){
|
|
|
|
|
callback: function(value, index, ticks) {
|
|
|
|
|
return value.toString()+"%";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
y: {
|
|
|
|
|
beginAtZero: true,
|
|
|
|
@ -333,7 +346,9 @@ export function HistoricalCalendarPrices(){
|
|
|
|
|
callback: function(value, index, ticks) {
|
|
|
|
|
return "$"+value.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
min: 0,
|
|
|
|
|
max: maxChartPrice.value,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
elements: {
|
|
|
|
|