Bitcoin Forum

Economy => Securities => Topic started by: Sp0tter on June 26, 2012, 02:18:48 AM



Title: [GLBSE] API Frontend to keep track of assets and returns.
Post by: Sp0tter on June 26, 2012, 02:18:48 AM
I created a front-end script to access the GLBSE  api and display helpful information about assets and return on investments.  I hope you find it useful.  

Please report any bugs or feature requests here.


md5sum
source488b8027b4b7287cb2f9e262bb9464b9
assets_2012-07-03_1341340694.tar.gz (http://96.8.122.121/assets/assets_2012-07-03_1341340694.tar.gz)



Instructions
1. Extract to a public html folder.
2. Edit the sample_key file and move it to a non-public folder.
3. Edit $key_file in assets.php to point to the key file.
4. Download/Copy your account_history.csv from GLBSE to the same folder as assets.php.  Update this file when you trade assets or receive dividends.  (Currently there is not a simple way through the private API to check dividends, therefore you must fetch the csv manually.  I have contacted support and it is on their todo list.)

If you do not have a web server set up, you can just run 'php assets.php > assets.html' in linux and then point your web browser to the html file.

Known Issues
1. Warning / Notice output will display if your web server is set to display all of these.  Will fix these.
2.  Currently per/share dividends are only reported correctly for assets which are paid weekly.  (This does not affect cumulative dividends, but only the return on investment estimates).
3.  Occasionally there will be a timeout because of how slowly glbse.com responds.

Please post feedback here or talk to me in #btcguild on irc.

Warning... use at your own risk... (it can't be riskier than 7% interest bonds though right?)  Please check the script and make sure there is nothing shady in there before using.  I do my best to test everything, but will not be responsible for any losses due to the use of this script.


Title: Re: [GLBSE] API Frontend to keep track of assets and returns.
Post by: Sp0tter on June 26, 2012, 02:20:26 AM
reserved


Title: Re: [GLBSE] API Frontend to keep track of assets and returns.
Post by: exahash on June 26, 2012, 03:05:02 AM
Thanks Sp0tter!  I made a cl script to do some of this, I like yours better tho.

I see you're doubling the div/day of YABMC... can you instead grab the last two dividends and divide by the actual number of days between them?  I suspect there may be more tickers with irregular (or non-weekly) dividends, such that always dividing by 7 and having to special-case them could be too much work.

FWIW - I see nothing shady in there. :-)


Title: Re: [GLBSE] API Frontend to keep track of assets and returns.
Post by: Sp0tter on June 26, 2012, 03:14:33 AM
Thanks Sp0tter!  I made a cl script to do some of this, I like yours better tho.

I see you're doubling the div/day of YABMC... can you instead grab the last two dividends and divide by the actual number of days between them?  I suspect there may be more tickers with irregular (or non-weekly) dividends, such that always dividing by 7 and having to special-case them could be too much work.

FWIW - I see nothing shady in there. :-)


I have devoted attention so far to the assets that I actually have.  I will try to cover as manay as possible as time goes on.

Eventually I plan to make a separate data file that lists each asset and describes it's type and payout scheme.  For the mh/s bonds, I will calculate the current PPS and use what it "should be" for the dividend estimation.

Thanks for checking over the script and verifying it for others.  This is my first time using php, I do most of my life in c++, and most of my scripting in perl...  it's not so bad... php makes me feel like a really smart ...11 year old boy.   I appreciate the feedback.    :)



Title: Re: [GLBSE] API Frontend to keep track of assets and returns.
Post by: Sukrim on June 26, 2012, 07:21:09 AM
I'd love to see how much I've bought my shares for and for how much I already sold them + dividends gained - fees paid.

Also, why PHP in the first place?


Title: Re: [GLBSE] API Frontend to keep track of assets and returns.
Post by: Sp0tter on June 26, 2012, 07:23:29 AM
I'd love to see how much I've bought my shares for and for how much I already sold them + dividends gained - fees paid.

Also, why PHP in the first place?

Just for shits and giggles.  I wanted to do some php....  I wanted reports on my GLBSE.. bam!


Edit:
The avg cost is the average cost that you paid.. and that is all bought - all sold / count.


Title: Re: [GLBSE] API Frontend to keep track of assets and returns.
Post by: Nachtwind on June 26, 2012, 08:18:03 AM
Useful little script :0)

I think this will be something to keep an eye on!


Title: Re: [GLBSE] API Frontend to keep track of assets and returns.
Post by: zerokwel on June 26, 2012, 02:51:22 PM
I do use it. Its nice for me to see how much I am making or loosing a week :).

I am going to toss sp0tter a share for his work (now what do I have that's cheap)



Title: Re: [GLBSE] API Frontend to keep track of assets and returns.
Post by: Sp0tter on June 27, 2012, 06:56:49 AM
The numbers for all weekly dividend assets and all summary items should be correct now.  Several bugs have been fixed.  This should be ready to go :)  Please report any bugs or feature requests here.

final = balance + total_sells + total_withdrawals - total_deposits - fees_to_sell


Title: Re: [GLBSE] API Frontend to keep track of assets and returns.
Post by: ianspain on June 27, 2012, 07:45:41 PM
sub


Title: Re: [GLBSE] API Frontend to keep track of assets and returns.
Post by: Sp0tter on June 27, 2012, 10:25:08 PM
Update:  Moved all rounding to right before display so it does not affect other calcuations.  Cleaned up presentation.  Added 'price gap' column.


Title: Re: [GLBSE] API Frontend to keep track of assets and returns.
Post by: vokain on July 03, 2012, 03:30:15 PM
looks very useful! unfortunately i can't download the archive to test it out :(


Title: Re: [GLBSE] API Frontend to keep track of assets and returns.
Post by: Sp0tter on July 03, 2012, 06:39:13 PM
looks very useful! unfortunately i can't download the archive to test it out :(

Sorry, my vps was down.   It is back up now with the newest version :)


Title: Re: [GLBSE] API Frontend to keep track of assets and returns.
Post by: Sp0tter on August 29, 2012, 05:22:39 AM
Will resume improving this now that pirate is a bust :)