diff --git a/src/commands/quote.zig b/src/commands/quote.zig index b3cb114..08b9801 100644 --- a/src/commands/quote.zig +++ b/src/commands/quote.zig @@ -340,6 +340,9 @@ pub fn display(allocator: std.mem.Allocator, candles: []const zfin.Candle, quote try out.print(" High: ${d:.2}\n", .{high_val}); try out.print(" Low: ${d:.2}\n", .{low_val}); try out.print(" Volume: {s}\n", .{fmt.fmtIntCommas(&vol_buf, vol_val)}); + if (prev_close > 0) { + try out.print(" Prev Close: ${d:.2}\n", .{prev_close}); + } if (fmt.pctChange(price, prev_close)) |dc| { var chg_buf: [64]u8 = undefined; diff --git a/src/tui/quote_tab.zig b/src/tui/quote_tab.zig index 55a70b0..532cf31 100644 --- a/src/tui/quote_tab.zig +++ b/src/tui/quote_tab.zig @@ -668,6 +668,9 @@ fn buildStyledLines(app: *App, arena: std.mem.Allocator) ![]const StyledLine { if (quote_data) |q| { // No candle data but have a quote - show it try lines.append(arena, .{ .text = try std.fmt.allocPrint(arena, " Price: {f}", .{Money.from(q.close)}), .style = th.contentStyle() }); + if (q.previous_close > 0) { + try lines.append(arena, .{ .text = try std.fmt.allocPrint(arena, " Prev: ${d:.2}", .{q.previous_close}), .style = th.mutedStyle() }); + } { var chg_buf: [64]u8 = undefined; const change_style = if (q.change >= 0) th.positiveStyle() else th.negativeStyle(); @@ -763,6 +766,9 @@ fn buildDetailColumns( try col1.add(arena, try std.fmt.allocPrint(arena, " High: ${d:.2}", .{if (quote_data) |q| q.high else latest.high}), th.mutedStyle()); try col1.add(arena, try std.fmt.allocPrint(arena, " Low: ${d:.2}", .{if (quote_data) |q| q.low else latest.low}), th.mutedStyle()); try col1.add(arena, try std.fmt.allocPrint(arena, " Volume: {s}", .{fmt.fmtIntCommas(&vol_buf, if (quote_data) |q| q.volume else latest.volume)}), th.mutedStyle()); + if (prev_close > 0) { + try col1.add(arena, try std.fmt.allocPrint(arena, " Prev: ${d:.2}", .{prev_close}), th.mutedStyle()); + } if (fmt.pctChange(price, prev_close)) |dc| { var chg_buf: [64]u8 = undefined; const change_style = if (dc.change >= 0) th.positiveStyle() else th.negativeStyle();