bbgo_origin/frontend/components/TradingVolumePanel.js

67 lines
2.2 KiB
JavaScript
Raw Permalink Normal View History

2021-01-28 10:51:35 +00:00
import Paper from "@material-ui/core/Paper";
import Box from "@material-ui/core/Box";
import Tabs from "@material-ui/core/Tabs";
import Tab from "@material-ui/core/Tab";
import React from "react";
import TradingVolumeBar from "./TradingVolumeBar";
import {makeStyles} from "@material-ui/core/styles";
import Grid from "@material-ui/core/Grid";
2021-01-29 04:55:11 +00:00
import Typography from "@material-ui/core/Typography";
2021-01-28 10:51:35 +00:00
const useStyles = makeStyles((theme) => ({
tradingVolumeBarBox: {
height: 400,
},
2021-01-29 04:55:11 +00:00
paper: {
2021-02-05 01:12:38 +00:00
margin: theme.spacing(2),
2021-01-29 04:55:11 +00:00
padding: theme.spacing(2),
}
2021-01-28 10:51:35 +00:00
}));
export default function TradingVolumePanel() {
const [period, setPeriod] = React.useState("day");
const [segment, setSegment] = React.useState("exchange");
const classes = useStyles();
const handlePeriodChange = (event, newValue) => {
setPeriod(newValue);
};
const handleSegmentChange = (event, newValue) => {
setSegment(newValue);
};
2021-01-29 04:55:11 +00:00
return <Paper className={classes.paper}>
<Typography variant="h4" gutterBottom>
Trading Volume
</Typography>
2021-01-28 10:51:35 +00:00
<Grid container spacing={0}>
<Grid item xs={12} md={6}>
<Tabs value={period}
onChange={handlePeriodChange}
indicatorColor="primary"
textColor="primary">
<Tab label="Day" value={"day"}/>
<Tab label="Month" value={"month"}/>
<Tab label="Year" value={"year"}/>
</Tabs>
</Grid>
<Grid item xs={12} md={6}>
<Grid container justify={"flex-end"}>
<Tabs value={segment}
onChange={handleSegmentChange}
indicatorColor="primary"
textColor="primary">
<Tab label="By Exchange" value={"exchange"}/>
<Tab label="By Symbol" value={"symbol"}/>
</Tabs>
</Grid>
</Grid>
</Grid>
<Box className={classes.tradingVolumeBarBox}>
<TradingVolumeBar period={period} segment={segment}/>
</Box>
</Paper>;
}