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

Store and fetch recent exchange rates in our own database. #29

Open
iokiwi opened this issue Oct 5, 2023 · 5 comments
Open

Store and fetch recent exchange rates in our own database. #29

iokiwi opened this issue Oct 5, 2023 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@iokiwi
Copy link
Owner

iokiwi commented Oct 5, 2023

Calling out to an external API to get exchange rates on every request is suboptimal for several reasons.

  • Its not particularly performant
  • If the 3rd party service goes down we're in trouble
  • Either we will have to pay for API usage or we are placing unfairly placing unnecessary load on a service run for free.

We should keep a table in our database with a recent exchange rate and the time it was updated.

We can update the table on a schedule or inflight if the data has become 'stale' according.

@iokiwi iokiwi added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers hacktoberfest-accepted labels Oct 5, 2023
@iokiwi iokiwi changed the title Store a recent copy exchange rate data in our own database. Store and fetch recent exchange rates in our own database. Oct 5, 2023
@iokiwi
Copy link
Owner Author

iokiwi commented Oct 12, 2023

I am considering a redis cluster for this just for the sake of learning redis :)

@tehnools
Copy link
Collaborator

cosmos db :D ?

@abhinna1
Copy link
Contributor

abhinna1 commented Jan 6, 2024

I would recommend using arq to schedule a CRON job for fetching and updating the rates in the local database. arq is a great library that allows you achieve this. PS. it's built using asyncio.

@tehnools
Copy link
Collaborator

For the in memory cache could use memcached as well it's a lot simpler than Redis and it's Open BSD license
https://memcached.org/

@tehnools
Copy link
Collaborator

Do we want the exchange rates to be very accurate or are we ok to save the exchange rates eg. like 12am every night or something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants