Venue account connection
Store a Binance credential in Neurotrader: generate a key pair, register the public key at Binance, and complete the credential with the API key.
Before an algorithm can place orders at Binance, Neurotrader needs a credential for your Binance account. This page shows how to create one in the app so that no secret is ever typed, copied or shown, which permissions to grant at Binance, and how to remove the credential again.
A credential that can trade is as valuable as the account it trades. Read the note on the Credentials panel once, in full, before you store one.
Demo and production keys
Binance has two environments, and a key belongs to exactly one of them.
| Environment in the app | Site where the key is made | Funds | Used for |
|---|---|---|---|
| Demo Mode | demo.binance.com | Practice funds | Demo runs |
| Binance | www.binance.com | Real funds | Real funds runs |
A Demo Mode key is created on the Demo site, not on binance.com, and does
not work on the real exchange. A production key does not work in Demo Mode.
A run declares its environment, and Neurotrader refuses to start it with a
key issued for the other one.
Neurotrader keeps one credential for each environment, side by side. A Demo run signs with the Demo Mode key and a real-funds run with the production key. Storing one does not replace the other, so you can keep rehearsing in Demo Mode after you have stored a production key.
Start with Demo Mode. It needs no deposit, and it is where you find out how Binance treats your algorithm's orders before real money is involved.
Credentials panel
Open Settings from the account menu and choose Credentials. The panel lists the Binance API credentials, one for each environment, each with its state:
| State | Meaning |
|---|---|
| Not stored | Nothing is stored for that environment on this computer |
| Awaiting API key | A key pair is generated and waits for the API key from Binance |
| Stored on this machine | The credential is complete and can sign orders |
Each credential shows which environment it was issued for, for example Demo Mode key.
The first time you open the panel, its buttons are disabled. Read the note How your credentials are handled below the row and tick the box at its end. This is asked once.
Generated key pair
Binance accepts a key pair that you generate yourself: you give Binance the public half, and the private half never leaves your computer. Neurotrader generates the pair for you, as an Ed25519 key.
In the Binance API credentials row, choose Generate key pair.
Choose the environment the key is for, Demo Mode or Binance, and choose Generate.
Neurotrader creates the key pair. The private key goes straight into your computer's key store. The dialog moves on to Register the public key at Binance and shows the public key.
Choose Copy to copy the public key. The public key is not a secret.
Open API Management on the site the dialog names (it has a link), and create an API key there. When Binance asks for the kind of key, choose Self-generated and paste the public key.
Set the key's permissions at Binance as described in Permissions at the venue.
Binance shows the API key for the new key. Copy it, paste it into the API key field of the dialog, and choose Complete credential.
The row now reads Stored on this machine.
Unfinished key pairs
You can close the dialog with Later after the pair is generated. Nothing is lost: the row reads Awaiting API key and offers Enter API key, which reopens the dialog on its second step.
The public key is shown once, when the pair is generated. If you closed the dialog before registering it at Binance, choose Clear and generate a new pair.
A run cannot start while the credential is awaiting its API key.
Permissions at the venue
What a key may do is set at Binance, not in Neurotrader.
- Enable Spot & Margin Trading. Without it the key can only read, and a run is refused at start. Neurotrader trades spot only.
- Leave withdrawals off. Neurotrader never withdraws, and it refuses to start a run with a production key that can. A key that cannot withdraw cannot be used to take money out of the account.
- Restrict the key to your IP address if your address is fixed. A self-generated key can trade without an IP restriction, so a home connection with a changing address works.
Whether you may hold a Binance account at all is decided by Binance's terms for your country. Neurotrader does not check it and does not work around it.
Private key storage
- It stays on this computer. The private key is generated by the Neurotrader engine on your computer and written to the computer's key store: Credential Manager on Windows, the Keychain on macOS, and on Linux an encrypted key file that only this computer can open. It is in no configuration file and no run output, and it is never sent to Sigmastone.
- It is never shown again. Neither the app nor the API can read a stored credential back. The only thing that can be asked is whether one is stored and for which environment. That is why there is no masked field and no "show key" button.
- Orders go directly to Binance. The engine signs each request on your computer and sends it to Binance. Your key, your orders and your account details do not pass through Neurotrader's servers.
The design trusts this computer and the person signed in to it. Anything running under your account on the computer can ask the engine to place orders, so treat a compromised computer as a compromised key.
Existing keys
If you already made an Ed25519 key pair yourself and registered it at Binance, choose Add credentials (or Replace) in its row and fill in the form: the API key, the key type, the private key and the environment. The values exist only in the open dialog and are discarded when it closes.
Trading needs an Ed25519 key. A key of another type can be stored, and a run that uses it is refused at start.
Removal
In the row of the credential you want to remove, choose Clear. The credential for the other environment stays.
Confirm with Clear credentials.
The credential is removed from the computer's key store. It cannot be recovered from Neurotrader, because nothing can read it back.
No revocation at Binance
Clearing removes the credential from this computer only. The key is still valid at Binance. If you think a key has leaked, delete it in Binance's API Management first, then clear it here.
Do not clear a credential while a run that uses it is up. The run can no longer sign requests, and its open orders stay at Binance.
API
The same steps are available through the engine's API, for the credential
named binance.credentials:
list_secretssays whether a credential is stored.generate_secretgenerates the key pair and returns the public key.complete_secret_api_keyattaches the API key Binance issued.delete_secretclears the credential.
No operation returns a stored credential.
Related
- Demo runs: a first run on the Demo account
- Real funds runs: runs in the production environment
- Real trading safety: the rules for real funds
- Binance: what Neurotrader does at the venue
- Settings: the other settings categories
Live simulations
Create a live simulation on the Live Mode page, watch it trade the market as it moves, stop it, and read the run it leaves behind.
Demo runs
Run an algorithm on Binance's Demo account: create the run on the Real Mode page, start it, watch it, stop it with a choice for its open orders, and read the record.