Coder Social home page Coder Social logo

trade-bot's Introduction

GoTrader

gopher

Build Status

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 have config.yml or config.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 using migrate

  • 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


trade-bot's People

Contributors

ew0s avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.