logic - algorithm to convert from money to other without directly conversor -
i need currency conversor.
suppose have list of objects currency money , value in other. example:
from value usd-can 0,1 can-usd 0,4 usd-aud 0.5 aud-usd 0,6 aud-eur 1 eur-aud 3
and need convert list of values currency money eur example
1,22 usd 1,4 can 5 aud
there values convertions directly (aud-eur), not(usd-eur,can-eur).
witch best way or algorithm this..?
construct directed graph nodes currencies , edges direct conversions. find shortest path(s) source currency target currency.
you can set edge weights log(conversion-rate) find best conversion path (taking log adding weights instead of multiplying them).
you may try detect 2-point arbitrage, 3-point arbitrage (look here example) or n-point arbitrage (look here).
Comments
Post a Comment