symbol price
continuous-integration/drone/push Build is passing Details

master
dustoair 3 years ago
parent 7549828c7f
commit 9e32b2966a

@ -25,13 +25,11 @@ func getRand(len int) []float64 {
return res return res
} }
func Draw() { func Draw(symbol string) {
timeUpdate, symbolPriceETH := api.GetSerivers("ETHUSDT") timeUpdate, symbolPriceETH := api.GetSerivers(symbol)
timeUpdate, symbolPriceBNB := api.GetSerivers("BNBUSDT")
log.Println(timeUpdate, symbolPriceETH) log.Println(timeUpdate, symbolPriceETH)
values := [][]float64{ values := [][]float64{
symbolPriceETH, symbolPriceETH,
symbolPriceBNB,
//getRand(30), //getRand(30),
//getRand(30), //getRand(30),
//getRand(30), //getRand(30),
@ -46,9 +44,7 @@ func Draw() {
charts.XAxisDataOptionFunc(timeUpdate), charts.XAxisDataOptionFunc(timeUpdate),
//charts.XAxisDataOptionFunc(getLastDays(30)), //charts.XAxisDataOptionFunc(getLastDays(30)),
charts.LegendLabelsOptionFunc([]string{ charts.LegendLabelsOptionFunc([]string{
"BTC", symbol,
"ETH",
"BNB",
//"TRX", //"TRX",
}, "150"), }, "150"),
func(opt *charts.ChartOption) { func(opt *charts.ChartOption) {

@ -8,9 +8,9 @@ import (
"net/http" "net/http"
) )
func replyImageDraw(msgContent MsgContent, timestamp, nonce string, w http.ResponseWriter) { func replyImageDraw(msgContent MsgContent, timestamp, nonce string, w http.ResponseWriter, symbol string) {
//third_part.SendPicMid(msgContent.FromUsername, utils.RandMapValue(global.ImageMap)) //third_part.SendPicMid(msgContent.FromUsername, utils.RandMapValue(global.ImageMap))
goCharts.Draw() goCharts.Draw(symbol)
filename := "tmp/line-chart.png" filename := "tmp/line-chart.png"
go RecordWechatLog(msgContent.FromUsername, msgContent.ToUsername, msgContent.CreateTime, msgContent.MsgType, filename) go RecordWechatLog(msgContent.FromUsername, msgContent.ToUsername, msgContent.CreateTime, msgContent.MsgType, filename)
third_part.SendPicFile(msgContent.FromUsername, filename) third_part.SendPicFile(msgContent.FromUsername, filename)

@ -42,7 +42,10 @@ func cmdExec(msgContent MsgContent, timestamp, nonce string, w http.ResponseWrit
priceTRX := api.GetBinanceLatestPrice("TRXUSDT") priceTRX := api.GetBinanceLatestPrice("TRXUSDT")
priceBNB := api.GetBinanceLatestPrice("BNBUSDT") priceBNB := api.GetBinanceLatestPrice("BNBUSDT")
replyContent = fmt.Sprintf("BTC价格: %f \nETH价格: %f \nTRX价格: %f \nBNB价格: %f", priceBTC, priceETH, priceTRX, priceBNB) replyContent = fmt.Sprintf("BTC价格: %f \nETH价格: %f \nTRX价格: %f \nBNB价格: %f", priceBTC, priceETH, priceTRX, priceBNB)
replyImageDraw(msgContent, timestamp, nonce, w) replyImageDraw(msgContent, timestamp, nonce, w, "BTCUSDT")
replyImageDraw(msgContent, timestamp, nonce, w, "ETHUSDT")
replyImageDraw(msgContent, timestamp, nonce, w, "TRXUSDT")
replyImageDraw(msgContent, timestamp, nonce, w, "BNBUSDT")
return return
case "gold", "黄金": case "gold", "黄金":

Loading…
Cancel
Save