krijnsent / crypto_vba

An Excel/VBA project to communicate with various cryptocurrency exchanges APIs
MIT License
155 stars 54 forks source link

how to add new crypto currencies (coinbase) #85

Closed cafrit00 closed 2 years ago

cafrit00 commented 2 years ago

Hello,

I got your excel sheet finally working I get the balance for XYO on table 4, but I would like to add more crypto currencies. I was trying to add new lines adding ICP or EUR but when I run the macro the lines added desappear and that's it.

another question looking at table 4 columns

"color" it has no color but a value instead like #263145 is this normal ?? "sort index" has the no. 225 what is this used for ?? "exponent" has value 8 what is this used for? "type" is always crypto by default "amount" there are several options but the most used value is ^(?:0x)?[0-9a-fA-F]{40}$ what does it mean? "currency" we find something in thi format 5fcaa9b6-cea0-52af-bbd4-40c8053ef49f what is this used for ?

thanks for your help

Regards Carlos

krijnsent commented 2 years ago

Hi Carlos, that overview could indeed be a bit better: I'm now dumping the stuff I get back from Coinbase. As you can see in the macro on that sheet (named GetMyCoinbaseData), this is the command that is called: JsonResponse = PrivateCoinbase("accounts", "GET", Cred) That did give all accounts once, but Coinbase changed their API quite a bit. Now this should happen: https://developers.coinbase.com/api/v2#list-accounts After that, my code picks up the JSON that gets returned and with these 3 lines:

Set Json = JsonConverter.ParseJson(JsonResponse)
ResArr = JsonToArray(Json)
Tbl = ArrayTable(ResArr, False)

The code parses the JSON and tries to transform it into a flat table (so it can fit in an Excel sheet), but the structure of the reply-JSON is apparently not suited for that anymore. So that bit has to be updated to fit into a table again. The items you mention (color, exponent, etc) is technical stuff that the Coinbase API returns.

Hope that helps to modify the code to your needs.