leoschweizer / moneymoney-coinbase-pro

Inofficial MoneyMoney extension to list Coinbase Pro balances as securities
MIT License
6 stars 4 forks source link

[FIX] Issue #7 : Check products before fetching price #9

Closed TheSerapher closed 5 years ago

TheSerapher commented 5 years ago

As requested, a quick fix for the current issue with unavailable currencies in the ticker.

Fixes #7

qoomon commented 5 years ago

LGTM

qoomon commented 5 years ago

I just got an answer from the moneymoney support how to do it the right way you have to set the Accept header to application/json then no exception is thrown, even if the api response code is 404. e.g.

local headers = {}
headers["Accept"] = "application/json"
local content = Connection():request("GET", url, nil, nil, headers)
return JSON(content):dictionary()
leoschweizer commented 5 years ago

@TheSerapher having that information from @qoomon now, would you like to implement this differently, or leave it as it is?

TheSerapher commented 5 years ago

I think instead of causing wild 404s and checking for headers and status codes, why not keep it as is and check if we should call it at all.