RE: Cryptocurrency Accounting in Excel by konstantint

View this thread on steempeak.com

Viewing a response to: @cryptoblock/re-konstantint-cryptocurrency-accounting-in-excel-20170903t121255284z

· @konstantint ·
Yes, you can do the same in OpenOffice as well. 

Go to *Tools ⇒ Macros ⇒ Organize Macros ⇒ OpenOffice Basic...*, create a new module under your current document, and paste the following, slightly modified, version of the code in the newly opened editor window:

```
Public Function HttpGet(ByVal requestUrl As String) As String
    Set http = CreateObject("WinHttp.WinHttpRequest.5.1")
    With http
        .Open "GET", requestUrl, True
        .Send ""
        .WaitForResponse 10
        HttpGet = .ResponseText
    End With
End Function

Public Function GetCryptoCurrencyPrice(ByVal name As String, ByVal baseCurrency As String, Optional cacheBuster As Variant) As Double
    GetCryptoCurrencyPrice = -1#
    json = HttpGet("https://api.coinmarketcap.com/v1/ticker/" & name & "/?convert=" & baseCurrency)
    
    For Each Line In Split(json)
        If found Then
            GetCryptoCurrencyPrice = CDbl(Mid(Line, 2, Len(Line) - 3))
            Exit Function
        End If
        If Line = """price_" & LCase(baseCurrency) & """:" Then
            found = True
        End If
    Next
End Function
```
properties (22)
post_id11,874,447
authorkonstantint
permlinkre-cryptoblock-re-konstantint-cryptocurrency-accounting-in-excel-20170903t232907870z
categoryhowto
json_metadata"{"app": "steemit/0.1", "tags": ["howto"]}"
created2017-09-03 23:29:09
last_update2017-09-03 23:29:09
depth2
children0
net_rshares0
last_payout2017-09-10 23:29:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length1,111
author_reputation360,301,994,866
root_title"Cryptocurrency Accounting in Excel"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000