diff --git a/src/commands/quote.zig b/src/commands/quote.zig index 3bf7b50..f1dffac 100644 --- a/src/commands/quote.zig +++ b/src/commands/quote.zig @@ -18,7 +18,7 @@ pub fn run(allocator: std.mem.Allocator, svc: *zfin.DataService, symbol: []const // Fetch candle data for chart and history const candle_result = svc.getCandles(symbol) catch |err| switch (err) { zfin.DataError.NoApiKey => { - try cli.stderrPrint("Error: TWELVEDATA_API_KEY not set.\n"); + try cli.stderrPrint("Error: No API key configured for candle data.\n"); return; }, else => { @@ -120,7 +120,7 @@ pub fn display(allocator: std.mem.Allocator, candles: []const zfin.Candle, quote for (candles[start_idx..]) |candle| { var row_buf: [128]u8 = undefined; const day_gain = candle.close >= candle.open; - try cli.setGainLoss(out, color, if (day_gain) @as(f64, 1) else @as(f64, -1)); + try cli.setGainLoss(out, color, if (day_gain) 1.0 else -1.0); try out.print("{s}\n", .{fmt.fmtCandleRow(&row_buf, candle)}); try cli.reset(out, color); } diff --git a/src/tui.zig b/src/tui.zig index d10adc3..2811d87 100644 --- a/src/tui.zig +++ b/src/tui.zig @@ -1030,7 +1030,7 @@ pub const App = struct { }, .quote, .performance => { if (self.symbol.len == 0) return; - if (!self.perf_loaded) self.loadPerfData(); + if (!self.perf_loaded) perf_tab.loadData(self); }, .earnings => { if (self.symbol.len == 0) return; @@ -1059,10 +1059,6 @@ pub const App = struct { portfolio_tab.rebuildPortfolioRows(self); } - pub fn loadPerfData(self: *App) void { - perf_tab.loadData(self); - } - pub fn setStatus(self: *App, msg: []const u8) void { const len = @min(msg.len, self.status_msg.len); @memcpy(self.status_msg[0..len], msg[0..len]); diff --git a/src/tui/quote_tab.zig b/src/tui/quote_tab.zig index 5da28bb..c4440f2 100644 --- a/src/tui/quote_tab.zig +++ b/src/tui/quote_tab.zig @@ -336,8 +336,6 @@ fn buildStyledLines(app: *App, arena: std.mem.Allocator) ![]const StyledLine { } try lines.append(arena, .{ .text = "", .style = th.contentStyle() }); - if (app.candles == null and !app.perf_loaded) app.loadPerfData(); - // Use stored real-time quote if available (fetched on manual refresh) const quote_data = app.quote;