async open () {
    if (this._isOpen || this._ws !== null) {
      throw new Error('already open')
    }

    debug('connecting to %s...', this._url)

    this._ws = new WebSocket(this._url, {
      agent: this._agent
    })

    this._subscriptionRefs = {}
    this._candles = {}
    this._orderBooks = {}

    this._ws.on('message', this._onWSMessage)
    this._ws.on('error', this._onWSError)
    this._ws.on('close', this._onWSClose)

    return new Promise((resolve) => {
      this._ws.on('open', () => {
        // call manually instead of binding to open event so it fires at the
        // right time
        this._onWSOpen()

        if (this._enabledFlags !== 0) {
          this.sendEnabledFlags()
        }

        debug('connected')
        resolve()
      })
    })
  }
Opens a connection to the API server. Rejects with an error if a
connection is already open. Resolves on success.

@returns {Promise} p