Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges

License

NotificationsYou must be signed in to change notification settings

stellar-deprecated/kelp

Repository files navigation

Kelp logo

GitHub last commitGithub All Releaseslicense

GodocGo Report CardBuild StatusContributors

Kelp is a free and open-source trading bot for theStellar 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:

  • Make spreads and make markets
  • Create liquidity and facilitate price-discovery for ICOs
  • Price and trade customstablecoins
  • Mimic orderbooks from other exchanges

To learn more about the Stellar protocol check outStellar Videos on Coinbase Earn, orthis video about the Stellar DEX created by Lumenauts, or read more about it on theStellar Website.

Be Smart and Go Slow

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.

Your use of Kelp is governed by the Apache 2.0 open-source license. Please note that SDF’s interactions with you are governed by the SDFTerms of Service andPrivacy Policy.

Kelp GUI screenshot

Table of Contents

Getting Started

How To Get Kelp

To get started with Kelp,either download the pre-compiled binary for your platform from theGithub Releases Pageorcompile Kelp from source.

There isone binary associated with this project:kelp. Once the binary is downloaded, run the bot by following the instructions inRunning Kelp.

Download Kelp Binary

You can find the pre-compiled binary for your platform from theGithub Releases Page.

GUI

Here is a list of binaries for the most recent releasev1.0.0-rc2 (v1.12.0):

PlatformArchitectureBinary File Name
MacOS (Darwin)64-bitkelp-v1.12.0-darwin-amd64.tar
Windows64-bitkelp-v1.12.0-windows-amd64.tar
Linux64-bitkelp-v1.12.0-linux-amd64.tar

CLI

Here is a list of binaries for the most recent releasev1.12.0:

PlatformArchitectureBinary File Name
MacOS (Darwin)64-bitkelp-v1.12.0-darwin-amd64.tar
Windows64-bitkelp-v1.12.0-windows-amd64.tar
Linux64-bitkelp-v1.12.0-linux-amd64.tar
Linux64-bit armkelp-v1.12.0-linux-arm64.tar
Linux32-bit arm5kelp-v1.12.0-linux-arm5.tar
Linux32-bit arm6kelp-v1.12.0-linux-arm6.tar
Linux32-bit arm7kelp-v1.12.0-linux-arm7.tar

After youuntar the downloaded file, change to the generated directory (kelp-v1.12.0) and invoke thekelp binary.

Here's an example to get you started (replacefilename with the name of the file that you download):

tar xvf filenamecd kelp-v1.12.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

Run With Docker

This docker image (nikhilsaraf/kelp:latest) points to the latest pre-compiled version of the kelp binary v1.12.0, which can be run like this:

docker run nikhilsaraf/kelp:latest versiondocker run nikhilsaraf/kelp:latest trade -c sample_trader.cfg -s buysell -f sample_buysell.cfg --simdocker run nikhilsaraf/kelp:latest exchangesdocker run nikhilsaraf/kelp:latest strategies

Compile from Source

Note for Windows Users: You should use aBash 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.sh bash script to work correctly.

To compile Kelp from source:

  1. Download andsetup Golangv1.13 or later
    1. Set environment variableexport GOPROXY=https://goproxy.io,https://proxy.golang.org,https://goproxy.cn
  2. InstallYarn andNodeJs (Node v12.3.1 vianvm) to build the Kelp GUI
  3. Clone the kelp repositorygit clone git@github.com:stellar/kelp.git
  4. Install theastilectron-bundler binary
    • go install github.com/asticode/go-astilectron-bundler/astilectron-bundler
  5. Build the binaries using the provided build script (thego install command will produce a faulty binary):
    • ./scripts/build.sh(this must be invoked from root directory i.e. kelp)
  6. Confirm one new binary file exists with version information.
    • ./bin/kelp version
  7. Set up CCXT to use an expanded set of priceFeeds and orderbooks (see theUsing CCXT section for details)
    • sudo docker run -p 3000:3000 -d franzsee/ccxt-rest:v0.0.4

Running Kelp

Kelp places orders on theStellar marketplace based on the selected strategy. Configuration files specify the Stellar account and strategy details.

These are the following commands available from thekelp binary:

  • 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

Thetrade command has three required parameters which are:

  • botConf: full path to the.cfg file with the account details,sample file here.
  • strategy: the strategy you want to run (sell,sell_twap,buysell,balanced,pendulum,mirror,delete).
  • stratConf: full path to the.cfg file specific to your chosen strategy,sample files here.

Kelp sets theX-App-Name andX-App-Version headers 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--no-headers flag. Seekelp trade --help for more information.

Here's an example of how to start the trading bot with thebuysell strategy:

kelp trade --botConf ./path/trader.cfg --strategy buysell --stratConf ./path/buysell.cfg

If you are ever stuck, just runkelp help to bring up the help section or typekelp help [command] for help with a specific command.

Using CCXT

You can use theCCXT library via theCCXT REST API Wrapper to fetch prices and orderbooks from a larger number of exchanges. You will need to run the CCXT REST server onlocalhost:3000 so Kelp can connect to it.

The CCXT-REST servermust be running on port3000before 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 stillexperimental and is alsoincomplete. Please use at your own risk.

CCXT-rest can be run in any one of the following ways.

Download CCXT Binary

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 thereleases tab here.

Run CCXT using Docker

Installdocker (linux:sudo apt install -y docker.io) and run the CCXT-REST docker image configured to port3000 (linux:sudo docker run -p 3000:3000 -d franzsee/ccxt-rest:v0.0.4).You can find more details on theCCXT_REST github page.

Using Postgres

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.

Using Auth0

Aauth0 account is required. To use it, uncomment [AUTH0] section inSample GUI config file and enter your auth0 crendentials in required fields.Note: AUTH0 is only applicable for Kelp GUI or Kaas Mode. Intructions of how to configure your auth0 account can be foundhere

Examples

It's easier to learn with examples! Take a look at the walkthrough guides and sample configuration files below.

Walkthrough Guides

Configuration Files

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 theexamples folder:

Winning Educational Content from StellarBattle

SDF sponsored aKelp StellarBattle in August/September 2020, here were the winning results (announcement):

Components

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.

click to expand Components section

Strategies

Strategies are at the core of Kelp. Without them it's just lazy, capable of nothing, thinking of nothing, doing nothing, like our friendscooter 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 availableout of the box with Kelp:

  • sell (source):

    • What: creates sell offers based on a reference price with a pre-specified liquidity depth
    • Why: To sell tokens at a fixed price or at a price that changes based on an external reference price
    • Who: An issuer could use Sell to distribute tokens from an ICO pre-sale
  • sell_twap (source):

    • What: creates sell offers based on a reference price spread over the day for a given daily sale amount
    • Why: To sell tokens consistently using the time-weighted-average-price (TWAP) metric
    • Who: An issuer could use SellTwap to distribute tokens from an ICO pre-sale in a consistent manner
  • buysell (source):

    • What: creates buy and sell offers based on a specific reference price and a pre-specified liquidity depth while maintaining aspread.
    • Why: To make the market for tokens based on a fixed or external reference price.
    • Who: Anyone who wants to create liquidity for a stablecoin orfiat token
  • balanced (source):

    • What: dynamically prices two tokens based on their relative demand (like AMMs). For example, if more traders buy token Afrom the bot (the traders are therefore selling token B), the bot will automatically raise the price for token A and drop the price for token B. This strategy does not allow you to configure the order size but can run out of assets. This is a mean-reversion strategy.
    • Why: To let the market surface thetrue price for one token in terms of another.
    • Who: Market makers and traders for tokens that have a neutral view on the market
  • pendulum (source):

    • What: dynamically prices two tokens based on their relative demand (like AMMs). For example, if more traders buy token Afrom the bot (the traders are therefore selling token B), the bot will automatically raise the price for token A and drop the price for token B. This strategy allows you to configure the order size but runs the risk of running out of one of the two assets. This is a mean-reversion strategy.
    • Why: To let the market surface thetrue price for one token in terms of another.
    • Who: Market makers and traders for tokens that have a neutral view on the market
  • mirror (source):

    • What: mirrors an orderbook from another exchange by placing the same orders on Stellar after including aspread.
    • Why: Tohedge your position on another exchange whenever a trade is executed to reduce inventory risk while keeping a spread
    • Who: Anyone who wants to reduce inventory risk and also has the capacity to take on a higher operational overhead in maintaining the bot system.
  • delete (source):

    • What: deletes your offers from both sides of the specified orderbook.Note: does not need a strategy-specific config file.
    • Why: To kill the offers placed by the bot.This is not a trading strategy but is used for operational purposes only.
    • Who: Anyone managing the operations of the bot who wants to stop all activity by the bot.

Refer to thisPull Request to see an example template of a new trading strategy.

Price Feeds

Price Feeds fetch the price of an asset from an external source. The following price feeds are availableout of the box with Kelp:

  • crypto: fetches the price of tokens fromCoinMarketCap
  • fiat: fetches the price of afiat currency from theCurrencyLayer API
  • exchange: fetches the price from an exchange you specify, such as Kraken or Poloniex. You can also use theCCXT integration to fetch prices from a wider range of exchanges (see theUsing 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
    • max -max(exchange/ccxt-binance/XLM/USDT/mid,exchange/ccxt-coinbasepro/XLM/USD/mid)
    • invert -invert(exchange/ccxt-binance/XLM/USDT/mid)

Exchanges

Exchange integrations provide data to trading strategies and allow you tohedge your positions on different exchanges. The followingexchange integrations are availableout of the box with Kelp:

  • sdex ("sdex") (source): TheStellar Decentralized Exchange
  • kraken ("kraken") (source):Kraken - recommended to useccxt-kraken instead
  • kraken (via CCXT) ("ccxt-kraken") (source): Kraken via CCXT - full two-way integration (tested)
  • binance (via CCXT) ("ccxt-binance") (source): Binance via CCXT - full two-way integration (tested)
  • coinbasepro (via CCXT) ("ccxt-coinbasepro") (source): Coinbase Pro via CCXT - full two-way integration (tested)
  • poloniex (via CCXT) ("ccxt-poloniex") (source): Poloniex via CCXT - only tested on priceFeeds and one-way mirroring
  • bittrex (via CCXT) ("ccxt-bittrex") (source): Bittrex via CCXT - only tested on priceFeeds and onw-way mirroring

Plugins

Kelp can easily be extended because of itsmodular plugin based architecture.You can create new flavors of the following components: Strategies, PriceFeeds, and Exchanges.

These interfaces make it easy to create plugins:

  • Strategy (source) - API for a strategy
  • PriceFeed (source) - API for price of an asset
  • Exchange (source) - API for crypto exchanges

Directory Structure

The folders are organized to make it easy to find code and streamline development flow.Each folder is its own packagewithout 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└── ...

Accounting

You can useStellar-Downloader to download trade and payment data from your Stellar account as a CSV file.

Community

click to expand Community section

Contributing

See theContribution Guide and then pleasesign the Contributor License Agreement.

Changelog

See theChangelog.

Code of Conduct

See theCode of Conduct.

Project Improvements

Public Assets

click to expand Public Assets section

TEST1 andTEST2 issued by theGCL4KBYTRA3QYI4JTN4FWVYVYNI67W2M6XMDUB2V6ZLWFASIYHWEJPHU account are test assets used to test Kelp on the production Stellar Network.These assets have no value and are marked asauth_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.


[8]ページ先頭

©2009-2025 Movatter.jp