2020-10-01 08:07:18 +00:00
|
|
|
package max
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
)
|
|
|
|
|
2020-10-02 04:43:14 +00:00
|
|
|
var WebSocketURL = "wss://max-stream.maicoin.com/ws"
|
|
|
|
|
2020-10-01 08:07:18 +00:00
|
|
|
var ErrMessageTypeNotSupported = errors.New("message type currently not supported")
|
|
|
|
|
2021-02-22 09:36:23 +00:00
|
|
|
type SubscribeOptions struct {
|
|
|
|
Depth int `json:"depth,omitempty"`
|
|
|
|
Resolution string `json:"resolution,omitempty"`
|
|
|
|
}
|
|
|
|
|
2020-10-01 08:07:18 +00:00
|
|
|
// Subscription is used for presenting the subscription metadata.
|
|
|
|
// This is used for sending subscribe and unsubscribe requests
|
|
|
|
type Subscription struct {
|
2020-12-21 07:43:54 +00:00
|
|
|
Channel string `json:"channel"`
|
|
|
|
Market string `json:"market"`
|
|
|
|
Depth int `json:"depth,omitempty"`
|
2020-10-17 16:09:37 +00:00
|
|
|
Resolution string `json:"resolution,omitempty"`
|
2020-10-01 08:07:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type WebsocketCommand struct {
|
|
|
|
// Action is used for specify the action of the websocket session.
|
|
|
|
// Valid values are "subscribe", "unsubscribe" and "auth"
|
|
|
|
Action string `json:"action"`
|
|
|
|
Subscriptions []Subscription `json:"subscriptions,omitempty"`
|
|
|
|
}
|