How much are delegators earning on their investment in bid-bots? The Steem blockchain has most of the data needed to make the calculations so let’s follow the numbers!
But not so fast. First, we need some definitions and some code. Any Steem account can delegate its Steem Power to another one and undelegate anytime with no previous notice. The account that delegates is the delegator and the account that receives the delegated funds is the delegatee. There is no credit risk for the delegator as she does not depend on the delegatee’s actions to get her money (Steem Power) back. It takes 7 days to get the undelegated funds back in the delegator’s account so delegators have some incentive to not undelegate so often.
In this short-term credit market, the delegated funds are the bid-bot’s debt. It is common for bid-bots to pay interest on their debt every day. This reduces how much a delegator would not receive if a bid-bot were to default on its interest payments.
The query to get all delegations ever made to one bid-bot account (see previous posts to learn about getting and processing the Steem blockchain info) is:
bidbot <- 'your_favorite_bid_bot'
sqltxt <- paste("SELECT * FROM TxDelegateVestingShares WHERE delegatee IN ('",bidbot,"')",sep="")
delegations_to_bot <- data.table(dbGetQuery(conn, sqltxt))
-
To calculate the monthly end-of-period delegation balances for each delegator we use a procedure discussed in https://busy.org/@verodato/building-delegation-time-series. The next step is to estimate the interest payments to delegators. If the bid-bot sends transfers that are not interest payments to its delegators and does not label each type of transfer accordingly, we risk taking other expenses as interest payments. The list of all accounts that have delegated to the bid-bot is found by:
delegators <- unique(delegations_to_bot[,list(to=delegator)])
delegators[,isdelegator := 'yes']
-
To get all the transfers from the bid-bot account to other accounts we prepare the following query:
sqltxt <- paste("SELECT [from],[to],amount,amount_symbol,memo,timestamp,type FROM TxTransfers (NOLOCK) WHERE [from] IN ('",bot,"')",sep="")
transfers_out <- data.table(dbGetQuery(conn, sqltxt))
-
Merge the “delegators” table obtained above with the “transfers_out” table, so that we can check which transfers from the bid-bot were directed to the delegators' accounts:
setkey(transfers_out,to)
setkey(delegators,to)
transfers_out <- delegators[transfers_out]
transfers_out[,isdelegator := ifelse(is.na(isdelegator),'no',isdelegator)]
interest_payments <- transfers_out[isdelegator=='yes',list(int_usd=sum(usd)),by=list(delegator=to,year,month)]
-
Merge the "delegation_balances" table with the "interest_payments" table and find how the monthly interest payments are related to the monthly amounts delegated. The “mrr” column is the monthly rate of return on the investment on the bid-bot and the “arr” column shows the annualized rate of return:
setkey(delegation_balances,delegator,year,month)
setkey(interest_payments,delegator,year,month)
cash_flow <- merge(interest_payments,delegation_balances)
cash_flow_monthly <- cash_flow[delegation_usd > 0,list(interest_usd=round(sum(interest_usd)),delegation_usd=round(sum(delegation_usd))),keyby=list(year,month)]
cash_flow_monthly[,mrr := round(100*interest_usd/delegation_usd,4)]
cash_flow_monthly[,arr := round(100*(((1+(mrr/100))^12)-1),4)]
-
Now we need a bid-bot to test our code. At the moment of writing, the highest bid-bot vote value in the https://steembottracker.com page is the