Skip to content

Commit

Permalink
working copy of screener
Browse files Browse the repository at this point in the history
  • Loading branch information
mnsrulz committed Jan 9, 2025
1 parent 1f6e900 commit c3480cd
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 147 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ yarn-error.log*
next-env.d.ts

.env
/rest/
/rest/

.vscode/
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"react-hook-form": "^7.51.2",
"react-hook-form-mui": "^7.0.0-beta.4",
"react-photo-view": "^1.2.6",
"react-resize-detector": "^12.0.2",
"react-router-dom": "^6.22.3",
"socket.io-client": "^4.7.5",
"sort-by": "^1.2.0",
Expand Down
56 changes: 30 additions & 26 deletions src/components/OptionSpreadPricingTimeSeriesChart.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
import { Box, Skeleton } from '@mui/material';
import { blue, brown, deepOrange, green } from '@mui/material/colors';
import UplotReact from 'uplot-react';
import 'uplot/dist/uPlot.min.css';

import { useResizeDetector } from 'react-resize-detector';
const strokes = [deepOrange[900], green[900], blue[900], brown[900]]

export const OptionSpreadPricingTimeSeriesChart = (props: { strategies: string[], data: any }) => {
const { data, strategies } = props;
const hasData = (data: any) => {
return (Array.isArray(data) && data.length > 0 && data[0].length > 0);
}

export const OptionSpreadPricingTimeSeriesChart = (props: { legends: string[], data: any, loading: boolean }) => {
const { data, legends: strategies, loading } = props;
const { width, height, ref } = useResizeDetector();
let series = [{}, ...strategies.map((j, ix) => ({ label: j, stroke: strokes[ix] }))]

let series = [{},
...strategies.map((j, ix) => ({ label: j, stroke: strokes[ix] }))
// {
// label: 'Option strategy pricing',
// stroke: '#007bff'
// }
]
return <UplotReact options={{
width: 1640,
height: 400,
cursor: {
sync: {
key: 'moo',
},
},
scales: {
x: {
distr: 2,
time: true,
},
},
series: series
}} data={data} />
if (loading || !hasData(data)) return <Skeleton variant="rectangular" width={width || 800} height={400} />

return <Box ref={ref}>
<UplotReact
options={{
width: width || 800,
height: 400,
cursor: {
sync: {
key: 'moo',
},
},
scales: {
x: {
distr: 2,
time: true,
},
},
series: series
}} data={data} />
</Box>
}
Loading

0 comments on commit c3480cd

Please sign in to comment.