|
|
|
@ -49,20 +49,20 @@ const maxChartPrice = computed(() =>
|
|
|
|
|
Math.max(
|
|
|
|
|
Math.max.apply(
|
|
|
|
|
null,
|
|
|
|
|
historicalCalendarQuoteChartData.value.map((d) => d.y)
|
|
|
|
|
historicalCalendarQuoteChartData.value.map((d) => d.y),
|
|
|
|
|
),
|
|
|
|
|
Math.max.apply(
|
|
|
|
|
null,
|
|
|
|
|
historicalCalendarExitQuoteChartData.value.map((d) => d.y)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
historicalCalendarExitQuoteChartData.value.map((d) => d.y),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const maxN = computed(() =>
|
|
|
|
|
Math.max.apply(
|
|
|
|
|
null,
|
|
|
|
|
historicalCalendarExitQuoteChartData.value.map((d) => d.n)
|
|
|
|
|
)
|
|
|
|
|
historicalCalendarExitQuoteChartData.value.map((d) => d.n),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const refreshHistoricalStockQuoteChartData = () => {
|
|
|
|
@ -134,16 +134,19 @@ const handleUnderlyingChange = (e) => {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const handleDaysToFrontExpirationChange = (e) => {
|
|
|
|
|
if (chosenDaysToFrontExpiration.value !== parseInt(e.target.value)) {
|
|
|
|
|
chosenDaysToFrontExpiration.value = parseInt(e.target.value);
|
|
|
|
|
if (chosenDaysToFrontExpiration.value !== Number.parseInt(e.target.value)) {
|
|
|
|
|
chosenDaysToFrontExpiration.value = Number.parseInt(e.target.value);
|
|
|
|
|
refreshHistoricalCalendarQuoteChartData();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const handleDaysBetweenFrontAndBackExpirationChange = (e) => {
|
|
|
|
|
if (
|
|
|
|
|
chosenDaysBetweenFrontAndBackExpiration.value !== parseInt(e.target.value)
|
|
|
|
|
chosenDaysBetweenFrontAndBackExpiration.value !==
|
|
|
|
|
Number.parseInt(e.target.value)
|
|
|
|
|
) {
|
|
|
|
|
chosenDaysBetweenFrontAndBackExpiration.value = parseInt(e.target.value);
|
|
|
|
|
chosenDaysBetweenFrontAndBackExpiration.value = Number.parseInt(
|
|
|
|
|
e.target.value,
|
|
|
|
|
);
|
|
|
|
|
refreshHistoricalCalendarQuoteChartData();
|
|
|
|
|
refreshHistoricalCalendarExitQuoteChartData();
|
|
|
|
|
}
|
|
|
|
@ -151,10 +154,10 @@ const handleDaysBetweenFrontAndBackExpirationChange = (e) => {
|
|
|
|
|
const handleStrikePercentageFromUnderlyingPriceChange = (e) => {
|
|
|
|
|
if (
|
|
|
|
|
chosenStrikePercentageFromUnderlyingPrice.value !==
|
|
|
|
|
parseFloat(e.target.value)
|
|
|
|
|
Number.parseFloat(e.target.value)
|
|
|
|
|
) {
|
|
|
|
|
chosenStrikePercentageFromUnderlyingPrice.value = parseFloat(
|
|
|
|
|
e.target.value
|
|
|
|
|
chosenStrikePercentageFromUnderlyingPrice.value = Number.parseFloat(
|
|
|
|
|
e.target.value,
|
|
|
|
|
);
|
|
|
|
|
refreshHistoricalCalendarQuoteChartData();
|
|
|
|
|
}
|
|
|
|
@ -162,17 +165,17 @@ const handleStrikePercentageFromUnderlyingPriceChange = (e) => {
|
|
|
|
|
const handleStrikePercentageFromUnderlyingPriceRadiusChange = (e) => {
|
|
|
|
|
if (
|
|
|
|
|
chosenStrikePercentageFromUnderlyingPriceRadius.value !==
|
|
|
|
|
parseFloat(e.target.value)
|
|
|
|
|
Number.parseFloat(e.target.value)
|
|
|
|
|
) {
|
|
|
|
|
chosenStrikePercentageFromUnderlyingPriceRadius.value = parseFloat(
|
|
|
|
|
e.target.value
|
|
|
|
|
chosenStrikePercentageFromUnderlyingPriceRadius.value = Number.parseFloat(
|
|
|
|
|
e.target.value,
|
|
|
|
|
);
|
|
|
|
|
refreshHistoricalCalendarQuoteChartData();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const handleExitToFrontExpirationChange = (e) => {
|
|
|
|
|
if (chosenExitToFrontExpiration.value !== parseInt(e.target.value)) {
|
|
|
|
|
chosenExitToFrontExpiration.value = parseInt(e.target.value);
|
|
|
|
|
if (chosenExitToFrontExpiration.value !== Number.parseInt(e.target.value)) {
|
|
|
|
|
chosenExitToFrontExpiration.value = Number.parseInt(e.target.value);
|
|
|
|
|
refreshHistoricalCalendarExitQuoteChartData();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -260,7 +263,9 @@ export function HistoricalCalendarPrices() {
|
|
|
|
|
label="Strike % Radius"
|
|
|
|
|
type="number"
|
|
|
|
|
value={chosenStrikePercentageFromUnderlyingPriceRadius.value}
|
|
|
|
|
onChange={handleStrikePercentageFromUnderlyingPriceRadiusChange}
|
|
|
|
|
onChange={
|
|
|
|
|
handleStrikePercentageFromUnderlyingPriceRadiusChange
|
|
|
|
|
}
|
|
|
|
|
InputProps={{ endAdornment: "%" }}
|
|
|
|
|
/>
|
|
|
|
|
</Grid>
|
|
|
|
@ -280,25 +285,33 @@ export function HistoricalCalendarPrices() {
|
|
|
|
|
label="Lookback Period Start"
|
|
|
|
|
type="date"
|
|
|
|
|
value={chosenLookbackPeriodStart.value}
|
|
|
|
|
onChange={(e) => handleLookbackPeriodStartChange({ target: { value: e.target.value } })}
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
handleLookbackPeriodStartChange({
|
|
|
|
|
target: { value: e.target.value },
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
InputLabelProps={{ shrink: true }}
|
|
|
|
|
/>
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={6}>
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={6}>
|
|
|
|
|
<TextField
|
|
|
|
|
fullWidth
|
|
|
|
|
label="Lookback Period End"
|
|
|
|
|
type="date"
|
|
|
|
|
value={chosenLookbackPeriodEnd.value}
|
|
|
|
|
onChange={(e) => handleLookbackPeriodEndChange({ target: { value: e.target.value } })}
|
|
|
|
|
onChange={(e) =>
|
|
|
|
|
handleLookbackPeriodEndChange({
|
|
|
|
|
target: { value: e.target.value },
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
InputLabelProps={{ shrink: true }}
|
|
|
|
|
/>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Paper>
|
|
|
|
|
</Grid>
|
|
|
|
|
<Grid item xs={12} md={6}>
|
|
|
|
|
<Paper elevation={3} sx={{ p: 3, height: '100%' }}>
|
|
|
|
|
<Paper elevation={3} sx={{ p: 3, height: "100%" }}>
|
|
|
|
|
{chosenUnderlying.value !== null &&
|
|
|
|
|
historicalStockQuoteChartData.value.length > 0 ? (
|
|
|
|
|
<Scatter
|
|
|
|
@ -318,11 +331,10 @@ export function HistoricalCalendarPrices() {
|
|
|
|
|
text: "Time",
|
|
|
|
|
},
|
|
|
|
|
ticks: {
|
|
|
|
|
callback: function (value, index, ticks) {
|
|
|
|
|
return new Date((value as number) * 1000)
|
|
|
|
|
callback: (value, index, ticks) =>
|
|
|
|
|
new Date((value as number) * 1000)
|
|
|
|
|
.toISOString()
|
|
|
|
|
.substring(0, 10);
|
|
|
|
|
},
|
|
|
|
|
.substring(0, 10),
|
|
|
|
|
},
|
|
|
|
|
min:
|
|
|
|
|
new Date(chosenLookbackPeriodStart.value).getTime() /
|
|
|
|
@ -334,9 +346,8 @@ export function HistoricalCalendarPrices() {
|
|
|
|
|
y: {
|
|
|
|
|
beginAtZero: false,
|
|
|
|
|
ticks: {
|
|
|
|
|
callback: function (value, index, ticks) {
|
|
|
|
|
return "$" + value.toString();
|
|
|
|
|
},
|
|
|
|
|
callback: (value, index, ticks) =>
|
|
|
|
|
`$${value.toString()}`,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
@ -389,11 +400,10 @@ export function HistoricalCalendarPrices() {
|
|
|
|
|
text: "Time",
|
|
|
|
|
},
|
|
|
|
|
ticks: {
|
|
|
|
|
callback: function (value, index, ticks) {
|
|
|
|
|
return new Date((value as number) * 1000)
|
|
|
|
|
callback: (value, index, ticks) =>
|
|
|
|
|
new Date((value as number) * 1000)
|
|
|
|
|
.toISOString()
|
|
|
|
|
.substring(0, 10);
|
|
|
|
|
},
|
|
|
|
|
.substring(0, 10),
|
|
|
|
|
},
|
|
|
|
|
min:
|
|
|
|
|
new Date(chosenLookbackPeriodStart.value).getTime() /
|
|
|
|
@ -405,9 +415,8 @@ export function HistoricalCalendarPrices() {
|
|
|
|
|
y: {
|
|
|
|
|
beginAtZero: true,
|
|
|
|
|
ticks: {
|
|
|
|
|
callback: function (value, index, ticks) {
|
|
|
|
|
return "$" + value.toString();
|
|
|
|
|
},
|
|
|
|
|
callback: (value, index, ticks) =>
|
|
|
|
|
`$${value.toString()}`,
|
|
|
|
|
},
|
|
|
|
|
min: 0,
|
|
|
|
|
max: maxChartPrice.value,
|
|
|
|
@ -458,17 +467,15 @@ export function HistoricalCalendarPrices() {
|
|
|
|
|
text: "%-From-the-Money",
|
|
|
|
|
},
|
|
|
|
|
ticks: {
|
|
|
|
|
callback: function (value, index, ticks) {
|
|
|
|
|
return value.toString() + "%";
|
|
|
|
|
},
|
|
|
|
|
callback: (value, index, ticks) =>
|
|
|
|
|
`${value.toString()}%`,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
y: {
|
|
|
|
|
beginAtZero: true,
|
|
|
|
|
ticks: {
|
|
|
|
|
callback: function (value, index, ticks) {
|
|
|
|
|
return "$" + value.toString();
|
|
|
|
|
},
|
|
|
|
|
callback: (value, index, ticks) =>
|
|
|
|
|
`$${value.toString()}`,
|
|
|
|
|
},
|
|
|
|
|
min: 0,
|
|
|
|
|
max: maxChartPrice.value,
|
|
|
|
@ -477,7 +484,7 @@ export function HistoricalCalendarPrices() {
|
|
|
|
|
elements: {
|
|
|
|
|
point: {
|
|
|
|
|
borderWidth: 0,
|
|
|
|
|
backgroundColor: function (context) {
|
|
|
|
|
backgroundColor: (context) => {
|
|
|
|
|
const n = (
|
|
|
|
|
context.raw as { x: number; y: number; n: number }
|
|
|
|
|
).n;
|
|
|
|
|