Repository navigation
Conversation
binance-cli v2.0.0 reads the API secret from BINANCE_SECRET_KEY instead of BINANCE_API_SECRET. Provision both variables so v1 and v2 work, and import credentials from either naming scheme.
binance-cli v2 adds the profile and completion subcommands, which only manage local configuration and shell completion. They don't call the Binance API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
binance-cli v2.0.0, a Rust rewrite, reads the API secret from
BINANCE_SECRET_KEYinstead ofBINANCE_API_SECRET. The release notes don't mention the rename, but the README does: compare v1.2.2 with v2.0.0. The latest release, v2.1.1, still usesBINANCE_SECRET_KEY. The plugin only provisionedBINANCE_API_KEYandBINANCE_API_SECRET, so binance-cli v2 got no secret, and every authenticated command failed withUnauthorized access. Authentication required. API-key format invalid.The secret is now provisioned as both
BINANCE_SECRET_KEYandBINANCE_API_SECRET, so the plugin works with v1 and v2 of binance-cli. The importer recognizes both names, trying each naming scheme separately the same way the AWS plugin handles its alternative variable names.binance-cli v2 also adds the
profileandcompletionsubcommands. They manage local profiles and generate shell completion scripts without calling the Binance API, so they no longer require authentication. The existing rules for the v1 market data commands are unchanged. v2's public market data commands still ask for authentication: they share subcommands such asspotwith signed commands, and the CLI is generated from Binance's OpenAPI specs with hundreds of commands, so listing them all would go stale with every release.Ed25519 and RSA API keys are out of scope. binance-cli v2 accepts their private key (a file path or PEM content) in
BINANCE_SECRET_KEY, but supporting that would mean changing the API Secret field, which is defined as 64 alphanumeric characters, so this PR doesn't cover it.Type of change
How To Test
Unit tests:
go test ./plugins/binance/ -vTestAPIKeyProvisionerchecks that the secret is provisioned under both names.TestAPIKeyImportercovers importing from the v1 names, the v2 names, and both at once with different secrets.TestBinanceCLINeedsAuthcovers the v1 and v2 commands that skip authentication, and checks that signed commands still require it.End to end with binance-cli v2 (tested with v2.1.1) and a Binance API Key item:
Before the change, this failed with
API-key format invalid. It should now return the account information.Changelog
The Binance plugin now provisions
BINANCE_SECRET_KEY, so binance-cli v2 can authenticate, and the v2profileandcompletioncommands no longer require authentication.