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
}
func Draw() {
timeUpdate, symbolPriceETH := api.GetSerivers("ETHUSDT")
timeUpdate, symbolPriceBNB := api.GetSerivers("BNBUSDT")
func Draw(symbol string) {
timeUpdate, symbolPriceETH := api.GetSerivers(symbol)
log.Println(timeUpdate, symbolPriceETH)
values := [][]float64{
symbolPriceETH,
symbolPriceBNB,
//getRand(30),
//getRand(30),
//getRand(30),
@ -46,9 +44,7 @@ func Draw() {
charts.XAxisDataOptionFunc(timeUpdate),
//charts.XAxisDataOptionFunc(getLastDays(30)),
charts.LegendLabelsOptionFunc([]string{
"BTC",
"ETH",
"BNB",
symbol,
//"TRX",
}, "150"),
func(opt *charts.ChartOption) {

@ -8,9 +8,9 @@ import (
"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))
goCharts.Draw()
goCharts.Draw(symbol)
filename := "tmp/line-chart.png"
go RecordWechatLog(msgContent.FromUsername, msgContent.ToUsername, msgContent.CreateTime, msgContent.MsgType, 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")
priceBNB := api.GetBinanceLatestPrice("BNBUSDT")
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
case "gold", "黄金":

Loading…
Cancel
Save