This commit is contained in:
1 parent
b60fcb842d
commit
94a11e8d68
10 files changed
+98
-30
No files matched your search
@@ -35,19 +35,21 @@ func RenderPrice(price float64) string {
|
||||
}
|
||||
}
|
||||
|
||||
func RenderOnPriceMessage(symbol string, spotPrice float64, futurePrice float64, fundrate float64, fundtime int64) string {
|
||||
func RenderOnPriceMessage(symbol string, spotPrice float64, futurePrice float64, fundrate float64, fundtime int64, marginRate float64) string {
|
||||
return fmt.Sprintf(
|
||||
"%s: %s\n"+
|
||||
"Fund rate: %.4f%% %s in %s\n"+
|
||||
"Spot: %s",
|
||||
"Spot: %s\n"+
|
||||
"Margin rate: %.3f%%",
|
||||
RenderSymbolInfo(symbol), RenderPrice(futurePrice),
|
||||
fundrate*100, IconOfFundingFeeDirection(fundrate), timex.CdMinuteStringTime(time.UnixMilli(fundtime)),
|
||||
RenderPrice(spotPrice),
|
||||
marginRate*365,
|
||||
)
|
||||
}
|
||||
|
||||
func RenderOnGetTopPricesMessage(symbols []string, price []float64, fundRate []float64) string {
|
||||
t := helper.NewNoBorderTableWriter("", "Price", "Rate")
|
||||
t := helper.NewNoBorderTableWriter("", "Price", "Fund")
|
||||
mFmt := message.NewPrinter(language.AmericanEnglish)
|
||||
for i, symbol := range symbols {
|
||||
t.AppendRow(table.Row{
|
||||
|
||||
Reference in new issue
Block a user