What is API Trading, and how does it apply to Bitcoin and cryptocurrencies?
In our first Cryptocurreny Traders Guide, we learn more about API Trading and how a Crypto API Trading Platform can help you become a better trader.
What is an API?
API is short for Application Programming Interface, and refers to a set of programming rules that describes how one software application can communicate and interact with another application.
Cryptocurrency API Trading
When it comes to cryptocurrency trading, using an exchange’s API enables you to programmatically connect with the exchange, allowing you to obtain real-time market and price data, make trades, and manage your account — all without having to log in to the exchange’s website interface. Using the exchange API also enables users to hook up their automated trading algorithms to the exchange platform to use their crypto trading bots to trade programmatically.
Trading APIs are particularly popular among hedge funds and proprietary trading firms due to their use of algorithmic trading programs, but even private investors can make use of trading APIs provided by cryptocurrency exchanges and brokerages.
How to Generate an Exchange API Key (Bitfinex)
Using Bitfinex as an example, let’s run through the steps required to generate your API key.
Step 1: After logging in to your Bitfinex account, hover over the ‘Manage Account’ icon at the top right of the interface, and click on ‘API’ from the drop-down menu.
Step 2: This brings you to the API page, where you can view your existing API Keys, as well as create a new key.
Step 3: Click on ‘Create New Key’, and tick the boxes for the permissions that you want the key to have access to. In this example, I have enabled ‘Write’ permissions for trading, but disabled ‘Withdraw’ option. Once done, click on ‘Generate API Key’. If you have 2FA enabled, a pop up will prompt you to enter your 2FA as confirmation.
Step 4: Check your email to complete the creation of the API key. Click on the ‘CREATE API KEY’ button in the email.
Step 5: Voilà! Your new API key has been successfully created! This redirects you to Bitfinex, and shows you the ‘API Key’ and ‘API Key Secret’. You will need both in order to use this API key. Make sure to store your API key in a safe place, as it will not be shown again.
Step 6 (optional): If you need to change the key’s permissions, click on the ‘My API Keys’ tab, then click on ‘Permissions’, which will open a new window for you to adjust the permissions accordingly.
Note that some exchanges do not allow you to adjust the permissions of an existing key, and in such cases, you will have to delete the old key and create a new one if you wish to have different permissions for the API key.
Types of Exchange API Keys Permissions
As shown in the Bitfinex example above, users can create API Keys with varying permissions. In general, there are usually 3 types of permissions:
- Read-only API
- Trade-enabled API
- Withdraw-enabled API
Read-only API keys allow users to fetch data from their accounts, such as their balances, orders, open positions. However, this key will not allow you to execute trades or withdraw funds.
Each type of permission can be seen as a subset of the next; Trade-enabled APIs can also allow read functions, while withdraw-enabled APIs also allow withdrawing.
While Bitfinex enables users to “pick and match” permissions, some exchanges have fewer customizability options, and only allow the 3 types of permissions as stated above.
Note: Not to be confused with different implementations of APIs used by various exchanges, such as REST, FIX and Websocket. Read here for more information about the different flavours of API, and the ideal Crypto Trading API.
Cryptocurrency API Trading Platforms
Besides building your own software to use these crypto API trading tools, there are also a myriad of crypto API trading platforms available on the market, that make use of exchange API integration to make life easier for traders.
Now that you’ve generated your exchange API, what can you do with it?
Such crypto API trading platforms have done all the hard work on the backend for you, connecting the APIs of multiple exchanges all in one place, so all you have to do is to get your API keys and plug them into the platform to enjoy the features.
Cryptocurrency API trading platforms offer varying functionalities, from cryptocurrency portfolio management tools, to crypto API trading platforms, to automated crypto trading bots, and other social trading and crypto copy trading platforms.
API Trading Risks
Despite the obvious benefits of APIs, there are also risks to consider.
Since your API Keys enable you to access your crypto trading account, it is imperative that you keep your API Keys in a safe place. Anyone else who gets access to your API Key and API Key Secret pair will also be able to access your account with the permissions given to the key.
Disabling the withdraw option is the first layer of security, so that even if someone else gets access to your key pair, they will not be able to directly withdraw funds from your account.
However, simply having disabled the withdraw option may not be enough, as there are still risks associated with write-enabled API keys which enable trading execution. There have been several cases in the past where users with API keys that have write-enabled permissions but no withdraw permissions, still have their account balances emptied when malicious actors target illiquid trading pairs to make the victim’s accounts buy high and sell low over and over again, essentially siphoning the victim account’s funds to their own.
Some exchanges provide an IP whitelisting feature, such that API Keys can only be used by specific IPs added into the whitelist.
Traders should also be aware of any API limitations, including rate limits (number of times you can call an API per time period), and the potential for downtime, which could have a significant effect on trading results.
To conclude, it is crucial that you keep your API Key and API Key Secret pair as safe as you would keep your passwords, seed phrases, or 2FA backup codes. If one were to use their API keys on Aluna Social and other 3rd party platforms such as crypto API trading platforms, make sure you are comfortable with the security practices in place by the platform, or simply use read-only keys in order to avoid any of the risks stated above.