Repository
https://github.com/coingecko/steemprice-feed
Steem-Price-Feed (spf)
Steem price feed is a tool for witness for pulling price data from CoinGecko.com and publish the price feed. It used CoinGecko WebSocket for real time steem price and also REST API method as a fallback.
We recently launched our witness and we realize that most of the price feed tools are cron job written to check the price; therefore, we decided to write this script with our web socket, which means it will update price accurately instead of a cron job. The script will restart automatically on failure with docker or pm2.
Features
- Using CoinGecko websocket to update Steem price feed on the fly.
- In case websocket disconnected use CoinGecko REST API ``/simple/price` endpoint to update price and restart websocket.
- Using Docker or PM2 approach to respawn the script on error.
- Testing and CI to make sure that the code can be run on Node v8+.
- Customizable env file for setting up websocket, price time out, and sensitivity.
- SENSITIVITY allow price update only when the last update price change.
Technology Stack
- Node.js
- TypeScript
- Docker
- Jest (for testing)
- DSteem
RoadMap
- Fallback to Exchange data source.
- Handle error properly.
How to use?
Prerequisite
- Node.js (v8+)
- Makefile installed (optional)
- Docker (optional)
General step
- git clone this repo
git clone git@github.com:coingecko/steemprice-feed.git
cd steemprice-feed
- edit .env.sample to .env (
cp .env.sample .env
thennano .env
orvi .env
)
ACTIVEKEY= # Steem Active Key (String)
WITNESS= # Steem Witness Username (String)
PEGMULTI=1 # Peg Multiple settings (Number) [default: 1]
WEBSOCKETTIMEOUT=10 # Time out in minutes for checking web socket (Number) [default: 10]
PRICETIMEOUT=5 # Time out in minutes for last price check (Number) [default: 5]
SENSITIVITY=0.001 # Sensitivity for the price update. (Float) [default: 0.001]
Docker
- Make sure docker is installed. Installation guide
docker-compose build # Build the docker image
docker-compose up -d # Run the docker
docker-compose logs # to see log message
docker-compose logs --tail="all" # To see all logs
docker-compose down # To shut down docker
Without Docker (PM2)
- Make sure Makefile are installed. Read
Makefile
for the full command being used. - run
make init
to install pm2 (skip this step if you already install pm2, and runnpm install
) - run
make start
(start the tool with pm2)
There is other command available as well:
- To stop the price feed update, run
make stop
- To delete existing process running run
make delete
- To check log message, run
make log
- To check log message (last 1000), run
make log-1000
Done!
You can check the log for more details. (either make log
or docker-compose logs
)
Contributing
This project is license with MIT, anyone can contribute and file bugs report at https://github.com/coingecko/steemprice-feed.
We had intergrated test and CI, therefore contributors need to make sure that the code are able to pass CI.
As @coingecko set out to be a Witness on Steem, we know that one of our offering is to utilize our expertise and infrastructure to make Steem Price Feed publishing easier for witnesses.
We look forward to contributing more to the Steem Community as well as Open Source. If you like what we're doing, we hope you can consider voting CoinGecko.com as Witness.
Looks great @coingecko!
It seems like you're doing frequent updates every time the price is changed. This looks like a little bit overkill since the markets are not that volatile.
Blockchain uses these publish_feed transactions by getting a median in 3.5 days. So, broadcasting a 0.001 change in the price with 2 minute intervals doesn't change much in the practice.
For example, let's check these updates:
You have almost broadcasted the same price four times in seven minutes.
Also, since witnesses use these tools on the servers, it's always a better practice to use signing key to broadcast prices. (It's possible after HF20) Which is more secure in comparison storing an active key.
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Chat with us on Discord.
[utopian-moderator]
We are currently running older version of the script, the new version added SENSITIVITY
SENSITIVITY=0.000 # Sensitivity for the price update. (Float) [default: 0.000]
which will only update price when it passes a certain threshold
to solve this issue, will update the script once the holiday is over.
true, will take note of that on the next version.
Thank you for your review, @emrebeyler! Keep up the good work!
Dear @coingecko
I was wondering if I could reach out to you via telegram?
I just realized a moment ago that you guys trying to become a witness. Perhaps I could help. Do you telegram? Hope we could get in touch closer and find a way to collaborate.
Yours
Piotr
Hi,
feel free to contact us directly via hello@coingecko.com
You can also join our Telegram group or Discord server too!
Your pricefeed is updating way too often, almost spammy. In general, set your pricefeed at least once per 24h. I recommend every 6h.
Yes I like well done you are doing best of luck thanks for updating coingecko
Dear brother @coingecko
I appreciate you and your team's contribution for steem community . I have already voted coingecko as witness.
Hi friends @coingecko I wish you all the best.
I appreciate your job.
I like it.
Thanks for update.👍
Posted using Partiko Android
Thanks for using eSteem!
Your post has been voted as a part of eSteem encouragement program. Keep up the good work! Install Android, iOS Mobile app or Windows, Mac, Linux Surfer app, if you haven't already!
Learn more: https://esteem.app
Join our discord: https://discord.gg/8eHupPq
Keep up the Good work @coingecko .
We are here for you.
Much love for your efforts.
@coingecko Love your guys effort and teamwork - already voted you as one of my witnesses :)
Happy CNY to you guys and gals!
Hi @coingecko!
Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server
This post has been included in the latest edition of SoS Daily News - a digest of all you need to know about the State of Steem.
I think what you have created is a wonderful tool. However, you are still using HitBTC price feed which can swing wildly for the simple fact that they stopped supporting STEEM and SBD a year ago. I don't think that it is safe to use your tool until you put serious exclusions into place. I recall at one time that STEEM on that exchange hit $150... Your tool can really mess things up. They are also doing some really crooked things. Even though HitBTC has stolen the user STEEM and SBD by keeping their customer's STEEM and SBD, they also moved 10017.019 STEEM to Blocktrades 6 months ago. That STEEM was customer's currency. https://steemit.com/@hitbtc-exchange/transfers
Congratulations @coingecko! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word
STOP
Great stuff, keep up the good work!
Hey, @coingecko!
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!
Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!