Error 401 is an authorisation error. Please make sure that you are doing the following:
- Using the correct API key & secret
- Using the correct connecting links (i.e. make sure you are connecting to bitmex.com and not testnet.bitmex.com)
- The data you are sending matches the data you are signing
- You're successfully verified at https://www.bitmex.com/get-started
Please also see our API Keys Usage documentation for more details on properly setting it up and using it.