FTX FIX protocol returns "Invalid signature" message

Viewed 708

I have been trying to to implement a FIX Client in Go to interact with FTX. To send the initial logon message, FTX's API doc asks the client to include a signature in the message.

In the return message from the FTX, it says "Invalid signature".

Below is my implementation for generating the signature:

func signatureGenerator(msgType, msgSeqNum, senderCompID, targetCompID string) string {

    timeNow := time.Now().UTC().Format("20060102-15:04:05")

    message := [][]byte{[]byte(timeNow),
                        []byte(msgType),
                        []byte(msgSeqNum), 
                        []byte(senderCompID),
                        []byte(targetCompID)}
    SOH := []byte{0x01}
    signature := bytes.Join(message, SOH)

    signSha256 := hmac.New(sha256.New, []byte(userInfo.CLIENT_API_SECRET))
    signSha256.Write(signature)

    strSig := hex.EncodeToString(signSha256.Sum(nil))
    return strSig
}
0 Answers
Related