Bitcoin Forum

Economy => Securities => Topic started by: Sukrim on June 05, 2012, 09:07:40 AM



Title: [GLBSE] Weighted average price for a 1 MH/s bond is below 30 bitcents
Post by: Sukrim on June 05, 2012, 09:07:40 AM
I wrote a script that does the following:

Take last trade price (as not all assets always have a 24h or 5d average price and spread between bids/asks is sometimes high), multiply by the amount of shares that were paid in the latest dividend payment and by the MH/s that the bond claims to pay out. Then calculate the average out of this.

Result (unordered):
Code:
YABMC GH/s: 47.278		market value (in BTC): 13705.8922	average value of 1 MH/s (in Satoshis): 28990000
PUREMINING GH/s: 10.0 market value (in BTC): 3900.0 average value of 1 MH/s (in Satoshis): 39000000
007 GH/s: 0.656 market value (in BTC): 189.584 average value of 1 MH/s (in Satoshis): 28900000
JAH GH/s: 2.5 market value (in BTC): 775.0 average value of 1 MH/s (in Satoshis): 31000000
TYGRR.BOND-A GH/s: 2.024 market value (in BTC): 586.96 average value of 1 MH/s (in Satoshis): 29000000
GIGAMINING GH/s: 100.0 market value (in BTC): 29687.5994 average value of 1 MH/s (in Satoshis): 29687599
ZETA-MINING GH/s: 7.0 market value (in BTC): 2029.99993 average value of 1 MH/s (in Satoshis): 28999999
BITBOND GH/s: 92.4 market value (in BTC): 26400.0 average value of 1 MH/s (in Satoshis): 28571428
total GH/s: 261.858 total volume (in BTC): 77275.03553 average value of 1 MH/s (in Satoshis): 29510282

Weighing the average above means for example, that the price of the 100 GH/s of gigamining have a much higher influence than the 2.5 GH/s of JAH

Some bonds haven't paid any dividends (or even shares - CANMINE...) yet, so it's impossible to see how many shares really have been distributed already there. These are excluded.
OBSI.1MHS is not part of this, as their payout formula is not comparable to real PPS shares.
For MOORE I'd need a bit of code still to calculate how many weeks have passed since they issued to get their current hash rate.

Mining "companies" are next on the list, they might require some different measurements though and some important numbers are not available on GLBSE, like how much the assets of the company are worth, how high their income/expenses are... so I likely can only compare dividend payouts.

This is fully automated, all you need to do is run the script again and (if a new mining bond shows up) eventually add a line with ticker symbol + hash rate per bond.



Title: Re: [GLBSE] Weighted average price for a 1 MH/s bond is below 30 bitcents
Post by: Sukrim on June 05, 2012, 09:19:34 AM
Forgot to include the script...

It uses eventlet (with 2 worker threads, until GLBSE gets more stable please don't push these to the limit!) and is written in an ugly style of Python2.

Code:
import json

import eventlet
from eventlet.green import urllib2

#List of all assets
#https://glbse.com/api/market/assets

#General data for each ticker symbol
#https://glbse.com/api/asset/TICKER

#Dividend data for each ticker symbol
#https://glbse.com/api/dividends/asset/TICKER

#Market depth for each ticker
#https://glbse.com/api/depth/TICKER

def fetchmarket(url):
  try:
    page = json.loads(fetch(url))
  except:
    page = {'t5dvol': 0, 'latest_trade': 0, 't24hvol': 0, 'min': 0, 'max': 0, 'bid': 0, 't5davg': 0, 'btc_vol_total': 0, 't7davg': 0, 'ask': 0, 't24havg': 0, 'quantity': 0}
    print "Error on " + url[28:] + " market data"
  return [page, url]

def fetchdividend(url):
  try:
    page = json.loads(fetch(url))
  except:
    page = []
    print "Error on " + url[38:] + " dividends"
  return [page, url]

def fetch(url):
  return urllib2.urlopen(url).read()

assetlist = json.loads(fetch("https://glbse.com/api/market/assets"))

marketdict = {}

dividendurls = []
marketurls = []

for asset in assetlist:
  dividendurls.append("https://glbse.com/api/dividends/asset/" + asset)
  marketurls.append("https://glbse.com/api/asset/" + asset)

pool = eventlet.GreenPool(size=2)
for asset in pool.imap(fetchdividend, dividendurls):
  dividends = asset[0]
  marketdict[asset[1][38:]] = {'dividends' : dividends}

for asset in pool.imap(fetchmarket, marketurls):
  ticker = asset[0]
  ticker['dividends'] = marketdict[asset[1][28:]]['dividends']
  marketdict[asset[1][28:]] = ticker
   

################################################################################
miningbonds = {'GIGAMINING':  5000000,
                  'BITBOND':  2100000,
               'PUREMINING':  1000000,
                    'YABMC':  1000000,
              'ZETA-MINING':  1000000,
                      'JAH':  1000000,
             'TYGRR.BOND-A':  1000000,
                'OBSI.1MHS':  1000000,
                      '007':  1000000,
                     'PIMP':  1000000,
                  'CANMINE': 40000000}

total_hashes = 0
total_value = 0

for asset in miningbonds.keys():
  if marketdict[asset]['dividends'] != [] and marketdict[asset]['latest_trade'] > 0:
    outstanding_shares = marketdict[asset]['dividends'][-1]['shares_paid']
    total_hashes += outstanding_shares * miningbonds[asset]
    latest_trade = marketdict[asset]['latest_trade']
    total_value += latest_trade * outstanding_shares
    print asset + ' GH/s: ' + str(outstanding_shares * miningbonds[asset] / 1000000000.0) + "\tmarket value (in BTC): " + str(latest_trade * outstanding_shares / 100000000.0) + "\taverage value of 1 MH/s (in Satoshis): " + str( (1000000 * latest_trade * outstanding_shares) / (outstanding_shares * miningbonds[asset]) )

print 'total GH/s: ' + str(total_hashes / 1000000000.0) + "\ttotal volume (in BTC): " + str(total_value / 100000000.0) + '\taverage value of 1 MH/s (in Satoshis): ' + str(1000000 * total_value / total_hashes)


Title: Re: [GLBSE] Weighted average price for a 1 MH/s bond is below 30 bitcents
Post by: EskimoBob on June 05, 2012, 04:00:43 PM
Thanx for the script.
Any plans to publish the results on a public web page?

It requires a Eventlet ibrary and this can be installed:
Code:
$ easy_install eventlet 

Here is the result:

Code:
Error on JLP market data
Error on ENJAN16 market data
Error on BM market data
Error on EN market data
Error on CRYPTOL market data
Error on BST market data
Error on CANMINE market data
Error on ANTI-PIRATE market data
Error on IMPACT market data
Error on HEDGE market data
Error on MINING market data
Error on USD market data
YABMC GH/s: 54.278      market value (in BTC): 14655.0605428    average value of 1 MH/s (in Satoshis): 27000001
PUREMINING GH/s: 10.0   market value (in BTC): 4418.0   average value of 1 MH/s (in Satoshis): 44180000
007 GH/s: 0.656 market value (in BTC): 190.24   average value of 1 MH/s (in Satoshis): 29000000
JAH GH/s: 2.5   market value (in BTC): 775.0    average value of 1 MH/s (in Satoshis): 31000000
TYGRR.BOND-A GH/s: 2.024        market value (in BTC): 546.48   average value of 1 MH/s (in Satoshis): 27000000
PIMP GH/s: 0.005        market value (in BTC): 1.25     average value of 1 MH/s (in Satoshis): 25000000
GIGAMINING GH/s: 100.0  market value (in BTC): 29596.0  average value of 1 MH/s (in Satoshis): 29596000
ZETA-MINING GH/s: 7.0   market value (in BTC): 1988.0   average value of 1 MH/s (in Satoshis): 28400000
BITBOND GH/s: 92.4      market value (in BTC): 26620.0  average value of 1 MH/s (in Satoshis): 28809523
total GH/s: 268.863     total volume (in BTC): 78790.0305428    average value of 1 MH/s (in Satoshis): 29304898

I have a feature request too :)

1) Format output to a "table" with a header row
Code:
SYMBOL	  GH/s	market cap BTC	1 MH/s in BTC 
YABMC 54.278 14655.0605428 0.27000001
Code:
SYMBOL;GH/s;market cap BTC;1 MH/s in BTC 
YABMC;54.278;14655.0605428;0.27000001



2) Sort result by "1 MH/s in BTC" (or make it configurable?)

Cheers!


Title: Re: [GLBSE] Weighted average price for a 1 MH/s bond is below 30 bitcents
Post by: Sukrim on June 05, 2012, 06:02:04 PM
Thanx for the script.
Any plans to publish the results on a public web page?
Glad it's of some use. Unfortunately I don't own any web server and I dont plan on renting and paying for one, so if someone wants to host an online version of this - go ahead! I probably won't do it myself, as I doubt the costs would be paid by donations.

I have a feature request too :)

1) Format output to a "table" with a header row
Code:
SYMBOL	  GH/s	market cap BTC	1 MH/s in BTC 
YABMC 54.278 14655.0605428 0.27000001
Code:
SYMBOL;GH/s;market cap BTC;1 MH/s in BTC 
YABMC;54.278;14655.0605428;0.27000001

2) Sort result by "1 MH/s in BTC" (or make it configurable?)
1) Should be easy as it's only formatting (I have to look into some nicer options than hardcoding tabs in there)

2) Would be a tiny bit harder, but I really don't see a benefit as there are less than 10 bonds anyways and the number I personally was looking for was anyways the big average over all bonds in total (which oscillates between ~29 and ~29.5 bitcents atm.). Also it's relatively easy to come up with that number by just looking at trade prices and dividing by hash rate in a google spreadsheet. It's just a bit hard to import JSON there, otherwise I'd already done it there.


Title: Re: [GLBSE] Weighted average price for a 1 MH/s bond is below 30 bitcents
Post by: PatrickHarnett on June 06, 2012, 04:56:33 AM
Interesting and a subject dear to my heart.  Probably the prices should be below 30 bitcents as we have moved away from the stable $5 prices.


Title: Re: [GLBSE] Weighted average price for a 1 MH/s bond is below 30 bitcents
Post by: BinaryMage on June 06, 2012, 05:00:15 AM
Interesting and a subject dear to my heart.  Probably the prices should be below 30 bitcents as we have moved away from the stable $5 prices.

And about time. I was getting rather bored with all the stagnancy. Need some high derivatives of the price graph to liven up my day.


Title: Re: [GLBSE] Weighted average price for a 1 MH/s bond is below 30 bitcents
Post by: FreeMoney on June 06, 2012, 05:55:17 PM
Interesting and a subject dear to my heart.  Probably the prices should be below 30 bitcents as we have moved away from the stable $5 prices.

All that matters is difficulty.

If BTC price goes up then the output of a mining stock is worth more, it cancels.


Title: Re: [GLBSE] Weighted average price for a 1 MH/s bond is below 30 bitcents
Post by: area on June 06, 2012, 08:29:37 PM
Interesting and a subject dear to my heart.  Probably the prices should be below 30 bitcents as we have moved away from the stable $5 prices.

All that matters is difficulty.

If BTC price goes up then the output of a mining stock is worth more, it cancels.

But the value (in BTC) of the bond you are holding goes down, which may concern some people.


Title: Re: [GLBSE] Weighted average price for a 1 MH/s bond is below 30 bitcents
Post by: BinaryMage on June 07, 2012, 12:26:54 AM
Interesting and a subject dear to my heart.  Probably the prices should be below 30 bitcents as we have moved away from the stable $5 prices.

All that matters is difficulty.

If BTC price goes up then the output of a mining stock is worth more, it cancels.

Yes, but the price you would pay for equivalent mining hardware (in BTC) goes down, devaluing the bond in a certain sense.


Title: Re: [GLBSE] Weighted average price for a 1 MH/s bond is below 30 bitcents
Post by: DiabloD3 on June 07, 2012, 07:24:02 AM
Since we're posting tables of information: http://caspar.adterrasperaspera.com/dmc/trade/