|
Does anyone have any tips/recommendations for dealing with currency rates. We'll likely end up using an API, depending on what I can find, but just looking to see what experience others have.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Don't trust the ones at airports, or in bars?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Would you like to fill out our survey?
|
|
|
|
|
FAKU?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Always use an API; currency rates can change minute by minute.
|
|
|
|
|
To add to Richard MacCutchan's reply - store the history of the currency rate as well.
|
|
|
|
|
I saw one particular API that actually has the history as well.
Thanks, good advice.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I like the XE.com api.
We're philosophical about power outages here. A.C. come, A.C. go.
|
|
|
|
|
|
K, Thanks.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
What are the rates for?
Indicative or charging?
If you're going to use a rate from an API, make sure that you know the margin to apply. A lot of the time you'll get a spot price, aka mid price. You never trade at spot always at the buy/sell which will be off by a small margin, sometimes it's percentage, others use fixed points.
Pretend GBP-EUR rate is 1.10. A good margin would be +/-4 bp 1.06 / 1.14.
Also take into account reciprocal rates. from the above GBP-EUR would be 0.909090909.... However you apply it you get rounding errors.
FX Rates are bloody awful. If you want rates for anything other than indicative, you need the correct buy / rates and you should always just divide in the rate to reverse directions.
tl;dr;
FX is Evil.
veni bibi saltavi
|
|
|
|
|
Interesting. Thanks.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I don't really have much to offer that Naggy hasn't addressed. But I'll say this... it is possible to get the rate data without a broker's margin, but for that kind of feed you'll need to pay some moola or avoid using a broker for the data altogether and stick with Google or Yahoo et al and just accept the lag those APIs will give you.
Also, if you're doing this for an online business, I'd suggest always, always storing prices in a base currency (even for past orders) and also the currency of the sale along with the exchange rate at that point in history. It'll make your life a lot easier if you only have to think about one currency (preferably the currency you'll be paying taxes in for the company) and deal with exchanges on a case-by-case basis.
Not sure who you'll be processing payments through, but services like PayPal will handle this stuff for you btw. It's a pretty common problem...
ConvertCurrency API Operation - PayPal Developer[^]
Jeremy Falcon
|
|
|
|
|
I am using something I found from
http:
[
"https://openexchangerates.org/api/latest.json?app_id=04f370f1bf4a4ea7a386ade58f07d0e5" ]
myConnection.DownloadFile(Dts.Connections["OpenExchCurrency.json"].ConnectionString, true);
Have SQL 2012 so had to implement reading the JSON file format as a flat file, pretty simplistic it just ignores the first six lines of the file and starts with (example data)
"AED": 3.672761,
"AFN": 67.383551,
Once I read that into a table, parse (known 3 character positional for currency code, ":" to "," for value) for the four currencies I care for for the day. Added an AVG30Days and an AVGPeriod calculation. Then as someone else pointed out, I used a web based CSV request to get and add history back as far as my data goes. from before I had this option.
|
|
|
|
|
Great. Thank you.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Probably too simple but I use a call to google:
{
URI = "http://finance.google.com/finance/converter?a=1&from=NZD&to=" + Currencies[Counter];
System.Net.WebRequest req = System.Net.WebRequest.Create(URI);
try
{
System.Net.WebResponse resp = req.GetResponse();
StreamReader sr = new StreamReader(resp.GetResponseStream());
tmp = sr.ReadToEnd().Trim();
sr.Dispose();
}
and then parse the result.
|
|
|
|
|
Cool, thanks.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
|
I use the https://www.oanda.com/fx-for-business/exchange-rates-api API which works just great for my needs - tracking USD <-> GBP every minute 24/7
|
|
|
|
|
Maintain separate accounts.
Only convert on-the-fly when reporting; "actual" conversion when laundering.
Maintain a list of daily conversion rates for reporting.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
And I got to one section ... Survey.jpg
I'm reasonably sure they didn't mean to show the "Randomizing section" to punters, but I do wish they had chosen different letters. Kinda shows what they think of me, really...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
A key to a good customer relations is sincerity.
... such stuff as dreams are made on
|
|
|
|
|
James fan is a Bad Singer with Sting and loses a thousand (8)
modified 30-Oct-17 5:46am.
|
|
|
|
|
Jacobite?
Jacko minus the k + bite = sting?
Bit controversial if I'm right, as Jacko was a a way better singer than Mr. Sting!
98.4% of statistics are made up on the spot.
|
|
|
|
|
Well done you're correct.
Not controversial though as the Bad is capatalised as in the singer of Bad.
|
|
|
|