Add Markets sort-by: change to sort by percent change

This commit is contained in:
Eric Haughee
2024-10-03 11:10:34 -07:00
parent 8a8aaa752e
commit e434fe0847
3 changed files with 11 additions and 1 deletions

View File

@@ -133,6 +133,12 @@ func (t Markets) SortByAbsChange() {
})
}
func (t Markets) SortByChange() {
sort.Slice(t, func(i, j int) bool {
return t[i].PercentChange > t[j].PercentChange
})
}
var weatherCodeTable = map[int]string{
0: "Clear Sky",
1: "Mainly Clear",