Scripts for Steem Bot Delegators Part 1

in #steemit7 years ago

You have probably heard there are plenty of bots on Steemit. most of them give you upvote in return for payment in ether STEEM or SBD. Most bots rent their Steem Power (SP) from service like @minnowbooster or they get SP from users who delegate power to them. in return these users get paid for renting their SP. I wrote about delegating SP to bot called @boomerang in previous article https://steemit.com/steemit/@jaka87/best-way-to-earn-steem-by-delegating-sp.
Due to Steem and SBD price increase gain is quite nice these days. For around 2400 SP i get about 20$ worth per day. Not bad right for 2000$ investment right.

programming.jpg
Now what you can do as SP delegator is make your life even easier and create some script to do some work for you. In this series of post I will explain how you can for example transfer all you gains from SBD to STEEM, how to transfer STEEM to SP and how to increase your delegation to bot automatically by using scripts.

It this post I will explain my script to transfer SBD that I get from @boomerang to STEEM. It written in python and require steem for python. If you don't have it you can install it by using command pip install -U steem.

import datetime
import time
import os
from steem import Steem
from steem.commit import Commit
from steem.account import Account
from steem.transactionbuilder import TransactionBuilder
from steembase import operations

from datetime import datetime, timedelta
cas = datetime.utcnow() + timedelta(hours=2)  #check what is the time and ads two hours for when to cancel market order if not executed
cas2=format(cas, '%Y-%m-%dT%H:%M:%S')

s = Steem(keys=["YOUR WIF"])
username = 'YOUR USERNAME'

account = Account(username,s)
balance = account.balances
my_steem= balance['available']['SBD']

if my_steem > 0:    #checks your balance, if there is dome SBD on you account if will be changed to STEEM
    order=s.get_order_book(limit=3)
    last= order['bids'][1]['real_price'] #second bid order from market

    get_steem=str( format(float(my_steem)/float(last)+0.001, '.3f')) #calculation for how much STEEM you should get for your SBD. +0.001 coul'd be changed

    print (last)

    limit_order_create = operations.LimitOrderCreate(
        owner=username,
        orderid=0,
        amount_to_sell=str(my_steem)+" SBD",
        min_to_receive=get_steem+" STEEM",
        fill_or_kill=False,
        expiration=cas2,
    )

    tb = TransactionBuilder() #transaction gets build and send
    tb.appendOps([limit_order_create,])
    tb.appendSigner(username, "active")
    tb.sign()
    resp = tb.broadcast()
    print ('order for: '+get_steem)

Then you can use cron job to execute this script every 2-3 hours and that's it.

Sort:  

This post has received a 1.76 % upvote from @booster thanks to: @jaka87.

This post has received a 4.28 % upvote from @aksdwi thanks to: @jaka87.

This post has received a 1.42 % upvote from @boomerang thanks to: @jaka87

You got a 0.44% upvote from @upme requested by: @jaka87.
Send at least 2.5 SBD to @upme with a post link in the memo field to receive upvote next round.
To support our activity, please vote for my master @suggeelson, as a STEEM Witness

Coin Marketplace

STEEM 0.24
TRX 0.21
JST 0.036
BTC 97907.48
ETH 3354.28
USDT 1.00
SBD 3.35