From 18f4f005168473333d52a5716cd543401d8bf2c2 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Fri, 28 Aug 2026 10:38:54 -0700 Subject: [PATCH] remove unused fromString on portfolio --- src/models/portfolio.zig | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/models/portfolio.zig b/src/models/portfolio.zig index c914d07..85d7eba 100644 --- a/src/models/portfolio.zig +++ b/src/models/portfolio.zig @@ -249,26 +249,12 @@ pub const LotType = enum { .watch => "Watch", }; } - - pub fn fromString(s: []const u8) LotType { - if (std.mem.eql(u8, s, "option")) return .option; - if (std.mem.eql(u8, s, "cd")) return .cd; - if (std.mem.eql(u8, s, "cash")) return .cash; - if (std.mem.eql(u8, s, "illiquid")) return .illiquid; - if (std.mem.eql(u8, s, "watch")) return .watch; - return .stock; - } }; /// Call or put option type. pub const OptionType = enum { call, put, - - pub fn fromString(s: []const u8) OptionType { - if (std.mem.eql(u8, s, "put")) return .put; - return .call; - } }; /// A single lot in a portfolio -- one purchase/sale event. @@ -1192,21 +1178,13 @@ test "portfolio positions" { try std.testing.expectApproxEqAbs(@as(f64, 75.0), aapl.?.realized_gain_loss, 0.01); // 3 * (155-130) } -test "LotType label and fromString" { +test "LotType label" { try std.testing.expectEqualStrings("Stock", LotType.stock.label()); try std.testing.expectEqualStrings("Option", LotType.option.label()); try std.testing.expectEqualStrings("CD", LotType.cd.label()); try std.testing.expectEqualStrings("Cash", LotType.cash.label()); try std.testing.expectEqualStrings("Illiquid", LotType.illiquid.label()); try std.testing.expectEqualStrings("Watch", LotType.watch.label()); - - try std.testing.expectEqual(LotType.option, LotType.fromString("option")); - try std.testing.expectEqual(LotType.cd, LotType.fromString("cd")); - try std.testing.expectEqual(LotType.cash, LotType.fromString("cash")); - try std.testing.expectEqual(LotType.illiquid, LotType.fromString("illiquid")); - try std.testing.expectEqual(LotType.watch, LotType.fromString("watch")); - try std.testing.expectEqual(LotType.stock, LotType.fromString("unknown")); - try std.testing.expectEqual(LotType.stock, LotType.fromString("")); } test "Lot.priceSymbol" {