Bitcoin Forum
December 03, 2016, 05:52:33 PM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  

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 3030 times)
jackmaninov
Full Member
***
Offline Offline

Activity: 139


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...

Will tutor physics or perform DFT calculations for Bitcoin (PM me!): 1jackkHHCLtxryJFAnPhrbvfcomtvXSzg
1480787553
Hero Member
*
Offline Offline

Posts: 1480787553

View Profile Personal Message (Offline)

Ignore
1480787553
Reply with quote  #2

1480787553
Report to moderator
1480787553
Hero Member
*
Offline Offline

Posts: 1480787553

View Profile Personal Message (Offline)

Ignore
1480787553
Reply with quote  #2

1480787553
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480787553
Hero Member
*
Offline Offline

Posts: 1480787553

View Profile Personal Message (Offline)

Ignore
1480787553
Reply with quote  #2

1480787553
Report to moderator
1480787553
Hero Member
*
Offline Offline

Posts: 1480787553

View Profile Personal Message (Offline)

Ignore
1480787553
Reply with quote  #2

1480787553
Report to moderator
Sukrim
Legendary
*
Offline Offline

Activity: 1848


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://bitfinex.com <-- leveraged trading of BTCUSD, LTCUSD and LTCBTC (long and short) - 10% discount on fees for the first 30 days with this refcode: x5K9YtL3Zb
Mail me at Bitmessage: BM-BbiHiVv5qh858ULsyRDtpRrG9WjXN3xf
Sukrim
Legendary
*
Offline Offline

Activity: 1848


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://bitfinex.com <-- leveraged trading of BTCUSD, LTCUSD and LTCBTC (long and short) - 10% discount on fees for the first 30 days with this refcode: x5K9YtL3Zb
Mail me at Bitmessage: BM-BbiHiVv5qh858ULsyRDtpRrG9WjXN3xf
jackmaninov
Full Member
***
Offline Offline

Activity: 139


View Profile
May 19, 2012, 04:57:44 PM
 #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?

Will tutor physics or perform DFT calculations for Bitcoin (PM me!): 1jackkHHCLtxryJFAnPhrbvfcomtvXSzg
Sukrim
Legendary
*
Offline Offline

Activity: 1848


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://bitfinex.com <-- leveraged trading of BTCUSD, LTCUSD and LTCBTC (long and short) - 10% discount on fees for the first 30 days with this refcode: x5K9YtL3Zb
Mail me at Bitmessage: BM-BbiHiVv5qh858ULsyRDtpRrG9WjXN3xf
Sukrim
Legendary
*
Offline Offline

Activity: 1848


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://bitfinex.com <-- leveraged trading of BTCUSD, LTCUSD and LTCBTC (long and short) - 10% discount on fees for the first 30 days with this refcode: x5K9YtL3Zb
Mail me at Bitmessage: BM-BbiHiVv5qh858ULsyRDtpRrG9WjXN3xf
Mushoz
Hero Member
*****
Offline Offline

Activity: 686


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: 281



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: 664


ASICMINER Official Canadian Distributor


View Profile
May 20, 2012, 02:46:12 PM
 #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: 1030



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: 1030



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
Full Member
***
Offline Offline

Activity: 139


View Profile
May 20, 2012, 06:01:51 PM
 #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

Will tutor physics or perform DFT calculations for Bitcoin (PM me!): 1jackkHHCLtxryJFAnPhrbvfcomtvXSzg
Sukrim
Legendary
*
Offline Offline

Activity: 1848


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://bitfinex.com <-- leveraged trading of BTCUSD, LTCUSD and LTCBTC (long and short) - 10% discount on fees for the first 30 days with this refcode: x5K9YtL3Zb
Mail me at Bitmessage: BM-BbiHiVv5qh858ULsyRDtpRrG9WjXN3xf
sunnankar
Legendary
*
Offline Offline

Activity: 1030



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



View Profile
June 06, 2012, 06:14:28 PM
 #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: 1610


V.V.V.V.V.


View Profile
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!

...مكتوب
Escape the plutocrats’ zanpakutō, Flower in the Mirror, Moon on the Water: brave “the ascent which is rough and steep” (Plato).
vokain
Legendary
*
Offline Offline

Activity: 1610


V.V.V.V.V.


View Profile
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


...مكتوب
Escape the plutocrats’ zanpakutō, Flower in the Mirror, Moon on the Water: brave “the ascent which is rough and steep” (Plato).
streblo
Full Member
***
Offline Offline

Activity: 165


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


View Profile
August 04, 2012, 09:20:23 PM
 #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


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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!