xhulz / CryptoBot

Bot that is able to alert you about price oscillations on a given currency pair.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Features

This bot connect to Uphold public ticker and retrieve the BTC-USD rate every 5 seconds. Each time it retrieve a new rate, the bot must compare it with the first one and decide if it should alert of an oscillation. All alerts have been saved on database

Tech

This project uses a number of open source projects to work properly:

Installation

This project requires Node.js v14+ to run.

Install the dependencies and devDependencies and start the server.

npm install

Development

Open your favorite Terminal and run these commands.

First step: Check the configuration file

In the '.env' file, we have all bot settings. Feel free to change them:

MONGOOSE_CONNECTION_STRING=mongodb://localhost:27017/uphold - #Database path 
TIMER=5000 - #Timer to get the ticker milliseconds
TICKER_URL=https://api.uphold.com/v0/ticker/ - #Ticker url
PAIR="BTCUSD,BATUSD" - #Array of currency pairs divided by comma
PRICE_CHANGE_PERCENT=0.01 - #Index for price changes in percentage

Second step: Run the project in dev mode

# server with hot reload
$ npm run dev

Third step: Run the test suite

# run tests
$ npm run test

Building for source (Production)

For production release:

# build for production
$ npm run build
# run the project in prd mode
$ npm run start

Docker

This project is very easy to run in a Docker container.

By default, the Docker will expose port 3000, so change this within the Dockerfile if necessary.

docker-compose up

Improvements

  • Create automation pipelines for test validation and deploy via gitlab (gitlab-ci.yml)
  • Detailing of unit tests

License

MIT

Free Software, Hell Yeah!

About

Bot that is able to alert you about price oscillations on a given currency pair.


Languages

Language:TypeScript 99.1%Language:Dockerfile 0.9%