Binance minimal trading bot with API to easily run, stop or schedule trading strategies.
Build algorithms in Typescript with focus on best practices and painless developer experience.
- Minimal setup that can be extended 🔧
- Spin it up with single command 🌀
- Can be easily modified to work with any exchange or trading asset (currently setup to Binance)
- Dockerized:
- Instantly create multiple bot containers with different strategies parameters ⚡
- Nodejs v18 Alpine multi-stage image build ~120 MB (created on every GitHub Release)
- End-To-End type safety with TypeScript (Database <-> Bot <-> API <-> Frontend) - Always execute your trading strategies safe ✅
- tRPC API for seamless frontend app integration
- Optional Express.js REST API
- Websocket implementation. Get every single trade in real time.
- Implemented with Binance integration, but extendable for any crypto or stock exchange
Easily set up a local development environment with single command!
- clone the repo
- rename file to dev.env and set env vars(create Binance API keys)
npm run dev
🚀 (apply database migrations if needednpm run db-migration-generate
)
Run Ocignis React app to start, stop or schedule trading strategies.
- download market data (trades, klines, aggregates etc.) from Binance
npm run backtest-download-data
- seed database
npm run backtest-seed-database
npm run backtest-run
🚀
Run backtest in:
- terminal
npm run backtest-run
:
- or run Ocignis React app in browser:
demo-v.mp4
- TypeScript v5 codebase with Strict Configuration
- tRPC v10 API for client integration.
- Prisma v4 ORM
- Unit and integration tests with Jest
- Linting with ESLint
- Prettier code formatter
- Git hooks with Husky and lint-staged
- Commit messages must meet conventional commits format.
After staging changes just runnpm run commit
and get instant feedback on your commit message formatting and be prompted for required fields by Commitizen
Command | Description |
---|---|
prepare | Setup git hooks with Husky (executes on npm install) |
build-ocignis-shared | Build and export tRPC types |
dev | Start bot and database |
dev-changed-deps | Build and start bot image |
build | Build bot |
lint | Lint whole repository |
lint-fix | Run lint fix |
lint-staged-husky | Run prettier and lint on staged files |
tsc | Run TypeScript compiler |
test | Run tests |
test-watch | Run tests in watch mode |
format-lint | Lint formatting with Prettier |
format-fix | Fix formatting with Prettier |
commit | Run Commitizen on staged file |
clean | Remove installed, generated and cached folders (node_modules, coverage etc.) |
backtest-download-data | Download binance csv data files |
backtest-seed-database | Seed database for backtesting |
backtest-run | Run backtest |
db-prisma-client-generate | Generate Prisma client |
db-migration-generate | Generate migration |
db-migration-run | Run migration helper |
db-migration-run-dev | Run migration localy on dev |
db-migration-run-prod | Run migration on production |
docker-dev | Start bot localy on dev |
docker-prod | Start bot in production |
docker-compose-run | Start bot and database in docker containers |
docker-compose-run-changed-deps | Build bot image and start |