From my limited experience, you don't want ->new("EUR/USD"), at least not as the canonical version. FX rates tend to be "traditionally" ordered, and in my experience the tradition of the currency pair order is broken/changed far too often to consider EUR/USD and USD/EUR as different pairs. Also, base and quote only make sense as long as your front end system gives you access to which currency actually was the base currency and which was the quoted currency.
Personally, I would keep the currencies and the amounts together, and basically use:
my $fx= MyApp::FXRate->new( EUR => 1_000_000, USD => 1_082_500 );
Alternatively, if you want to allow room for other options, I would propably use something like:
my $fx= MyApp::FX->new( pay => [ EUR => 1_000_000 ], receive => [ USD => 1_082_500 ], spot_date => '2015-03-06', );
In reply to Re: API Design
by Corion
in thread API Design
by Galdor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |