2021-01-29 08:50:06 +00:00
|
|
|
import React, {useEffect, useState} from 'react';
|
2021-01-29 05:15:44 +00:00
|
|
|
|
|
|
|
import {makeStyles} from '@material-ui/core/styles';
|
|
|
|
import Container from '@material-ui/core/Container';
|
|
|
|
import Typography from '@material-ui/core/Typography';
|
|
|
|
import Box from '@material-ui/core/Box';
|
|
|
|
import Paper from '@material-ui/core/Paper';
|
2021-01-29 08:50:06 +00:00
|
|
|
import {queryOrders} from '../api/bbgo';
|
|
|
|
import {DataGrid} from '@material-ui/data-grid';
|
|
|
|
|
|
|
|
const columns = [
|
|
|
|
{field: 'gid', headerName: 'GID', width: 80, type: 'number'},
|
|
|
|
{field: 'clientOrderID', headerName: 'Client Order ID', width: 130 },
|
|
|
|
{field: 'exchange', headerName: 'Exchange'},
|
|
|
|
{field: 'symbol', headerName: 'Symbol'},
|
|
|
|
{field: 'orderType', headerName: 'Type'},
|
|
|
|
{field: 'side', headerName: 'Side', width: 90},
|
|
|
|
{field: 'price', headerName: 'Price', width: 120, type: 'number'},
|
|
|
|
{field: 'quantity', headerName: 'Quantity', width: 120, type: 'number'},
|
|
|
|
{field: 'executedQuantity', headerName: 'Executed Quantity', width: 120, type: 'number'},
|
|
|
|
{field: 'status', headerName: 'Status'},
|
|
|
|
{field: 'isMargin', headerName: 'Margin'},
|
|
|
|
{field: 'isIsolated', headerName: 'Isolated'},
|
|
|
|
{field: 'creationTime', headerName: 'Create Time'},
|
|
|
|
];
|
2021-01-29 05:15:44 +00:00
|
|
|
|
|
|
|
const useStyles = makeStyles((theme) => ({
|
|
|
|
paper: {
|
|
|
|
padding: theme.spacing(2),
|
|
|
|
},
|
|
|
|
}));
|
|
|
|
|
|
|
|
export default function Orders() {
|
|
|
|
const classes = useStyles();
|
|
|
|
|
2021-01-29 08:50:06 +00:00
|
|
|
const [orders, setOrders] = useState([])
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
queryOrders({}, (orders) => {
|
|
|
|
setOrders(orders.map((o) => { o.id = o.gid; return o }))
|
|
|
|
})
|
|
|
|
}, [])
|
|
|
|
|
2021-01-29 05:15:44 +00:00
|
|
|
return (
|
|
|
|
<Container>
|
|
|
|
<Box m={4}>
|
|
|
|
<Paper className={classes.paper}>
|
|
|
|
<Typography variant="h4" component="h2" gutterBottom>
|
|
|
|
Orders
|
|
|
|
</Typography>
|
|
|
|
</Paper>
|
2021-01-29 08:50:06 +00:00
|
|
|
<DataGrid
|
|
|
|
rows={orders}
|
|
|
|
columns={columns}
|
|
|
|
pageSize={50}
|
|
|
|
autoHeight={true}
|
|
|
|
checkboxSelection/>
|
2021-01-29 05:15:44 +00:00
|
|
|
</Box>
|
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|