Cryptocurrency trading bot
🚧 Project is currently under development! 🚧
- 🚀 Realtime super-fast websocket trading.
- 📈 50+ Technical indicators. (docs)
- 🌈 Written in TypeScript!
- 🌿 Unit tested source code.
- 🔫 Mutation testing for better testing quality
- 📝 Paper trading a strategy on LIVE exchange data.
- 🏡 Backtesting engine with local data.
- ⚡️ Test & live reload your strategy in our online dashboard!
- 🚢 Run SockTrader inside a docker container.
- More features soon..
Any strategy that has been developed in SockTrader can be backtested using our online dashboard. Once you change and save the code of the selected strategy the dashboard should automatically update itself and rerun the backtest.
Try it yourself:
- Follow our Quick Start guide
- Run
npm run web
and leave all settings as default. - Go to our online dashboard and test your strategies!
- Clone the repository locally:
git clone https://github.com/SockTrader/SockTrader
- Add trading bot configuration:
cp src/config.ts.dist src/config.ts
- (optional) Edit
src/config.ts
- Build docker image:
cd SockTrader && docker build -t socktrader .
- Start container:
docker run socktrader --help
- Clone the repository locally:
git clone https://github.com/SockTrader/SockTrader
- Install dependencies:
cd SockTrader && npm install
- Add trading bot configuration:
cp src/config.ts.dist src/config.ts
- (optional) Edit
src/config.ts
- Build project:
npm run build
- Run SockTrader:
node ./build/index.js --help
- Transform our candle data (BTC/USD Bitstamp) from
src/data
to a readable format inbuild/data
:npm run normalize
- Run backtest with the normalized candles and the simple moving average strategy!
npm run backtest -- --candles=bitstamp_btcusd_1h --strategy=simpleMovingAverage
npm run test
run jest test suitenpm run web-dev
start development webserver with nodemon for quick & easy developmentnpm run web
start webserver. Can be used for "live reload" using websockets
Load your own candle data of a trading pair of your interest: Create a candle normalizer in "src/data" folder
Create your own strategy Create your own strategy
Download raw candles from a trusted source in json or csv format and copy this file to the src/data
folder.
A candle normalizer is a small utility script that is tightly coupled to a raw candle file. It will normalize the candles
from a raw csv or json file and output them in a generic format in the build/data
folder. This normalization process
can be triggered by running: npm run normalize
.
The expected output of a normalizer is a IDataFrame interface from data-forge. Each row in the data frame should respect the following type definition:
{
timestamp: Moment,
high: number,
low: number,
open: number,
close: number,
volume: number,
}
Redundant properties which are not listed in the type definition above will be ignored by the trading bot.
If you run into any issue, consider removing them as well by calling .dropSeries(["REDUNDANT_PROPERTY"])
since we cannot
guarantee that it will still work in the future. Data-forge and moment are already included as a dependency and they are
used throughout the SockTrader codebase.
The following example will give you a good idea of how you can create your own candle normalizer. Make sure to put this file
into the src/data
folder next to the raw candle files. Preferably with the same name as the candle file but with .ts extension.
Example:
// src/data/bitstamp_btcusd_1h.ts
import {IDataFrame} from "data-forge";
import moment from "moment";
import path from "path";
import CandleNormalizer from "../sockTrader/core/candles/candleNormalizer";
// Be sure to go back to the src folder, since this script will be executed from the build/data folder!!
const SRC_PATH = "../../src/data";
const PATH = path.resolve(__dirname, SRC_PATH, "bitstamp_btcusd_1h.csv");
const parser = (dataFrame: IDataFrame<number, any>): IDataFrame<number, any> => {
return dataFrame
.dropSeries(["Symbol"]) // Redundant property
.renameSeries({
"Date": "timestamp",
"High": "high",
"Low": "low",
"Open": "open",
"Close": "close",
"Volume To": "volume",
})
.select(row => {
row.timestamp = moment(row.timestamp, "YYYY-MM-DD hh-A");
return row;
})
};
export default new CandleNormalizer(PATH, parser);
Take a look at the given example strategy in this repository: simpleMovingAverage strategy
We're looking for extra contributors to give this project a well deserved boost. Don't hesitate to contact us on: Telegram or Gitter
Or you can also support us by:
- Donating money for covering the hosting costs
- Pay for advertisements on the SockTrader dashboard
- Or sharing interesting knowledge with the community
- Improve communication between dashboard & SockTrader
- Update and improve live trading
- Test edge case scenarios (possible rounding issues)
- Test altcoin trading and improve if needed
- Add basic backtest analyzers
- Dashboard internationalization
- Improve dashboard architecture
- Increase test coverage and test quality
- Add more and better documentation
- Improve logging
- Add extra exchanges
- Add more advanced backtest analyzers
- Show status of wallet in dashboard
- Show status of analyzers in dashboard
- And so much more..
Let us know if you have great ideas to improve the project! Feel free to open a pull request.
Using a trading bot does not mean guaranteed profit.
Also, trading crypto currency is considered high risk.
Losses are possible, which SockTrader cannot be held responsible for.