clean up quote
This commit is contained in:
parent
ce72985054
commit
35fc9101fd
3 changed files with 3 additions and 9 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue