This is a python version of the price feed publishing tool from rexthetech's respectively justyy's javascript version.
This version is especially intended for witnesses who already use steem-python and do not want to enter their private key in config.json. With the wallet tool steempy the keys can be used in such a way that they do not have to be stored locally in plain text. For configuration of steempy look at this tutorial.
Python and steem-python must be installed on the system.
Clone the project repo into the "pricefeed" directory and set permissions to run the script for all users:
$ git clone https://github.com/only-dev-time/python-pricefeed pricefeed
$ cd pricefeed
$ chmod a+x feed.py pricefeed_start.sh
Update the config.json file with your witness account name and private active key as described in the Configuration section below. Alternative, you can set account and private key in environment variables or you can use steempy.
I suggest using then crontab to manage and run your python pricefeed in the background. Use the following command to install the cron job for running the pricefeed program:
$ crontab -e
Add the following line to the end of existing entries:
46 3,15 * * * ~/pricefeed/pricefeed_start.sh &
Maybe you have to change the path. Save the file with Ctrl+X
(if you use the nano editor). Now the script will start at 3:46 am/pm every day. In that case, the script should be configured that the internal loop only runs once. For this, set the field "interval": 0
in config.json (see below).
You can also start the program once and then let the internal loop run continuously. For this, set "interval"
in config.json with the delay time in minutes (see below).
Start the program with following bash command:
$ sh pricefeed_start.sh
If everything worked you should not see any errors in the logs and a price feed transaction should have been published to your account.
List of STEEM RPC nodes to use and other settings:
{
"rpc_nodes": [
"https://api.steemit.com",
"https://steemapi.boylikegirl.club",
"https://api.steemzzang.com",
"https://steem.ecosynthesizer.com",
"https://api.wherein.io",
"https://api.dlike.io",
"https://api.steem-fanbase.com",
"https://api.steemitdev.com",
"https://api.justyy.com"
],
"feed_steem_account": "", // Name of your Steem witness account - if left empty, then should be set in env.
"feed_steem_active_key": "", // Private active key of your Steem witness account - if left empty, then should be set in env or in steempy
"coinmarketcap_api_key": "", // API key for CoinMarketCap; required if using "coinmarketcap" in exchange list below. Set in env if empty.
"exchanges": ["cloudflare", "coingecko", "cryptocompare", "coinmarketcap"], // List of exchanges to use. Will publish an average of all exchanges in the list.
"interval": 60, // Number of minutes between feed publishes
"feed_publish_interval": 30, // Feed published after 30 seconds of price feed - not necessary in python
"feed_publish_fail_retry": 5, // RPC node fail over to next after 5 retries - not necessary in python
"price_feed_max_retry": 5, // Max retry for Price Feed API
"retry_interval": 10, // Retry interval 10 seconds
"peg_multi": 1 // Feed bias setting, quote will be set to 1 / peg_multi
}