Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges
Kelp is a free and open-source trading bot for the Stellar universal marketplace and for centralized exchanges such as Binance, Kraken, CoinbasePro, etc.
Kelp includes several configurable trading strategies and exchange integrations. You can define your own parameters or use the sample configurations to quickly get up and running with a trading bot in a matter of minutes. The modular design allows you to easily create new trading strategies, exchange integrations, and assets to give you full control over the bot.
Kelp is built to:
To learn more about the Stellar protocol check out Stellar Videos on Coinbase Earn, or this video about the Stellar DEX created by Lumenauts, or read more about it on the Stellar Website.
Important Disclaimer: Be Smart and Go Slow. Whenever you trade on Stellar, you are trading with volatile assets, in volatile markets, and you risk losing money. Kelp is an experimental software that contains bugs. Use Kelp at your own risk. There is no guarantee you'll make a profit from using our bots or strategies. In fact, if you set bad parameters or market conditions change, Kelp might help you lose money very fast. So be smart and go slow.
There is one binary associated with this project:
kelp. Once the binary is downloaded, run the bot by following the instructions in Running Kelp.
You can find the pre-compiled binary for your platform from the Github Releases Page.
Here is a list of binaries for the most recent release v1.0.0-rc2 (v1.11.0):
| Platform | Architecture | Binary File Name | | -------------- | ------------ | ---------------- | | MacOS (Darwin) | 64-bit | kelp-v1.11.0-darwin-amd64.tar | | Windows | 64-bit | kelp-v1.11.0-windows-amd64.tar | | Linux | 64-bit | kelp-v1.11.0-linux-amd64.tar |
Here is a list of binaries for the most recent release v1.11.0:
| Platform | Architecture | Binary File Name | | -------------- | ------------ | ---------------- | | MacOS (Darwin) | 64-bit | kelp-v1.11.0-darwin-amd64.tar | | Windows | 64-bit | kelp-v1.11.0-windows-amd64.tar | | Linux | 64-bit | kelp-v1.11.0-linux-amd64.tar | | Linux | 64-bit arm | kelp-v1.11.0-linux-arm64.tar | | Linux | 32-bit arm5 | kelp-v1.11.0-linux-arm5.tar | | Linux | 32-bit arm6 | kelp-v1.11.0-linux-arm6.tar | | Linux | 32-bit arm7 | kelp-v1.11.0-linux-arm7.tar |
After you untar the downloaded file, change to the generated directory (
kelp-v1.11.0) and invoke the
Here's an example to get you started (replace
filenamewith the name of the file that you download):
tar xvf filename cd kelp-v1.11.0 ./kelp
To run the bot in simulation mode, try this command:
./kelp trade -c sample_trader.cfg -s buysell -f sample_buysell.cfg --sim
Note for Windows Users: You should use a Bash Shell to follow the steps below. This will give you a UNIX environment in which to run your commands and will enable the
./scripts/build.shbash script to work correctly.
To compile Kelp from source:
$GOPATHis set, and that
$PATHincludes the full filepath of
curl https://glide.sh/get | sh
git clone [email protected]:stellar/kelp.git
kelpdirectory for all following commands:
go get -u github.com/asticode/go-astilectron-bundler/...
go install github.com/asticode/go-astilectron-bundler/astilectron-bundler
sudo docker run -p 3000:3000 -d franzsee/ccxt-rest:v0.0.4
Kelp places orders on the Stellar marketplace based on the selected strategy. Configuration files specify the Stellar account and strategy details.
These are the following commands available from the
trade: Trades with a specific strategy against the Stellar universal marketplace -
exchanges: Lists the available exchange integrations along with capabilities -
strategies: Lists the available strategies along with details -
version: Version and build information -
help: Help about any command
tradecommand has three required parameters which are:
Kelp sets the
X-App-Versionheaders on requests made to Horizon. These headers help us track overall Kelp usage, so that we can learn about general usage patterns and adapt Kelp to be more useful in the future. Kelp also uses Amplitude for metric tracking. These can be turned off using the
kelp trade --helpfor more information.
Here's an example of how to start the trading bot with the buysell strategy:
kelp trade --botConf ./path/trader.cfg --strategy buysell --stratConf ./path/buysell.cfg
If you are ever stuck, just run
kelp helpto bring up the help section or type
kelp help [command]for help with a specific command.
localhost:3000so Kelp can connect to it.
The CCXT-REST server must be running on port
3000before you start up the Kelp bot. You can list the exchanges (
./kelp exchanges) to get the full list of supported exchanges via CCXT.
Note: this integration is still experimental and is also incomplete. Please use at your own risk.
CCXT-rest can be run in any one of the following ways.
We have compiled the ccxt-rest v0.0.4 server as a binary for all x86 platforms (linux, darwin, windows). This is the version that Kelp currently uses.
You can find these pre-compiled binaries of the CCXT-rest server in the releases tab here.
Install docker (linux:
sudo apt install -y docker.io) and run the CCXT-REST docker image configured to port
sudo docker run -p 3000:3000 -d franzsee/ccxt-rest:v0.0.4). You can find more details on the CCXT_REST github page.
Postgres v12.1 or later must be installed for Kelp to automatically write trades to a sql database along with updating the trader config file.
It's easier to learn with examples! Take a look at the walkthrough guides and sample configuration files below.
COUPON, to show you how to set up your account before deploying the bot.
buysellstrategy to provide liquidity for a stablecoin.
sellstrategy to make a market using sell offers for native tokens in a hypothetical ICO.
sell_twapstrategy to consistently sell tokens throughout the day. This can also be used for ICOs.
balancedstrategy to create liquidty for a token which only trades on the Stellar network.
pendulumstrategy to create liquidty for a token.
Each strategy you implement needs a configuration file. The format of the configuration file is specific to the selected strategy. You can use these files to customize parameters for your chosen strategy.
The following reference config files are in the examples folder:
Kelp includes an assortment of strategies, price feeds, and plugins you can use to customize your bot. Kelp also enables you to create your own trading strategies.
Strategies are at the core of Kelp. Without them it's just lazy, capable of nothing, thinking of nothing, doing nothing, like our friend [scooter][scooter video] here. The strategies give your bot purpose. Each approaches the market in a different way and is designed to achieve a particular goal.
The following strategies are available out of the box with Kelp:
Refer to this [Pull Request][pr-template-new-strategy] to see an example template of a new trading strategy.
Price Feeds fetch the price of an asset from an external source. The following price feeds are available out of the box with Kelp:
crypto: fetches the price of tokens from [CoinMarketCap][cmc]
fiat: fetches the price of a [fiat][fiat] currency from the [CurrencyLayer API][currencylayer]
exchange: fetches the price from an exchange you specify, such as Kraken or Poloniex. You can also use the [CCXT][ccxt] integration to fetch prices from a wider range of exchanges (see the Using CCXT section for details)
fixed: sets the price to a constant
function: uses a pre-defined function to combine the above price feed types into a single feed. We currently support only two types
Exchange integrations provide data to trading strategies and allow you to [hedge][hedge] your positions on different exchanges. The following exchange integrations are available out of the box with Kelp:
"sdex") (source): The [Stellar Decentralized Exchange][sdex]
"kraken") (source): [Kraken][kraken] - recommended to use
"ccxt-kraken") (source): Kraken via CCXT - full two-way integration (tested)
"ccxt-binance") (source): Binance via CCXT - full two-way integration (tested)
"ccxt-coinbasepro") (source): Coinbase Pro via CCXT - full two-way integration (tested)
"ccxt-poloniex") (source): Poloniex via CCXT - only tested on priceFeeds and one-way mirroring
"ccxt-bittrex") (source): Bittrex via CCXT - only tested on priceFeeds and onw-way mirroring
Kelp can easily be extended because of its modular plugin based architecture. You can create new flavors of the following components: Strategies, PriceFeeds, and Exchanges.
These interfaces make it easy to create plugins:
The folders are organized to make it easy to find code and streamline development flow. Each folder is its own package without any sub-packages.
github.com/stellar/kelp ├── api/ # API interfaces live here (strategy, exchange, price feeds, etc.) ├── cmd/ # Cobra commands (trade, exchanges, strategies, etc.) ├── examples/ # Sample config files and walkthroughs ├── model/ # Low-level structs (dates, orderbook, etc.) ├── plugins/ # Implementations of API interfaces (sell strategy, kraken, etc.) ├── support/ # Helper functions and utils ├── trader/ # Trader bot logic; uses other top-level packages like api, plugins, etc. ├── glide.yaml # Glide dependencies ├── main.go # main function for our kelp binary └── ...
You can use [Stellar-Downloader][stellar-downloader] to download trade and payment data from your Stellar account as a CSV file.
See the Contribution Guide and then please [sign the Contributor License Agreement][cla].
See the Changelog.
See the Code of Conduct.
TEST2 issued by the
GCL4KBYTRA3QYI4JTN4FWVYVYNI67W2M6XMDUB2V6ZLWFASIYHWEJPHU account are test assets used to test Kelp on the production Stellar Network. These assets have no value and are marked as
auth_required with the intent to close them off from the rest of the Stellar ecosystem. No trustlines will be accepted against these assets. As part of our testing process, you may observe a market and trades between these two tokens. It is not intended for any of these assets to represent any meaningful volume on the Stellar Network.