diff --git a/internal/ui/component/watchlist/watchlist.go b/internal/ui/component/watchlist/watchlist.go index 86bf5ae..1e3786f 100644 --- a/internal/ui/component/watchlist/watchlist.go +++ b/internal/ui/component/watchlist/watchlist.go @@ -133,7 +133,8 @@ func extraInfoExchange(show bool, q Quote, targetCurrency string, width int) str return "\n" + Line( width, Cell{ - Text: tagText(currencyText) + " " + tagText(exchangeDelayText(q.ExchangeDelay)) + " " + tagText(q.ExchangeName), + Align: RightAlign, + Text: tagText(currencyText) + " " + tagText(exchangeDelayText(q.ExchangeDelay)) + " " + tagText(q.ExchangeName), }, ) } @@ -146,15 +147,28 @@ func extraInfoFundamentals(show bool, q Quote, width int) string { return "\n" + Line( width, Cell{ - Width: 25, - Text: StyleNeutralFaded("Prev Close: ") + StyleNeutral(ConvertFloatToString(q.RegularMarketPreviousClose)), + Text: dayRangeText(q.RegularMarketDayRange), + Align: RightAlign, }, Cell{ - Width: 20, - Text: StyleNeutralFaded("Open: ") + StyleNeutral(ConvertFloatToString(q.RegularMarketOpen)), + Width: 15, + Text: StyleNeutralFaded("Prev Close: "), + Align: RightAlign, }, Cell{ - Text: dayRangeText(q.RegularMarketDayRange), + Width: 10, + Text: StyleNeutral(ConvertFloatToString(q.RegularMarketPreviousClose)), + Align: RightAlign, + }, + Cell{ + Width: 15, + Text: StyleNeutralFaded("Open: "), + Align: RightAlign, + }, + Cell{ + Width: 10, + Text: StyleNeutral(ConvertFloatToString(q.RegularMarketOpen)), + Align: RightAlign, }, ) } @@ -167,21 +181,32 @@ func extraInfoHoldings(show bool, p Position, width int) string { return "\n" + Line( width, Cell{ - Text: "", + Text: StyleNeutralFaded("Weight: "), + Align: RightAlign, + }, + Cell{ + Width: 7, + Text: StyleNeutral(ConvertFloatToString(p.Weight)) + "%", + Align: RightAlign, + }, + Cell{ + Width: 15, + Text: StyleNeutralFaded("Avg. Cost: "), + Align: RightAlign, }, Cell{ - Width: 25, - Text: StyleNeutralFaded("Weight: ") + StyleNeutral(ConvertFloatToString(p.Weight)) + "%", + Width: 10, + Text: StyleNeutral(ConvertFloatToString(p.AverageCost)), Align: RightAlign, }, Cell{ - Width: 25, - Text: StyleNeutralFaded("Avg. Cost: ") + StyleNeutral(ConvertFloatToString(p.AverageCost)), + Width: 15, + Text: StyleNeutralFaded("Quantity: "), Align: RightAlign, }, Cell{ - Width: 25, - Text: StyleNeutralFaded("Quantity: ") + StyleNeutral(ConvertFloatToString(p.Quantity)), + Width: 10, + Text: StyleNeutral(ConvertFloatToString(p.Quantity)), Align: RightAlign, }, ) diff --git a/internal/ui/component/watchlist/watchlist_test.go b/internal/ui/component/watchlist/watchlist_test.go index 3162f65..032e14d 100644 --- a/internal/ui/component/watchlist/watchlist_test.go +++ b/internal/ui/component/watchlist/watchlist_test.go @@ -367,7 +367,7 @@ var _ = Describe("Watchlist", func() { expected := strings.Join([]string{ "BTC-USD ● 50000.00", "Bitcoin ↑ 10000.00 (20.00%)", - " USD Real-Time Cryptocurrency ", + " USD Real-Time Cryptocurrency ", }, "\n") Expect(removeFormatting(m.View())).To(Equal(expected)) }) @@ -401,7 +401,7 @@ var _ = Describe("Watchlist", func() { expected := strings.Join([]string{ "BTC-USD ● 50000.00", "Bitcoin ↑ 10000.00 (20.00%)", - " USD Delayed 15min Cryptocurrency ", + " USD Delayed 15min Cryptocurrency ", }, "\n") Expect(removeFormatting(m.View())).To(Equal(expected)) }) @@ -435,7 +435,7 @@ var _ = Describe("Watchlist", func() { expected := strings.Join([]string{ "APPL ● 5000.00", "Apple, Inc ↑ 1000.00 (20.00%)", - " USD → EUR Real-Time NASDAQ ", + " USD → EUR Real-Time NASDAQ ", }, "\n") Expect(removeFormatting(m.View())).To(Equal(expected)) }) @@ -472,7 +472,7 @@ var _ = Describe("Watchlist", func() { expected := strings.Join([]string{ "BTC-USD ● 50000.00", "Bitcoin ↑ 10000.00 (20.00%)", - "Prev Close: 10000.00 Open: 10000.00 Day Range: 10000 - 10000 ", + " Day Range: 10000 - 10000 Prev Close: 10000.00 Open: 10000.00", }, "\n") Expect(removeFormatting(m.View())).To(Equal(expected)) }) @@ -505,7 +505,7 @@ var _ = Describe("Watchlist", func() { expected := strings.Join([]string{ "BTC-USD ● 50000.00", "Bitcoin ↑ 10000.00 (20.00%)", - "Prev Close: 10000.00 Open: 10000.00 ", + " Prev Close: 10000.00 Open: 10000.00", }, "\n") Expect(removeFormatting(m.View())).To(Equal(expected)) }) @@ -550,7 +550,7 @@ var _ = Describe("Watchlist", func() { expected := strings.Join([]string{ "PTON ● 105.00 100.00", "Peloton ↑ 55.00 (110.00%) ↑ 10.00 (10.00%)", - " Weight: 0.00% Avg. Cost: 0.00 Quantity: 100.00", + " Weight: 0.00% Avg. Cost: 0.00 Quantity: 100.00", }, "\n") Expect(removeFormatting(m.View())).To(Equal(expected)) })