add code to msg
This commit is contained in:
@@ -87,7 +87,7 @@ func (f *fund) Msg() string {
|
|||||||
if err1 == nil && err2 == nil {
|
if err1 == nil && err2 == nil {
|
||||||
rise = fmt.Sprintf("%.5f", cur-last)
|
rise = fmt.Sprintf("%.5f", cur-last)
|
||||||
}
|
}
|
||||||
msg := fmt.Sprintf(msgTemplate, f.FName, f.UpdateTime, f.UnitVal, f.EstimateVal, rise, f.RisePer)
|
msg := fmt.Sprintf(msgTemplate, f.FName, f.Code, f.UpdateTime, f.UnitVal, f.EstimateVal, rise, f.RisePer)
|
||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ func NewFund(code string) (*fund, error) {
|
|||||||
return ff, err
|
return ff, err
|
||||||
}
|
}
|
||||||
|
|
||||||
const msgTemplate = `%s
|
const msgTemplate = `%s(%s)
|
||||||
更新时间:%s
|
更新时间:%s
|
||||||
单位净值:%s 估算净值:%s
|
单位净值:%s 估算净值:%s
|
||||||
估算涨幅:(%s) %s%%
|
估算涨幅:(%s) %s%%
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ func numFormat(num interface{}) string {
|
|||||||
|
|
||||||
func (s *stock) Msg() string {
|
func (s *stock) Msg() string {
|
||||||
msg := fmt.Sprintf(msgTemplate,
|
msg := fmt.Sprintf(msgTemplate,
|
||||||
s.values[0],
|
s.values[0], s.code,
|
||||||
s.values[30], s.values[31],
|
s.values[30], s.values[31],
|
||||||
s.values[2], s.values[1],
|
s.values[2], s.values[1],
|
||||||
s.values[3], s.rise(),
|
s.values[3], s.rise(),
|
||||||
@@ -370,7 +370,7 @@ func getStockStr(codes []string) (string, error) {
|
|||||||
return string(body), nil
|
return string(body), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
const msgTemplate = `%s
|
const msgTemplate = `%s(%s)
|
||||||
更新时间:%s %s
|
更新时间:%s %s
|
||||||
昨收:%s 今开:%s
|
昨收:%s 今开:%s
|
||||||
现价:%s 涨跌:%s
|
现价:%s 涨跌:%s
|
||||||
|
|||||||
Reference in New Issue
Block a user