-2

I am trying to use the API on the following site, https://www.cryptsy.com/pages/api, to download information to Excel.

I have never worked with JSON before, and I'm confused how to implement this. In particular I am interested in http://pubapi.cryptsy.com/api.php?method=singlemarketdata&marketid={MARKET ID}

I need to be signed in I think, so I can generate my own API key. Is it also possible to execute a trade on this API using an Excel macro?

Remi Guan
  • 21,506
  • 17
  • 64
  • 87
Anthony
  • 31
  • 1
  • 1
  • 8
  • You can connect to the https site with the [WinHTTP library](http://msdn.microsoft.com/en-us/library/windows/desktop/aa384081(v=vs.85).aspx). JSON is fairly simply, and could be accomplished by either creating your own parser or using the [ScriptControl library](http://msdn.microsoft.com/en-us/library/aa227633(v=vs.60).aspx) to get JScript to do it for you. HMAC-SHA512 would probably be easiest to get from the Win32 Crypto Api, since it requires a word size of 64 bits for calculation which would be difficult to work with in VBA. If you want to bit twiddle Currency variables, it's possible. – Blackhawk Dec 03 '13 at 20:24
  • 1
    Another option for connecting to the website to request the json is xmlhttp object. This article i think gives a good description of this and also compares to using IE for automation. http://www.jpsoftwaretech.com/an-exploration-of-ie-browser-methods-part-ii/. Regarding parsing the JSON and the ScriptControl that Blackhawk mentions, i think this stack questions sums it up good: http://stackoverflow.com/questions/14822672/parsing-a-json-object-array-in-excel-vba – weeksdev Dec 04 '13 at 03:55
  • There is an open source VBA-Web library which makes web calls very easy, you can find it on GitHub. – Sophist Mar 28 '16 at 11:02

1 Answers1

1

I am working on a similar project.

I suggest going to http://ramblings.mcpher.com/Home/excelquirks/json/declaritive/populating This is effectively the solution I am using. His cObject class converts the json into an Excel object with properties and methods, which is easily manipulated. It will put some of the data into a sheet for you.

On the page he has a code example where he details how it is working. You should be able to change the URL to the cryptsy public API. You will have to write code to handle the returned data. If you figure out how to connect to the private API, give me a shout as I am still working on that one.