The API key
Reading time: 5 minutes.
First: The exchange and your account.
What a key is
An API is the way a program talks to an exchange. An API key is a pass for a program. With it the strategy acts on your account without your exchange password.
On Binance, BingX and Bybit a key has two parts:
- API Key — the pass's name, you see it in the exchange's settings;
- Secret Key — the secret, like a password. Whoever knows both parts acts in your name.
At Coinbase and T-Invest the key is made differently — see Keys on the exchange side.
The key's rights
When you create a key, you choose what it may do.
| Right | What it gives | Does the strategy need it? |
|---|---|---|
| Reading | Seeing balances, orders and trades | Yes |
| Trading (spot or futures) | Placing and cancelling orders | Yes |
| Withdrawals | Moving money out of the exchange | Never |
Why forbid withdrawals? If the key is stolen, without the withdrawal right the money cannot be taken off the exchange.
The app checks the key with the exchange itself. It does not accept a key with withdrawals: “Withdrawals enabled — such a key is refused”. Once a day the service checks the keys again. If withdrawals were switched on for the key later, the message “🔴 … key (…): withdrawals are on” comes.
The IP list
An IP address is a computer's address on the internet. In the key's settings you can give a list of addresses the exchange accepts it from. Put only the address of the Alphafamilia Algo server there.
Why it is needed:
- Protection. A stolen key does not work from someone else's address. Even without withdrawals a stranger could trade to your harm.
- Binance. A key without an IP list can only read there. The strategy cannot trade.
- Bybit. A key without an IP list works for 90 days only.
The app shows the server's address when you add a connection, at the step “2 · Key and check”, with the “Copy” button. The app accepts a key without an IP list, but warns you.
How to create a key
- Switch on two-factor protection on the exchange. Without it the exchange will not let you create a key. What it is — the lesson Security.
- Open the key management on the exchange (API Management) and create a key.
- Confirm the creation with a two-factor code.
- Copy the Secret Key at once. The exchange shows it only once. Lost it — delete the key and create a new one.
- Switch trading on, leave withdrawals off, put the server's address into the IP list.
- Type the key into the app's form and press “Check the key”.
Step by step for each exchange — Keys on the exchange side.
Important. Type the key and the secret only into the app's form. Do not write them in a chat or an e-mail. Do not send them to anyone, not even the system administrator. The service never asks for them.
The key vault
Your keys are kept on the server in the key vault — encrypted. The vault opens with the vault password.
- You make up the vault password yourself, at least 10 characters. It is not your exchange password — choose a different one.
- The password is not stored anywhere. Without it the keys cannot be read — neither by the administrator nor by the developer.
- The password cannot be recovered. Keep it in a password manager.
- Forgot the password — press “I forgot the password”: you set a new one and enter the keys again. The strategies and the history stay; running strategies stop until you start them again.
- While the vault is closed, the strategies do not trade. After a server reboot you open the vault with your password.
More — Connections and the vault.
How the strategy uses it
The strategy places and cancels orders through your key. The key comes from the open vault. The strategy cannot withdraw money: the app does not accept a key with that right.
Check yourself
1. Which rights does a key for the strategy need?
Answer
Right: a) reading and trading
The strategy looks at the balance and the orders and trades. It does not need withdrawals, and the app does not accept a key with withdrawals.
2. Why put the server's address into the key (the IP list)?
Answer
Right: c) so that the key does not work from another address; on Binance there is no trading without it
The IP list protects a stolen key. On Binance a key without an IP list can only read.
3. You created a key but did not copy the Secret Key and closed the window. What do you do?
Answer
Right: c) delete this key and create a new one
The exchange shows the Secret Key only once. It cannot be recovered — it is easier to create a new key.
4. You forgot the vault password. What is true?
Answer
Right: d) it cannot be recovered: you set a new password and enter the keys again
The vault password is not stored anywhere. “I forgot the password” makes the vault anew, the keys are entered again; the strategies and the history stay.
Sources
- Binance: How to Create API Keys on Binance — two-factor protection is required; a key without an IP restriction can only read.