ftx: fix websocket authentication of subaccounts (#801)

This commit is contained in:
Luis Rascão
2021-10-11 01:39:09 +01:00
committed by GitHub
parent 5208d2191e
commit 334b3bf0cc
2 changed files with 9 additions and 6 deletions

View File

@@ -553,9 +553,10 @@ type OptionFillsData struct {
// AuthenticationData stores authentication variables required
type AuthenticationData struct {
Key string `json:"key"`
Sign string `json:"sign"`
Time int64 `json:"time"`
Key string `json:"key"`
Sign string `json:"sign"`
Time int64 `json:"time"`
SubAccount string `json:"subaccount,omitempty"`
}
// Authenticate stores authentication variables required

View File

@@ -90,11 +90,13 @@ func (f *FTX) WsAuth() error {
sign := crypto.HexEncodeToString(hmac)
req := Authenticate{Operation: "login",
Args: AuthenticationData{
Key: f.API.Credentials.Key,
Sign: sign,
Time: intNonce,
Key: f.API.Credentials.Key,
Sign: sign,
Time: intNonce,
SubAccount: f.API.Credentials.Subaccount,
},
}
return f.Websocket.Conn.SendJSONMessage(req)
}