Skip to content

Commit

Permalink
fix duration in orders ls
Browse files Browse the repository at this point in the history
  • Loading branch information
Sladuca committed Sep 10, 2024
1 parent a1c4243 commit 6ca63c1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/orders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export interface HydratedOrder {
instance_type: string;
price: number;
start_at: string;
duration: number;
end_at: string;
quantity: number;
flags: OrderFlags;
created_at: string;
Expand Down Expand Up @@ -132,13 +132,14 @@ function printAsTable(orders: Array<HydratedOrder>) {
}

const startDate = new Date(order.start_at);
const duration = formatDuration(dayjs(order.end_at).diff(dayjs(startDate), "ms"));
table.push([
order.id,
order.side,
order.instance_type,
usdFormatter.format(order.price / 10000),
order.quantity.toString(),
formatDuration(order.duration * 1000),
duration,
startDate.toLocaleString(),
status,
executionPrice ? usdFormatter.format(executionPrice / 10000) : "-",
Expand Down

0 comments on commit 6ca63c1

Please sign in to comment.