create account

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

View this thread on: hive.blogpeakd.comecency.com
· @l0k1 ·
$0.38
A python script to show you the Median (current) discount on SBD conversion
<div class="pull-left"><h1>I</h1></div> <br />have been busy tinkering away in my secret lair and I have cooked up a python function that uses <code>requests</code> and <code>simplejson</code> 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 ] ) )

<div class="pull-right">😎</div><br /><hr />

<center><code>We can't code here! This is Whale country!</code></center>
<div class="pull-left"><a href="https://steemit.com/@l0k1"><img src="http://s20.postimg.org/igf27v79p/signature_new_small.png" /></a></div>

<h2>Vote #1 <code>l0k1</code></h2><sub>Go to <a href="https://steemit.com/~witnesses">steemit.com/~witnesses</a> to cast your vote by typing <code>l0k1</code> into the text entry at the bottom of the leaderboard.</sub>

<sub>(note, my username is spelled <code>El Zero Kay One</code> or <code>Lima Zero Kilo One</code>, all lower case)</sub>

</div>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 110 others
properties (23)
authorl0k1
permlinka-python-script-to-show-you-the-median-current-discount-on-sbd-conversion
categorysteem
json_metadata{"tags":["steem","python","coding","sbd"],"image":["http://s20.postimg.org/igf27v79p/signature_new_small.png"],"links":["https://steemit.com/@l0k1","https://steemit.com/~witnesses"],"app":"steemit/0.1","format":"markdown"}
created2017-03-08 14:18:45
last_update2017-03-08 14:18:45
depth0
children4
last_payout2017-04-08 16:20:27
cashout_time1969-12-31 23:59:59
total_payout_value0.349 HBD
curator_payout_value0.029 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length5,286
author_reputation94,800,257,230,993
root_title"A python script to show you the Median (current) discount on SBD conversion"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,673,006
net_rshares6,403,414,431,867
author_curate_reward""
vote details (174)
@justinashby ·
Thank you I will check it out! Let us know I am excited to see! :)
👍  
properties (23)
authorjustinashby
permlinkre-l0k1-a-python-script-to-show-you-the-median-current-discount-on-sbd-conversion-20170308t145722272z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-03-08 14:57:27
last_update2017-03-08 14:57:27
depth1
children3
last_payout2017-04-08 16:20:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length66
author_reputation12,650,430,770,044
root_title"A python script to show you the Median (current) discount on SBD conversion"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,673,245
net_rshares189,547,201,597
author_curate_reward""
vote details (1)
@l0k1 ·
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.
👍  ,
properties (23)
authorl0k1
permlinkre-justinashby-re-l0k1-a-python-script-to-show-you-the-median-current-discount-on-sbd-conversion-20170308t151048366z
categorysteem
json_metadata{"tags":["steem"],"users":["smooth"],"app":"steemit/0.1"}
created2017-03-08 15:10:48
last_update2017-03-08 15:10:48
depth2
children2
last_payout2017-04-08 16:20:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,585
author_reputation94,800,257,230,993
root_title"A python script to show you the Median (current) discount on SBD conversion"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,673,306
net_rshares112,447,307,444
author_curate_reward""
vote details (2)
@justinashby ·
Dannnggg... 3 blocks a day! ***Awesomesauce!***
    Stay strong, Keep Going!
👍  
properties (23)
authorjustinashby
permlinkre-l0k1-re-justinashby-re-l0k1-a-python-script-to-show-you-the-median-current-discount-on-sbd-conversion-20170308t164300485z
categorysteem
json_metadata{"tags":["steem"],"app":"steemit/0.1"}
created2017-03-08 16:43:03
last_update2017-03-08 16:43:03
depth3
children1
last_payout2017-04-08 16:20:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length76
author_reputation12,650,430,770,044
root_title"A python script to show you the Median (current) discount on SBD conversion"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id2,673,929
net_rshares189,547,201,597
author_curate_reward""
vote details (1)