Skip to content

Conversation

@bhandras
Copy link
Member

@bhandras bhandras commented May 2, 2025

With this commit we add Coinbase to the existing fiat sources.

Pull Request Checklist

  • Update MinLndVersion if your PR uses new RPC methods or fields of lnd.

// ...
// ]
//
// Field meanings (per Coinbase docs):
Copy link

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, done!

Copy link

@hieblmi hieblmi left a 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.

return io.ReadAll(resp.Body)
}

// paarseCoinbaseData parses the JSON response from Coinbase's candles endpoint.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: paarse

Copy link
Member Author

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 {
Copy link

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?

Copy link
Member Author

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.

@bhandras bhandras force-pushed the coinbase-fiat-api branch from fa14cb4 to 62634b8 Compare May 2, 2025 11:03
@bhandras bhandras requested review from hieblmi and sputn1ck May 2, 2025 11:03
Copy link

@hieblmi hieblmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@sputn1ck sputn1ck left a 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

@bhandras bhandras merged commit 58ac281 into lightninglabs:master May 2, 2025
5 checks passed
@bhandras bhandras deleted the coinbase-fiat-api branch May 2, 2025 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants