Bitcoin Forum
April 25, 2024, 06:58:05 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  

Warning: Moderators do not remove likely scams. You must use your own brain: caveat emptor. Watch out for Ponzi schemes. Do not invest more than you can afford to lose.

Pages: [1] 2 »  All
  Print  
Author Topic: GLBSE CSV -> profit & loss calculator?  (Read 3393 times)
jackmaninov (OP)
Full Member
***
Offline Offline

Activity: 139
Merit: 100


View Profile
May 19, 2012, 01:24:20 AM
 #1

So I can download my GLBSE account history as a CSV file now. Who's going to be the first out the gate with a web app to track P&L?

Even cooler if we could get this through the GLBSE API...
1714071485
Hero Member
*
Offline Offline

Posts: 1714071485

View Profile Personal Message (Offline)

Ignore
1714071485
Reply with quote  #2

1714071485
Report to moderator
1714071485
Hero Member
*
Offline Offline

Posts: 1714071485

View Profile Personal Message (Offline)

Ignore
1714071485
Reply with quote  #2

1714071485
Report to moderator
"In a nutshell, the network works like a distributed timestamp server, stamping the first transaction to spend a coin. It takes advantage of the nature of information being easy to spread but hard to stifle." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714071485
Hero Member
*
Offline Offline

Posts: 1714071485

View Profile Personal Message (Offline)

Ignore
1714071485
Reply with quote  #2

1714071485
Report to moderator
1714071485
Hero Member
*
Offline Offline

Posts: 1714071485

View Profile Personal Message (Offline)

Ignore
1714071485
Reply with quote  #2

1714071485
Report to moderator
Sukrim
Legendary
*
Offline Offline

Activity: 2618
Merit: 1006


View Profile
May 19, 2012, 08:08:50 AM
 #2

Web app would be a bit weird (I personally won't upload any csv to a website with a list of addresses + trades...)

It would be cool to do a public spreadsheet template though for example.

https://www.coinlend.org <-- automated lending at various exchanges.
https://www.bitfinex.com <-- Trade BTC for other currencies and vice versa.
Sukrim
Legendary
*
Offline Offline

Activity: 2618
Merit: 1006


View Profile
May 19, 2012, 11:26:08 AM
 #3

Would be cool if we could access the CSV via the API (though that would mean we'd save our private API key on google servers for the requests...) - then it would be possible to directly import the CSV in google docs (there's a native function for that).

https://www.coinlend.org <-- automated lending at various exchanges.
https://www.bitfinex.com <-- Trade BTC for other currencies and vice versa.
jackmaninov (OP)
Full Member
***
Offline Offline

Activity: 139
Merit: 100


View Profile
May 19, 2012, 04:57:44 PM
Last edit: May 19, 2012, 05:09:40 PM by jackmaninov
 #4

Web app would be a bit weird (I personally won't upload any csv to a website with a list of addresses + trades...)

It would be cool to do a public spreadsheet template though for example.

I was thinking client-side javascript to interpret it, but an importer into google docs would work well too (especially if it could update through the API).

EDIT: Also, how can the calculator get current pricing if it isn't online?
Sukrim
Legendary
*
Offline Offline

Activity: 2618
Merit: 1006


View Profile
May 20, 2012, 09:11:04 AM
 #5

You could parse the csv for any assets you still hold and then do requests to the public API for these to get current prices. Also you could ask for orderbooks instead to have a "if I sell ALL my assets right now down to 1 Satoshi, how much can the market eat up and what do I end up with?" number.

https://www.coinlend.org <-- automated lending at various exchanges.
https://www.bitfinex.com <-- Trade BTC for other currencies and vice versa.
Sukrim
Legendary
*
Offline Offline

Activity: 2618
Merit: 1006


View Profile
May 20, 2012, 12:28:54 PM
 #6

Could you put this on github? Might be easier to edit/improve there...

Thanks by the way!

https://www.coinlend.org <-- automated lending at various exchanges.
https://www.bitfinex.com <-- Trade BTC for other currencies and vice versa.
Mushoz
Hero Member
*****
Offline Offline

Activity: 686
Merit: 500


Bitbuy


View Profile WWW
May 20, 2012, 01:06:13 PM
 #7

Works great! Would be awesome if it would be possible to see how much the shares you are currently holding are worth at the 24h avg price.
Do you think that would be possible to implement?

www.bitbuy.nl - Koop eenvoudig, snel en goedkoop bitcoins bij Bitbuy!
thirdlight
Sr. Member
****
Offline Offline

Activity: 445
Merit: 250



View Profile
May 20, 2012, 02:06:59 PM
 #8

Failed to cope with a "sellback" tx. Format is the same as a "sell", but type is "sellback".

teek
Hero Member
*****
Offline Offline

Activity: 667
Merit: 500



View Profile
May 20, 2012, 02:46:12 PM
Last edit: May 20, 2012, 03:03:04 PM by teek
 #9

Couldn't locat column type in sheet 'Import' (line 19)

Sad


edit: was working with wrong spreadsheet, seems to be working fine now.
sunnankar
Legendary
*
Offline Offline

Activity: 1031
Merit: 1000



View Profile WWW
May 20, 2012, 02:58:58 PM
 #10

If anyone is interest, I'll try to convert this to a JavaScript
script for Google spreadsheets, shouldn't be too hard.


Could you whip up a ImportHTML function for the Final balance from Blockchain.info for Google Docs? Pretty please?

This gets it from Blockexplorer.com but the site seems to be unreliable at times and it requires two lookups.

Code:

C9=address

A1=ImportData("http://blockexplorer.com/q/getreceivedbyaddress/"&C9)

A2=ImportData("http://blockexplorer.com/q/getsentbyaddress/"&C9)

Current Balance equals = A1-A2


sunnankar
Legendary
*
Offline Offline

Activity: 1031
Merit: 1000



View Profile WWW
May 20, 2012, 03:00:08 PM
 #11

Works great! Would be awesome if it would be possible to see how much the shares you are currently holding are worth at the 24h avg price.
Do you think that would be possible to implement?

Should use both the 24h and 5 day average price. The 5 day average price is probably more representative of the actual price you could sell at due to the current amount of volume. But then why not have both?

jackmaninov (OP)
Full Member
***
Offline Offline

Activity: 139
Merit: 100


View Profile
May 20, 2012, 06:01:51 PM
Last edit: May 20, 2012, 08:30:30 PM by jackmaninov
 #12

Wow, great work. I've left a 1BTC tip to encourage further development Smiley

I'm a bit disappointed with GLBSE not having any kind of legacy transaction in my history for my migrated GLBSEv1 account Sad
Sukrim
Legendary
*
Offline Offline

Activity: 2618
Merit: 1006


View Profile
May 20, 2012, 06:25:30 PM
 #13

Old data will come sooner or later too, at least we now have the current one!

https://www.coinlend.org <-- automated lending at various exchanges.
https://www.bitfinex.com <-- Trade BTC for other currencies and vice versa.
sunnankar
Legendary
*
Offline Offline

Activity: 1031
Merit: 1000



View Profile WWW
May 20, 2012, 11:54:05 PM
 #14

Huh ... not entirely sure why that is needed in the context of the GLBSE importer ?

Also, why don't you fallback on blockchain.info when blockexplorer.com fails ?


Not really needed for the importer but would be a helpful formula to have and I have been fumbling around with blockchain.info but not been able to get it to work. One option:

Code:
C104 = Address

=ImportHtml("http://blockchain.info/address/"&C104, "table", 2)

Would be nice to have just the Final Balance as the output.

farfiman
Legendary
*
Offline Offline

Activity: 1449
Merit: 1001



View Profile
June 06, 2012, 06:14:28 PM
Last edit: June 06, 2012, 06:25:09 PM by farfiman
 #15

I get this:

Oops
Unknown transaction type on row 42 ... aborting. (line 109)
OK

The type is "sellback"  which happens when for example  PPT.x does forced buyback

EDIT: for now I just change all 'sellback' to 'sell' and it works fine

"We are just fools. We insanely believe that we can replace one politician with another and something will really change. The ONLY possible way to achieve change is to change the very system of how government functions. Until we are prepared to do that, suck it up for your future belongs to the madness and corruption of politicians."
Martin Armstrong
vokain
Legendary
*
Offline Offline

Activity: 1834
Merit: 1019



View Profile WWW
July 03, 2012, 03:51:42 PM
 #16

i tried running it today (from the code on your first page post) and I get the same sellback error. I'm going to try running it after changing all the sellbacks to sells and let you know!
vokain
Legendary
*
Offline Offline

Activity: 1834
Merit: 1019



View Profile WWW
July 03, 2012, 08:46:45 PM
 #17

Unfortunately after a run through a ~1900 record CSV the script froze up and said maximum execution time reached or something along the lines Sad

streblo
Full Member
***
Offline Offline

Activity: 165
Merit: 100


View Profile
August 04, 2012, 08:06:06 PM
 #18

pnlCalc is barfing at the very end of the script. The headers of PNL, "asset shares etc..." become bold and then the spreadsheet says "Script pnlCalc experienced an error Dismiss".

Any ideas? =/
labestiol
Sr. Member
****
Offline Offline

Activity: 434
Merit: 251


View Profile
August 04, 2012, 09:20:23 PM
Last edit: August 04, 2012, 10:53:46 PM by labestiol
 #19

Close to the same bug, but i do have a random number of lines of assets in the PNL sheet, then it fails

EDIT : Problem seems to be random bugs on the GLBSE API call.

1BestioLC7YBVh8Q5LfH6RYURD6MrpP8y6
EskimoBob
Legendary
*
Offline Offline

Activity: 910
Merit: 1000


Quality Printing Services by Federal Reserve Bank


View Profile
August 05, 2012, 11:28:48 AM
 #20

"Script pnlCalc experienced an error"

This what I see on the Execution transcript log:

Code:
SpreadsheetApp.getActiveSpreadsheet()
Spreadsheet.getSheetByName([Import])
SpreadsheetApp.getActiveSpreadsheet()
Spreadsheet.setActiveSheet([Sheet])
Sheet.getLastRow()
Sheet.getLastColumn()
Sheet.getRange([1, 1, 1, 8])
Range.getLastColumn()
Range.getCell([1, 1])
Range.getValue()
....

Range.getCell([1, 7])
Range.getValue()
Range.getCell([1, 8])
Range.getValue()
SpreadsheetApp.getActiveSpreadsheet()
Spreadsheet.getSheetByName([PNL])
SpreadsheetApp.getActiveSpreadsheet()
Spreadsheet.insertSheet([PNL])
Sheet.clear()
SpreadsheetApp.getActiveSpreadsheet()
Spreadsheet.setActiveSheet([Sheet])
Sheet.appendRow([[asset, shares, invested, dividend, 24hAvgPrice, 5dAvgPrice]])
Sheet.getRange([1:1])
Range.setFontWeight([bold])
Sheet.setFrozenRows([1])
UrlFetchApp.fetch([https://glbse.com/api/asset/GLBSE_CASH])
HTTPResponse.getContentText()
Sheet.appendRow([[GLBSE_CASH, 0.0, 15.618193739999999, -0.0, 0.0, 0.0]])
UrlFetchApp.fetch([https://glbse.com/api/asset/WALLT_CASH])

While reading what I wrote, use the most friendliest and relaxing voice in your head.
BTW, Things in BTC bubble universes are getting ugly....
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!