My Python3 Project

in python3project •  7 years ago 

Ahh, Sunday.

I have always enjoyed Sundays, they serve as the final respite of the week before starting anew on Monday. It of course would be nice if there were one more day before Monday. It's interesting because while being a weekend day, you can't really do all that much because you are preparing for Monday; no late night drinking, no going to the casino, etc.

With my Sunday, I am working on a small pet project of mine. I wanted to create a program which would pull the current STEEM/SBD information from Coinmarketcap.com and calculate if your SBD sent to a bid bot for an upvote was profitable or not, including curation fees.

Here is what I have so far:

##############################################################################
# This simple program helps to determine the profit/loss in USD/SBD/STEEM on a
# purchased vote from a voting bot on the STEEM blockchain.
#
##############################################################################


from coinmarketcap import Market

coinmarketcap = Market()

# Pull current price info from coimarketcap.com and save it as floats.
steem_info = coinmarketcap.ticker('STEEM', convert='USD')
sbd_info = coinmarketcap.ticker('steem-dollars', convert='USD')
steem_price_usd = float(steem_info[0]['price_usd'])
sbd_price_usd = float(sbd_info[0]['price_usd'])

#print(steem_price_usd)
#print(sbd_price_usd)


# Take input from user and convert into floats.
input_arg_one = input("Please enter the amount of SBD sent: ")
input_arg_two = input("Please enter the value of the received vote: ")
sbd_sent = float(input_arg_one)
bot_vote_val = float(input_arg_two)


# Calculate profit/loss and output in USD/SBD/STEEM.
sbd_rec = bot_vote_val * .5
steem_rec = (bot_vote_val * .5) / steem_price_usd

sbd_rec_25 = sbd_rec * .75
steem_rec_25 = steem_rec * .75

profit_usd = (sbd_rec_25 * sbd_price_usd + steem_rec_25 * steem_price_usd) - (sbd_sent * sbd_price_usd)

print('')
print('Amount of SBD you will receive including 25% curation fee: ', sbd_rec_25)
print('Amount STEEM you will receive including 25% curation fee: ', steem_rec_25)
print('Actual profit/loss in USD: ', profit_usd)

.
.
.

It seems this project is easy and hard at the same time. The Coinmarketcap Python API is fantastic, it is incredibly easy to use and after installing it with pip, I was up and running in about 10 minutes. However, I haven't been able to get the steem-python library working. I know it is a work in progress but it has been a real pain getting it installed. Another issue I am running into, is I cannot find the actual formulas for curation, up-voting, etc. I have a general understanding of how these work based off articles others have written, but I am very far away from finding the actual formulas so they could be included in a program.

We'll see how it comes along. At the very least, I have what I am dubbing the "WHAT IF..." calculator working. It gives a rough estimate based on the current price of SBD/STEEM on the expected profit/loss including curation fees.

Cheers

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

hi bro. why u bid 40SBD in last mins. it is dangerous to lost share of vote. don't do it again.

Bot tracker said bot is still good to send 55 so I sent 40

we end lost of SBD that we sent.

we lost 9.53% in last roundsmartsteem lost.PNG

Ahh, well darn.