A python script to show you the Median (current) discount on SBD conversion

in #steem7 years ago

I


have been busy tinkering away in my secret lair and I have cooked up a python function that uses requests and simplejson to generate a list of the current interest rates set by the *active* witnesses. You need python3, and install these two libraries, and you too can run this (windows, mac, linux with these installed).

The output it produces marks the current median discount set by the active witnesses with the label 'MEDIAN'. You can see above and below it if there is a group of numbers how man people have to set a price and which side of the current price in order to shift the current median. This value is calculated by 3.5 days of previous values set by witnesses to generate the network consensus Conversion rate which lets you 'burn' SBD and get the backing as payment - the Steem.

According to the current state there is 68 active Witnesses and the nearest different numbers from the group of zeros at the median currently, is -1% (premium of 1%), two positions above the median (there is a pair, 34 and 35). The market price of SBD has dropped below one but now you can convert your Steem to the current SBD price (about $0.9882 presently). This is near zero loss, meaning if lots of people do this we will squeeze the SBD supply and drive the price up at the exchanges, where they will sell them, and we can buy them and convert them.

If a lot of people do this, the price of SBD will also go up, acting as an effective further discount, though be aware this also will (slightly) increase the Steem supply. You can either cycle it back through to buy more SBD on the internal market or from an exchange, or you can convert it into Steem Power - if the discount and the price go the way I predict they will when people do this, then you will likely recover some of the account value you have been losing due to the declining price, and I recommend to power this profit up, to help drive the price of Steem up, and also win more influence on the forum... Or just gloat over it. That always works.

...at least while this outbreak of common sense about conversion rates being zero or higher discount continues...

I think that the discount should probably be always as much above the dollar as it ever falls below it. SBD has a use that is not really there yet, which is stable settlements for businesses who pay suppliers in USD. This is why there really can be a lot of it converted back to Steem without doing any harm to us, and possibly taking the brakes off Steem's price.

I encourage anyone who wants to play a part in killing the SBD debt load on Steem, check up what I am saying about before you do anything. I will also be converting the script below into the generator for a webpage shortly so anyone can see the current state of it (mainly this is for witnesses but if you want to burn SBD by converting them not at a premium you should make sure the median is hanging around zero or above).

#!/usr/bin/python3
from pprint import pprint
import requests
import simplejson as json

r = requests.post ( 'https://node.steem.ws', data = '{"id":8,"method":"get_witnesses_by_vote","params":["","100"]}' )

jsonresult = json.loads ( r.text )
counter = 0
outarray = []
for i in jsonresult['result']:
  if ( not i['signing_key'] == 'STM1111111111111111111111111111111114T1Anm' ): 
    counter += 1
    owner = i['owner']
    sbd_rate = i['props']['sbd_interest_rate'] / 100
    sbd_base = float ( i['sbd_exchange_rate']['base'][0:5] ) 
    sbd_quote = ( 1.0 - float ( i['sbd_exchange_rate']['quote'][0:5] ) ) * 100.0
    outarray.append ( [ counter, owner, sbd_base, sbd_quote, sbd_rate ] )

byrate = sorted ( outarray, key = lambda outarray: outarray [ 3 ] ) 

active_witnesses = len ( outarray )
print ( str ( active_witnesses ) + ' active witnesses' )

split = not active_witnesses % 2

if ( split ):
  median = [ int ( active_witnesses / 2 ) , int ( active_witnesses / 2 + 1 ) ] 
  medianiter = range ( median [ 0 ] - 10, median [ 1 ] + 10 )
else:
  median = [ int ( active_witnesses / 2 + 0.5 ) , ]
for i in range ( 0, active_witnesses ) :
  if ( split ):
    if ( i == median [ 0 ] or i == median [ 1 ] ):
      print ( "{:4.1f}".format ( byrate [ i ] [ 3 ] ) + 
        " MEDIAN" )
    else:
      print ( "{:4.1f}".format ( byrate [ i ] [ 3 ] ) )
  else:
    if ( i == median [ 0 ] ):
      print ( "{:4.1f}".format ( byrate [ i ] [ 3 ] ) + " MEDIAN")
    else:
      print ( "{:4.1f}".format ( byrate [ i ] [ 3 ] ) )
😎


We can't code here! This is Whale country!

Vote #1 l0k1

Go to steemit.com/~witnesses to cast your vote by typing l0k1 into the text entry at the bottom of the leaderboard.

(note, my username is spelled El Zero Kay One or Lima Zero Kilo One, all lower case)

Sort:  

Thank you I will check it out! Let us know I am excited to see! :)

I have to downgrade my witness first (the HF is coming up soon and at present there is a bug in `v0.17.0rc1', the version the Git gives you if you just build it without checking out... Well, @smooth said it was currently broken and at the HF will break so I guess maybe it will be delayed and I want to make sure I keep my node up (it's making 3 blocks a day now! Thanks to my loyal voters).

But I will be making it into a webpage after I have finished the downgrade, the idea is an information source for Witnesses deciding their discount, as well as for aspiring Debt Reduction activists (like myself) to see what the discount is around. I think there is a way for me to get the calculated current value of what conversions go for today, that were set 3.5 days ago, but I may create a little monitor that checks for updates to the feeds and calculates the moving average so it can be better visualised.

If there is a discount on SBD to convert it, it is the right time to convert it. If not, don't do conversions. Hopefully by showing the mechanics of the network consensus process people can more actively participate in keeping this parameter of the network in the ideal range (I think 0-1% discount) so that conversion is never a cost to the converter. This allows us to cut back debt and will either vindicate or contradict the claims of the 'debt drives Steem price down' crowd (of which I am a member).

So I will be returning to my webpage development and add this information display to it later tonight or tomorrow morning and you can just click a link to see the data.

Dannnggg... 3 blocks a day! Awesomesauce!
Stay strong, Keep Going!

Voted 4 you as a witness.

Coin Marketplace

STEEM 0.19
TRX 0.16
JST 0.032
BTC 64166.71
ETH 2765.60
USDT 1.00
SBD 2.72