As a series of Steem-Python scripts I have been sharing, today I wanted to show you the code of a bot that gets the latest price of Bitcoin, Steem and Steem Dollar from the Poloniex API and creates a post on Steemit.
To start, create the python file:
sudo nano price_bot.py
Then paste this code inside (make sure to put your posting key and user in the required fields):
from steem import Steem
import urllib.request
import json
url = urllib.request.urlopen('https://poloniex.com/public?command=returnTicker')
result = url.read()
resultj = json.loads(result)
BTC = resultj['USDT_BTC']['last']
BTC = float(BTC)
BTC = round(BTC, 2)
STEEM = resultj['BTC_STEEM']['last']
STEEM = float(STEEM) * float(BTC)
STEEM = round(STEEM, 2)
SBD = resultj['BTC_SBD']['last']
SBD = float(SBD) * float(BTC)
SBD = round(SBD, 2)
print ("posting prices...")
s = Steem(keys=["YOUR POSTING KEY"])
s.commit.post(
"Todays Daily Market: STEEM @ {} ...".format(STEEM),
"**Bitcoin:** {} USD".format(BTC) + "<br>**Steem:** {}".format(STEEM) + "<br>**Steem Dollars:** {}<br>".format(SBD) + "<br>*This is an automated msg posted by the [price_bot.py](https://github.com/PixelNoob/python-steem)*" ,
"YOUR ACCOUNT",
tags=["bitcoin","steem", "trade"]
)
print ("prices posted succesfully")
To run the the script just type:
python3 bot_price.py
The end result should look like this:
You could also create a crontab job to run this script daily and get a daily price update on your feed.
Let me know what you think and make sure the check out my other scripts here:
Is poloniex STEEM wallet still under 'maintanance"? Thanks for sharing the knowledge, @tipu send tip:)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I am not sure, I have been using binance for a while now.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
You got a 45.83% upvote from @dailyupvotes courtesy of @hcf27!
Please upvote this comment to support the service.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you for sharing,, good post I like it
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Wonderful post ..thanks for sharing...Best of luck friend ✫
this is the best bot for steembottracker clik here https://steemit.com/bots/@hassanbenali/the-best-bot-for-service-how-to-create-steem-bot-tracker
Transfer 0.200 SBD or 0.250 steem to @mrbean1 and put the link of your post in the public memo you get 5 good UPVOT and resteem by @mrbean1 +followers
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hi @chitty! You have received 0.3 SBD tip from @cardboard!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
it's really valuable information for us . Thanks a lot for sharing this post . I'm waiting for your next post .
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit