GoTrader
A cryptocurrency trading bot supporting kraken futures written in Golang.
Current Features
- Support for sending any order on kraken futures (mkt, lmt, etc...)
- Support trading on kraken futures using stop loss & take profit indicator
- REST API support for kraken futures
- Websocket API support for kraken futures
- JWT Token auth support with deleting token on logout from device
- Telegram bot
- Swagger documentation
Planned Features
- Support multiple kraken api tokens
Exchange support table
Exchange | REST API | Streaming API |
---|---|---|
Kraken futures demo | Yes | Yes |
Kraken futures | Yes | Yes |
Tech stack
Local installation of server
Linux/OSX
-
git clone {this repo} cd {this repo}/course_project/trade-bot
-
Assume you haveconfig.yml
orconfig.yaml
file in configs folder of type:server: port: (int) websocket: readBufferSize: (int) 1024 by derfault writeBufferSize: (int) 1024 by default checkOrigin: (true | false) true by default client: # url of server url: (string) example - http://localhost:8000 telegram: apiToken: (string) your telegram api token from bot father webhookUrl: (string) example service for webhooks - ngrok postgreDatabase: host: (string) example - localhost port: (string) eample - 8000 username: (string) dbname: (string) sslmode: (string) redisDatabase: host: (string) example - localhost port: (string) password: (string) kraken: apiurl: (string) krakenWS: requests: writeWaitInSeconds: (int) 10 by default pongWaitInSeconds: (int) 60 by default pingPeriodInSeconds: (int) 10 by default maxMessageSize: (int) 512 by default kraken: wsapiurl: (string)
-
Assume you have.env
file at the root of project with following:DB_PASSWORD = (your postgres db password) JWT_ACCESS_SIGNING_KEY = (key for signing jwt tokens) PUBLIC_API_KEY = (public key from kraken futures) PRIVATE_API_KEY = (private key from kraken futures)
-
Run postgres with settings from your config file
# Example using docker docker pull postgres docker run --name postgres -e POSTGRES_PASSWORD='qwerty' -p 5432:5432 -d postgres
-
Run redis with settings from your config file
# Example using docker docker pull redis docker run --name redis -p 6379:6379 -d redis
-
Run migrate files for postgres usingmigrate
-
migrate installation
-
curl -s https://packagecloud.io/install/repositories/golang-migrate/migrate/script.deb.sh | sudo bash apt-get update apt-get install -y migrate
-
run migrate
-
migrate -path ./migrations -database 'postgres://{postgres_username}:{postgres_password}@{host}:{port}/postgres?sslmode={sslmode}' up
-
Then run server
go run cmd/api/main.go
Installation of server using Docker
Linux/OSX
-
You'll need Docker Compose
-
Make sure you have all config files like in local installation with some fixes
-
Fixes
postgreDatabase: host: db (like db service name in docker-compose file) ### redisDatabase: host: redis (like redis service name in docker-compose file)
-
Run docker-compose
docker-compose up --build server
-
Now simply run migration files like in local installation
Swagger
When server started: url: http://{host}:{port}/swagger/index.html