Skip to content

Dated Exchange rates #991

@IanVaughan

Description

@IanVaughan

I have requirements to exchange money based on exchange rates on specific dates.
This is working fine currently by using manual converting code, rather than the Exchange rate stores.
What I'm thinking is if this is something that could/should be brought into Money gem?
I'm happy to implement it and raise a PR, but wanted to check first if its likely to be accepted.

I'm thinking that the interface should be extended, for the Store interface

def add_rate(iso_from, iso_to, rate, date: nil); end  # Or normal default date = nil defaults
def get_rate(iso_from, iso_to, date: nil); end

And a Money class update

def exchange_to(other_currency, date: nil, &rounding_method)

Of corce lots of other changes will be needed as well, but raising this to get feedback on if the idea is even doable!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions