diff --git a/internal/quote/quote.go b/internal/quote/quote.go index b64e5b1..7b6c55d 100644 --- a/internal/quote/quote.go +++ b/internal/quote/quote.go @@ -30,6 +30,8 @@ type ResponseQuote struct { PreMarketChange float64 `json:"preMarketChange"` PreMarketChangePercent float64 `json:"preMarketChangePercent"` PreMarketPrice float64 `json:"preMarketPrice"` + FiftyTwoWeekHigh float64 `json:"fiftyTwoWeekHigh"` + FiftyTwoWeekLow float64 `json:"fiftyTwoWeekLow"` QuoteType string `json:"quoteType"` } diff --git a/internal/ui/component/watchlist/watchlist.go b/internal/ui/component/watchlist/watchlist.go index 103423a..a24fc16 100644 --- a/internal/ui/component/watchlist/watchlist.go +++ b/internal/ui/component/watchlist/watchlist.go @@ -217,9 +217,9 @@ func textQuoteRange(quote Quote) string { StyleNeutral(" - ") + ConvertFloatToString(quote.PriceDayHigh, quote.IsVariablePrecision) + "\n" + - ConvertFloatToString(quote.PriceDayLow, quote.IsVariablePrecision) + + ConvertFloatToString(quote.FiftyTwoWeekLow, quote.IsVariablePrecision) + StyleNeutral(" - ") + - ConvertFloatToString(quote.PriceDayHigh, quote.IsVariablePrecision) + ConvertFloatToString(quote.FiftyTwoWeekHigh, quote.IsVariablePrecision) } return textDayRange diff --git a/internal/ui/component/watchlist/watchlist_test.go b/internal/ui/component/watchlist/watchlist_test.go index 9ca521b..1573808 100644 --- a/internal/ui/component/watchlist/watchlist_test.go +++ b/internal/ui/component/watchlist/watchlist_test.go @@ -444,7 +444,7 @@ Google Inc. ↓ -32.02 (-1.35 ExtraInfoFundamentals: true, }, }) - m.Width = 135 + m.Width = 165 m.Quotes = []Quote{ { ResponseQuote: ResponseQuote{ @@ -454,12 +454,14 @@ Google Inc. ↓ -32.02 (-1.35 RegularMarketOpen: 1000.0, RegularMarketDayHigh: 1500.0, RegularMarketDayLow: 500.0, + FiftyTwoWeekHigh: 2000.0, + FiftyTwoWeekLow: 300.0, }, Price: 5000.0, PricePrevClose: 1000.0, PriceOpen: 1000.0, - PriceDayHigh: 2000.0, - PriceDayLow: 1000.0, + PriceDayHigh: 200.0, + PriceDayLow: 100.0, Change: 1000.0, ChangePercent: 20.0, IsActive: true, @@ -468,10 +470,10 @@ Google Inc. ↓ -32.02 (-1.35 }, } expected := strings.Join([]string{ - "BTC-USD ● Day Range: 1000.00 Prev. Close: 1000.00 5000.00", - "Bitcoin 52wk Range: 1000.00 Open: 1000.00 ↑ 1000.00 (20.00%)", + "BTC-USD ● Day Range: 1000.00 Prev. Close: 1000.00 5000.00 5000.00", + "Bitcoin 52wk Range: 300.00 Open: 1000.00 ↑ 1000.00 (20.00%) ↑ 1000.00 (20.00%)", }, "\n") - Expect("\n" + removeFormatting(m.View())).To(Equal("\n" + expected)) + Expect("\n" + removeFormatting(m.View())).To(BeIdenticalTo("\n" + expected)) }) When("there is no day range", func() {