35 lines
833 B
Go
35 lines
833 B
Go
package view
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/jedib0t/go-pretty/v6/table"
|
|
"me.thuanle/bbot/internal/helper/binancex"
|
|
"me.thuanle/bbot/internal/services/tele/view/helper"
|
|
"me.thuanle/bbot/internal/utils/opx"
|
|
"me.thuanle/bbot/internal/utils/timex"
|
|
"time"
|
|
)
|
|
|
|
func IconOfFundingFeeDirection(fund float64) string {
|
|
return opx.Ite(fund > 0, "📉", "📈")
|
|
}
|
|
|
|
func RenderOnGetTopFundingFeeMessage(sym []string, rate []float64, cd []int64) string {
|
|
t := helper.NewNoBorderTableWriter("Symbol", "Rate", "Cd")
|
|
|
|
flag := true
|
|
for i, s := range sym {
|
|
if rate[i] > 0 && flag {
|
|
t.AppendRow(table.Row{"...", "...", "..."})
|
|
flag = false
|
|
}
|
|
t.AppendRow(table.Row{
|
|
binancex.Symbol2Token(s),
|
|
fmt.Sprintf("%.3f%%", rate[i]*100),
|
|
fmt.Sprintf("%s", timex.CdMinuteStringTime(time.UnixMilli(cd[i]))),
|
|
})
|
|
}
|
|
|
|
return t.Render()
|
|
}
|