This is a common error and happens in many cases, for example:
m.wsService.SetCallBack(gatews.ChannelFutureBalance, func(msg *gatews.UpdateMsg) {
var accounts []gatews.FuturesAccountBook
if m.conf.Debug && msg.Event == "update" {
log.Printf("ChannelFutureBalance: %s\n", string(msg.Result))
}
if msg.Error != nil {
errorHandler(convertWsError(msg.Error, excommon.GlobalMarketTypeFutures, excommon.Unknown))
return
}
if msg.Event != "update" {
return
}
if err := json.Unmarshal(msg.Result, &accounts); err != nil {
errorHandler(convertWsError(err, excommon.GlobalMarketTypeFutures, excommon.Unknown)) // ①
}
// ...
① will show the error: json: cannot unmarshal number into Go struct field FuturesAccountBook.balance of type string. This kind of bug also occurs in the case of GateWsFuturesTrade and GateWsFuturesOrder et al.
It could be a solution to refactor the structs in customized code, but it will be much better if your guys can fix this problem inside this package.
This is a common error and happens in many cases, for example:
① will show the error:
json: cannot unmarshal number into Go struct field FuturesAccountBook.balance of type string
. This kind of bug also occurs in the case ofGateWsFuturesTrade
andGateWsFuturesOrder
et al.It could be a solution to refactor the structs in customized code, but it will be much better if your guys can fix this problem inside this package.