SteemJS Tools - Witness Price Feed in NodeJS

For a long time I've been using the legendary Steemfeed-JS by @someguy123. However, it uses the outdated https://github.com/svk31/steemjs-lib which is buggy and causes script crashes every once in a while. Also, Steemfeed-JS is only working for Bittrex prices now that Poloniex has been utterly unreliable with its disabled STEEM/SBD wallet therefore having much lower traded volumes with a different (lower) price than the rest of the exchanges.

There are other price feed scripts out there, but I decided to write my own for several reasons.

  • Programming is fun.
  • Learn something new.
  • Customize the tool to my liking.
  • Address and fix the problems in Steemfeed-JS.
  • Average the price from the major exchanges: Binance, Bittrex, Huobi and UpBit.

STEEM Price Feed

A price feed application written in NodeJS for witnesses on the Steem network.

Features

  • Application resilience with NodeJS restart on crash/exit.
  • Automatic RPC switching.
  • Averaged price from up to 5 major cryptocurrency exchanges.

Pre-install (e.g. Ubuntu 16.04)

Requires NodeJS >7.6 (for the async functions).

sudo apt update
sudo apt install -y curl software-properties-common gnupg build-essential libssl-dev
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt install -y nodejs
sudo npm i npm@latest -g

Install

git clone https://github.com/Jolly-Pirate/pricefeed.git
cd pricefeed
cp app/config.json.example app/config.json
chmod 600 app/config.json

Edit the app/config.json then install and start the app

npm install
npm start

Screen session example

Start and enter a screen session: screen -S pricefeed

Start the script: npm start

Detach from the screen session with CTRL-a-d. This will leave it running in the background.

Reattach to the session with screen -x pricefeed to monitor its status.

If you want to terminate the script press CTRL-c, then type exit to close the session.


Docker install (recommended)

git clone https://github.com/Jolly-Pirate/pricefeed.git
cd pricefeed
chmod +x run.sh
./run.sh install_docker
./run.sh build

Edit the file app/config.json accordingly (see the section below), then start the container with

./run.sh start

Check that it's running fine with ./runs.sh logs

Type ./run.sh without arguments for a list of options.


Configuration

The configuration is located in the file app/config.json.

  • witness: witness account
  • privateActiveKey : private active key of the witness account
  • interval : delay between each feed publishing.
  • peg : set to true only if you want to adjust your price feed bias.
  • peg_multi : if the peg is enabled, then this will change the "quote" to 1 / peg_multi, e.g. a peg_multi of 2 it will show a 100% bias on the feed.
  • rpc: Steem RPC nodes

The different exchanges can be set to true or false. Poloniex is set to false by default because of their constant wallet problems.

The script is set to publish the price feed every 6 hours by default which is very acceptable. I included a docker setup for easy deployment.

example.png

Source code at https://github.com/Jolly-Pirate/pricefeed

I hope you like it. Please report any bugs or if you have any improvement suggestions.


Available & Reliable. I am your Witness. I want to represent You.

🗳 If you like what I do, consider voting for me 🗳

Vote

If you never voted before, I wrote a detailed guide about Voting for Witnesses.

Go to https://steemit.com/~witnesses. My name is listed in the Top 50. Click once.

Alternatively you can vote via SteemConnect

https://v2.steemconnect.com/sign/account-witness-vote?witness=drakos&approve=1

H2
H3
H4
3 columns
2 columns
1 column
32 Comments
Ecency