Skip to content
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

Add CurrencyBeacon driver #149

Merged
merged 4 commits into from
Feb 13, 2024

Conversation

ragulka
Copy link
Contributor

@ragulka ragulka commented Feb 7, 2024

Summary

This PR adds a driver for the CurrencyBeacon API, which allows 5000 free requests every month.

Details

CurrencyBeacon supports crypto exchange rates in addition to traditional fiat currencies. However, since this package is geared towards fiat currencies, I am filtering the list supported currencies to fiat only.

Unfortunately, the API does not seem to support filtering the actual rate endpoints by the currency type, only symbols. This means if rates are fetched without a list of symbols, it'll return both fiat and crypto exchange rates.

If this is an issue, it would be recommended to get the list of fiat currencies first and use that to fetch the rates, ie:

$symbols = app(ExchangeRate::class)->currencies();
$rates  = app(ExchangeRate::class)->exchangeRate('EUR', $symbols);

PS. I fixed a tiny issue in one of the existing tests by using the correct URL for a given driver. It doesn't actually affect the test results, but it might cause confusion otherwise.

@ash-jc-allen ash-jc-allen merged commit 2398a07 into ash-jc-allen:master Feb 13, 2024
23 checks passed
@ash-jc-allen
Copy link
Owner

Hey @ragulka! This is awesome! Huge thank you for adding this, I really appreciate the addition. I've just merged it in, so I'll get it released now in v7.2.0 😄

@ragulka ragulka deleted the add-currency-beacon-driver branch February 13, 2024 12:54
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.

2 participants