-
Notifications
You must be signed in to change notification settings - Fork 31
fiat: add support for using Coinbase to fetch hourly/daily prices #218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fiat/coinbase_api.go
Outdated
| // ... | ||
| // ] | ||
| // | ||
| // Field meanings (per Coinbase docs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we provide a link to the docs here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, done!
hieblmi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small drive by review.
fiat/coinbase_api.go
Outdated
| return io.ReadAll(resp.Body) | ||
| } | ||
|
|
||
| // paarseCoinbaseData parses the JSON response from Coinbase's candles endpoint. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: paarse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
|
||
| prices := make([]*Price, 0, len(raw)) | ||
| for _, c := range raw { | ||
| if len(c) < 5 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be != 5, or are there only cases with less than 5?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah good point. According to their docs: "Historical rate data may be incomplete. No data is published for intervals where there are no ticks.", so i'd say we should allow for rows where the data is "inclomplete" ie. likely empty. It's hard to say if they'd change their API's output in a non-backward compatible way, but I think it's safe to expect that they'd like introduce any breaking changes under a separate url path, eg. /v2/ etc. Added a comment clarifying incompleteness.
fa14cb4 to
62634b8
Compare
hieblmi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
sputn1ck
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for the fix
With this commit we add Coinbase to the existing fiat sources.
Pull Request Checklist
MinLndVersionif your PR uses new RPC methods or fields oflnd.