From 26d8dec445b6180ae26976e034bd86fc79eecf46 Mon Sep 17 00:00:00 2001 From: mnsrulz Date: Tue, 24 Sep 2024 23:34:29 -0400 Subject: [PATCH] render delta hedging in print mode --- src/components/DeltaGammaHedging.tsx | 105 ++++++++++++++------------- 1 file changed, 54 insertions(+), 51 deletions(-) diff --git a/src/components/DeltaGammaHedging.tsx b/src/components/DeltaGammaHedging.tsx index b906c24..c9a414d 100644 --- a/src/components/DeltaGammaHedging.tsx +++ b/src/components/DeltaGammaHedging.tsx @@ -4,7 +4,7 @@ import { ChartsReferenceLine } from '@mui/x-charts'; import { OptionsHedgingData, useCachedDates, useDeltaGammaHedging } from "@/lib/socket"; import { getColorPallete } from "@/lib/color"; import { humanAbsCurrencyFormatter } from "@/lib/formatters"; -import { useQueryState, parseAsInteger, parseAsStringEnum } from "nuqs"; +import { useQueryState, parseAsInteger, parseAsStringEnum, parseAsBoolean } from "nuqs"; import { useState } from "react"; interface ITickerProps { @@ -117,6 +117,7 @@ export const Expo = (props: IExpo) => { export const DeltaGammaHedging = (props: ITickerProps) => { const { onClose } = props; + const [printMode] = useQueryState('print', parseAsBoolean.withDefault(false)); const [dte, setDte] = useQueryState('dte', parseAsInteger.withDefault(50)); const [strikeCounts, setStrikesCount] = useQueryState('sc', parseAsInteger.withDefault(30)); const { cachedDates } = useCachedDates(props.symbol); @@ -130,53 +131,54 @@ export const DeltaGammaHedging = (props: ITickerProps) => { return ( - - DTE - - - - Strikes - - - - Data Mode - - + {!printMode && ( + + DTE + + + + Strikes + + + + Data Mode + + { + )} { isLoading ? : data ? :
no data...
}
- + {!printMode && ( - -
+ )} + ); }; \ No newline at end of file