mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
kucoin: replace UnixMilli
This commit is contained in:
parent
e76dd1cbc4
commit
d433c7f5b1
|
@ -74,7 +74,7 @@ var websocketCmd = &cobra.Command{
|
||||||
|
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
id := time.Now().UnixMilli()
|
id := time.Now().UnixNano() / int64(time.Millisecond)
|
||||||
wsCmds := []kucoin.WebSocketCommand{
|
wsCmds := []kucoin.WebSocketCommand{
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
|
@ -125,7 +125,7 @@ var websocketCmd = &cobra.Command{
|
||||||
|
|
||||||
case <-pingTicker.C:
|
case <-pingTicker.C:
|
||||||
if err := c.WriteJSON(kucoin.WebSocketCommand{
|
if err := c.WriteJSON(kucoin.WebSocketCommand{
|
||||||
Id: time.Now().UnixMilli(),
|
Id: time.Now().UnixNano() / int64(time.Millisecond),
|
||||||
Type: "ping",
|
Type: "ping",
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
logrus.WithError(err).Error("websocket ping error", err)
|
logrus.WithError(err).Error("websocket ping error", err)
|
||||||
|
|
|
@ -94,7 +94,7 @@ func toLocalInterval(i types.Interval) string {
|
||||||
|
|
||||||
// convertSubscriptions global subscription to local websocket command
|
// convertSubscriptions global subscription to local websocket command
|
||||||
func convertSubscriptions(ss []types.Subscription) ([]WebSocketCommand, error) {
|
func convertSubscriptions(ss []types.Subscription) ([]WebSocketCommand, error) {
|
||||||
var id = time.Now().UnixMilli()
|
var id = time.Now().UnixNano() / int64(time.Millisecond)
|
||||||
var cmds []WebSocketCommand
|
var cmds []WebSocketCommand
|
||||||
for _, s := range ss {
|
for _, s := range ss {
|
||||||
id++
|
id++
|
||||||
|
|
|
@ -137,7 +137,7 @@ func (s *Stream) handleConnect() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
id := time.Now().UnixMilli()
|
id := time.Now().UnixNano() / int64(time.Millisecond)
|
||||||
cmds := []WebSocketCommand{
|
cmds := []WebSocketCommand{
|
||||||
{
|
{
|
||||||
Id: id,
|
Id: id,
|
||||||
|
@ -406,7 +406,7 @@ func ping(ctx context.Context, w WebSocketConnector, interval time.Duration) {
|
||||||
conn := w.Conn()
|
conn := w.Conn()
|
||||||
|
|
||||||
if err := conn.WriteJSON(WebSocketCommand{
|
if err := conn.WriteJSON(WebSocketCommand{
|
||||||
Id: time.Now().UnixMilli(),
|
Id: time.Now().UnixNano() / int64(time.Millisecond),
|
||||||
Type: "ping",
|
Type: "ping",
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
log.WithError(err).Error("websocket ping error", err)
|
log.WithError(err).Error("websocket ping error", err)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user