Welcome to the new Derive Hummingbot Connector Guide, your comprehensive resource for integrating and trading on Derive’s decentralized derivatives platform using Hummingbot. Powered by the innovative Derive Chain and built on the OP Stack for high throughput and low-cost settlements, Derive redefines onchain trading with seamless onboarding, robust self-custody, and advanced risk management for options, perpetuals, and structured products.
In this guide, we'll walk you through connecting your Derive account to Hummingbot and setting up an automated trading bot to harness these cutting-edge features. Let's dive in!
Before you can start trading on Derive using Hummingbot, you'll need to set up your wallet, connect it to the Derive platform, deposit funds, and configure your API access. This section walks you through these essential first steps to prepare your account for automated trading.
Derive supports multiple wallets such as Rabby Wallet, Coinbase wallet, Ledger etc, but for this guide, we'll use MetaMask, one of the most popular Ethereum wallets. MetaMask allows users to interact with Derive via its browser extension or mobile app.
Open your web browser and go to https://derive.xyz/. On the Derive homepage, click the "Connect Wallet" button, typically located in the top-right corner of the page.
From the list of available options, select "MetaMask".
MetaMask will open a pop-up asking you to confirm the connection.
After the wallet is connected, Derive will prompt you to sign a message to verify you are the owner of the wallet.
Check both boxes if you read through and agree with the terms and then "Agree and Continue"
Once your wallet is connected, you will need to deposit tokens into your Derive account. Deposit USDC, ETH, BTC and other tokens to start trading options and perps. Make sure you have enough balance to cover at least the minimum trading amount + fees.
After connecting, click the Developers link on the left side of the page. If you don't see it, go back to the Home page and then click Developers. Click Register Session Key and then enter in your Metamask Wallet's public address. You'll need to confirm the signature request in Metamask.
Once this is done, take note of a couple things which we will need to connect Hummingbot, the first one is the Derive Wallet address and second is the Subaccount ID
Derive is currently not available via the Hummingbot Dashboard due to dependency conflicts within the Hummingbot Library. Until this is resolved, please follow the instructions below to set up Derive using the standalone command-line client (Docker or Source installation).
The following instructions guide you through adding your Derive credentials to the standalone Hummingbot command-line client.
You will be prompted to provide various configuration parameters. Feel free to adjust the settings based on your preferences:
Select derive_perpetual as the name of the exchange you want to trade on.
Enter the total amount in quote asset to use for trading >>>
Enter the name of the exchange to trade on >>> derive_perpetual
Enter the trading pair to trade on >>>
Enter the maximum number of executors per side >>>
Set the leverage to use for trading >>>
Enter the stop loss >>>
Enter the take profit >>>
Enter the time limit in seconds >>>
Enter the order type for taking profit >>>
Enter the trailing stop as activation_price, trailing delta >>>
When prompted for the connector with the candles data, make sure to select a different connector other than derive since it doesn't currently support candles feed.
Enter the connector for the candles data, leave empty to use the same exchange as the connector:
Enter the trading pair for the candles data, leave empty to use the same trading pair as the connector:
Once the configuration is done, give the controller config a name or use the default one:
Create a script config
Next we have to create the script config for the v2_with_controllers generic script to run our controller config.
To create the script config, use the following command:
create--script-configv2_with_controllers
Make sure to enter the file name of the controller config we created earlier
Lastly, give the script config a name
Start the strategy
To start the strategy, use the following command. Note - if your config file has a different file name then replace the config name below
You can monitor your bot by checking the logs for any errors and running the status command to view the current order status. If needed, you can close the log pane to get a clearer view of the status.
This strategy is designed to place a buy order when the price approaches the lower Bollinger Band (indicating an oversold condition) and a sell order when the price reaches the upper Bollinger Band (indicating an overbought condition). Since the bot waits for favorable conditions before executing trades, you may need to allow some time before it places its first order.
status
Stop the Bot
To stop the bot, use the stop command. Please note that the bot will need some time to create orders to close out the positions.
stop
For more details on V2 Strategies or other available controllers, check out the Controllers section of V2 Strategies documentation. Please note that since Derive only supports one-way mode some V2 Strategies that use Hedge mode may not work correctly with the controller.
Derive Rate Limit - The system enforces rate limits using a fixed window algorithm, replenishing the request allowance every 5 seconds to maintain system stability. Market makers can access higher rate limits upon request by contacting the support team.
When using perpetual futures exchanges, leverage refers to the size of your position relative to the collateral you have provided. Specifically, it's calculated as: