mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
show order tag in the order list
This commit is contained in:
parent
2784408b8b
commit
11dacbc2cd
|
@ -1,6 +1,7 @@
|
|||
import {Button, Checkbox, Group, Table} from "@mantine/core";
|
||||
import React, {useState} from "react";
|
||||
import {Order} from "../types";
|
||||
import moment from "moment";
|
||||
|
||||
interface OrderListTableProps {
|
||||
orders: Order[];
|
||||
|
@ -12,7 +13,7 @@ const OrderListTable = (props: OrderListTableProps) => {
|
|||
let orders = props.orders;
|
||||
|
||||
const [showCanceledOrders, setShowCanceledOrders] = useState(false);
|
||||
const [limit, setLimit] = useState(props.limit || 5);
|
||||
const [limit, setLimit] = useState(props.limit || 100);
|
||||
|
||||
if (!showCanceledOrders) {
|
||||
orders = orders.filter((order: Order) => {
|
||||
|
@ -40,7 +41,8 @@ const OrderListTable = (props: OrderListTableProps) => {
|
|||
<td>{order.price}</td>
|
||||
<td>{order.quantity}</td>
|
||||
<td>{order.status}</td>
|
||||
<td>{order.creation_time.toString()}</td>
|
||||
<td>{formatDate(order.creation_time)}</td>
|
||||
<td>{order.tag}</td>
|
||||
</tr>
|
||||
));
|
||||
|
||||
|
@ -63,6 +65,7 @@ const OrderListTable = (props: OrderListTableProps) => {
|
|||
<th>Quantity</th>
|
||||
<th>Status</th>
|
||||
<th>Creation Time</th>
|
||||
<th>Tag</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{rows}</tbody>
|
||||
|
@ -70,4 +73,9 @@ const OrderListTable = (props: OrderListTableProps) => {
|
|||
</div>
|
||||
}
|
||||
|
||||
const formatDate = (d : Date) : string => {
|
||||
return moment(d).format("MMM Do YY hh:mm:ss A Z");
|
||||
}
|
||||
|
||||
|
||||
export default OrderListTable;
|
||||
|
|
|
@ -657,6 +657,10 @@ const createLegendUpdater = (legend: HTMLDivElement, prefix: string) => {
|
|||
}
|
||||
}
|
||||
|
||||
const formatDate = (d : Date) : string => {
|
||||
return moment(d).format("MMM Do YY hh:mm:ss A Z");
|
||||
}
|
||||
|
||||
const createOHLCLegendUpdater = (legend: HTMLDivElement, prefix: string) => {
|
||||
return (param: any, time : any) => {
|
||||
if (param) {
|
||||
|
@ -664,7 +668,7 @@ const createOHLCLegendUpdater = (legend: HTMLDivElement, prefix: string) => {
|
|||
const changePercentage = Math.round((param.close - param.open) / param.close * 10000.0) / 100.0;
|
||||
const ampl = Math.round((param.high - param.low) / param.low * 10000.0) / 100.0;
|
||||
const t = new Date(time * 1000);
|
||||
const dateStr = moment(t).format("MMM Do YY hh:mm:ss A Z");
|
||||
const dateStr = formatDate(t);
|
||||
legend.innerHTML = prefix + ` O: ${param.open} H: ${param.high} L: ${param.low} C: ${param.close} CHG: ${change} (${changePercentage}%) AMP: ${ampl}% T: ${dateStr}`;
|
||||
} else {
|
||||
legend.innerHTML = prefix + ' O: - H: - L: - C: - T: -';
|
||||
|
|
|
@ -11,4 +11,5 @@ export interface Order {
|
|||
update_time: Date;
|
||||
creation_time: Date;
|
||||
time?: Date;
|
||||
tag?: string;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user