To reinforce the security of the API, KuCoin upgraded the API key to version 2.0, the validation logic has also been changed. It is recommended to create(https://www.kucoin.com/account/api) and update your API key to version 2.0.
The API key of version 1.0 will be still valid until May 1, 2021.
// API key version 2.0s:=kucoin.NewApiService(
// kucoin.ApiBaseURIOption("https://api.kucoin.com"), kucoin.ApiKeyOption("key"),
kucoin.ApiSecretOption("secret"),
kucoin.ApiPassPhraseOption("passphrase"),
kucoin.ApiKeyVersionOption(ApiKeyVersionV2)
)
// API key version 1.0s:=kucoin.NewApiService(
// kucoin.ApiBaseURIOption("https://api.kucoin.com"), kucoin.ApiKeyOption("key"),
kucoin.ApiSecretOption("secret"),
kucoin.ApiPassPhraseOption("passphrase"),
)
// Or add these options into the environmental variable// Bash: // export API_BASE_URI=https://api-futures.kucoin.com// export API_KEY=key// export API_SECRET=secret// export API_PASSPHRASE=passphrase// s := NewApiServiceFromEnv()
Debug mode & logging
// Require package github.com/sirupsen/logrus// Debug mode will record the logs of API and WebSocket to files.// Default values: LogLevel=logrus.DebugLevel, LogDirectory="/tmp"kumex.DebugMode=true// Or export API_DEBUG_MODE=1// Logging in your code// kumex.SetLoggerDirectory("/tmp")// logrus.SetLevel(logrus.DebugLevel)logrus.Debugln("I'm a debug message")
# Add your API configuration items into the environmental variable firstexport API_BASE_URI=https://api-futures.kucoin.com
export API_KEY=key
export API_SECRET=secret
export API_PASSPHRASE=passphrase
export API_KEY_VERSION=2
# Run tests
go test -v