OpenTrader is an advanced cryptocurrency trading bot offering high-frequency, cross-exchange arbitrage and event-based strategies, including technical analysis with indicators. Features a user-friendly management UI, robust backtesting capabilities, and support for 100+ exchanges via CCXT.
Strategies:
- Grid: A grid trading strategy that profits from the price fluctuation of an asset.
- RSI: A Relative Strength Index (RSI) strategy that buys and sells based on the RSI indicator.
-
DCA
: Dollar-Cost Averaging (DCA) strategy that buys an asset at regular intervals.
Supported exchanges: OKX
, BYBIT
, BINANCE
, KRAKEN
, COINBASE
, GATEIO
# NodeJS v20 or higher
$ node -v
# `pnpm` must be installed
$ pnpm -v
# Install Turborepo globally
$ pnpm install turbo --global
# Docker (optional)
$ docker -v
The project uses a single .env
file in the root directory.
Frameworks such as Next.js require the .env
file to be located directly in the project directory.
To address this, some apps/packages
might include a symlink pointing to the root .env
file.
- Create environment file
.env
in the root directory
$ cp .env.example .env
- Replace the
DATABASE_URL
if your URL is different from the actual one.
- Install dependencies
$ pnpm install
- Build packages
$ turbo run build
- Run db migrations
$ turbo run prisma:migrate
- Seed the database
$ turbo run prisma:seed
โ ๏ธ Note: Since the packages do not have a dev server, running thebuild
command is mandatory on the first run.
Copy the exchanges.sample.json5
file to exchanges.json5
and add your API keys.
Supported exchanges: OKX, BYBIT, BINANCE, KRAKEN, COINBASE, GATEIO
Create the strategy configuration file config.json5
. We will use the grid
strategy as an example.
{
// Grid strategy params
settings: {
highPrice: 70000, // upper price of the grid
lowPrice: 60000, // lower price of the grid
gridLevels: 20, // number of grid levels
quantityPerGrid: 0.0001, // quantity in base currency per each grid
},
pair: "BTC/USDT",
exchange: "DEFAULT",
}
Currently supported strategies:
grid
,rsi
Command: ./bin/cli.sh backtest <strategy> --from <date> --to <date> -t <timeframe>
Example running a grid
strategy on 1h
timeframe.
$ bin/cli.sh backtest grid --from 2024-03-01 --to 2024-06-01 -t 1h
To get more accurate results, use a smaller timeframe, e.g. 1m, however, it will take more time to download OHLC data from the exchange.
Before running live trading, you need to start the daemon:
$ bin/cli.sh up
Now the daemon is ready to listen for incoming commands.
Tip: To run the daemon in the background, use:
bin/cli.sh up -d
Command: bin/cli.sh trade <strategy>
Example running a live trading with grid
strategy.
$ bin/cli.sh trade grid
To stop the live trading, run
bin/cli.sh stop
To stop the daemon, run the following command:
$ bin/cli.sh down
The user interface allows managing multiple bots and strategies, viewing backtest results, and monitoring live trading.
Currently, the UI is under development. For early access, please email me at [email protected]
After getting the access, run the following command to pull the UI into monorepo:
$ git submodule update --init
Run frontend app:
$ pnpm i
$ turbo run build
$ turbo run dev
- Frontend: http://localhost:3000
- API: http://localhost:4000
- Strategies dir: packages/bot-templates
- Indicators: packages/indicators
- Exchange connectors: packages/exchanges
Licensed under the Apache 2.0 License. See the LICENSE file for more information.