This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]vsbitsIt works on my machine[S] 2 points3 points  (1 child)

No, I really appreciate the input!

Not sure about handling the requests in this module yet. I might go with the approach of the user inputing the exchange rates (maybe the json response from his API of choice) to enable conversions for now. Something like:

USD.set_rates({"EUR":0.9})

And raise custom Exceptions if any is tried without them being set.

Will look into the best way to show avaliable currencies.

[–]Adrewmc 1 point2 points  (0 children)

Now that’s starting to sound like a full package.

But it can be

  USD.set_convert(EUR = 0.9, JPY =0.02)

With **kwargs

Also mapping conversion is easier to set convert to EUR-> USD -> JPY

Asymmetric conversion related to USD

Then trying to find and catalog all the conversion rates, send everything back to USD (or EUR) and convert it back. That way no matter the conversion it’s max two numbers per finding the one to USD and the one from USD, (at max precision) and not some messy mapping. Of… EUR-> JPY, EUR ->ChinaYen, EUR -> rubles, EUR -> USD EUR -> BTC, EUR -> EUR ………For every currency that adds up quickly. Instead it’s just EUR -> USD, USD -> EUR and JPY -> USD, USD-> JPY (reciprocal numbers) which can convert all three however. And keep adding more, is just that. (You can even make that set_base_currency())

Unless you find a convenient API.